Local Models for Coding Agents
Local models are worth considering when code cannot leave the machine, or when thousands of small edits run every day. This page lists candidates by GPU memory (8, 12, 16 and 24 GB) and by Apple Silicon unified memory (16, 32 and 64 GB). Whether a given model fits, and how much room is left for context, is worked out in single-device deployment.
The first test for a candidate is format, not score: a high benchmark score cannot compensate for output the harness cannot parse. gpt-oss-20b, for example, was trained on Harmony, the chat and tool-call format OpenAI defined for gpt-oss, and its model card says it will not work correctly with any other format. If the runtime does not support Harmony, the harness cannot parse the model's tool calls, however high its scores.
A Mac's unified memory also has to hold the operating system, the display and other programs, so less is left for the model than the nominal size. Since Ollama 0.40.0, architectures that MLX supports run on MLX automatically on Apple Silicon; Gemma 4 is among them.
Verified from the providers' official model cards on 2026-10-29. No candidate below has yet earned a universal “best local coder” label. Exact quantization, runtime, template, context, and harness define the tested system.
Candidates by memory tier
Note: “Try first” and “Also worth trying” are inferences from file size and model positioning, not official model-card recommendations. MoE “active parameters” describe per-token compute; they do not shrink the total weights that must be stored. “About N GB of weights” is parameter count times bytes per parameter (0.5 byte at 4-bit, 1 byte at 8-bit), without the KV cache.
Candidates that enter a real selection are retested with the local model evaluation protocol.
Selection Axes
Before downloading, choose the task and score candidates on:
- exact patch and tool-call validity;
- repository-language coverage, not only Python;
- accepted-result rate over repeated runs;
- latency, peak memory, CPU offload, and usable context;
- license and downstream redistribution obligations for the exact artifact;
- chat/reasoning format support in the chosen runtime;
- multilingual behavior and security/refusal behavior relevant to the workflow.
Role-Based Routing
- A compact model takes low-consequence, externally checked steps: file triage, query generation, log reduction, or a one-file mechanical edit; a larger quantized model takes bounded implementation or review.
- Every change happens in a copy of the repository with tests run there; on failure, discard the copy without touching the working directory.
- Architecture, security-sensitive work, or a repeated error signature goes to a stronger model or a person; when a task counts as done and when to stop are covered in Bounded Agent Loops.