The best local LLM for coding is the strongest open-weight model whose license you can accept and whose weights plus KV cache fit your memory. In September 2026 that means Devstral Small 2 or Qwen3.8-27B on a 32 GB GPU, Qwen3-Coder-Next or gpt-oss-120b on a 128 GB machine, and GLM-5.3-Flash on multi-GPU servers.
Open-weight coding models moved fast in the last twelve months. Several now ship with tool-calling formats built for coding agents, 256K-token context windows, and mixture-of-experts (MoE) designs that keep only a few billion parameters active per token. That makes local coding practical on hardware a team can buy without a data-centre project.
This comparison covers ten models. Every license, parameter count, context length and release month below was checked against the vendor’s model card or announcement on 27 September 2026. Benchmark figures appear only where a vendor published them, with the benchmark named. Open-weight releases land monthly, so re-check the card before you standardise.
How to choose a local coding model
Five questions settle most shortlists, and they are worth asking in this order.
- Can you use it commercially? A license that fails review ends the evaluation, however good the model is. Apache 2.0 and MIT are the easy cases. Modified MIT and custom licenses need a careful read.
- Does it fit? All MoE experts must sit in memory, so total parameters set the memory bill. Active parameters set how many bytes are read per generated token, which is what decode speed depends on.
- How much context will you actually serve? A 256K window on the card is a ceiling. The KV cache for each session grows with every token, and it often limits you before the weights do.
- Was it trained for agentic tool use? Coding agents call tools on almost every turn. Prefer models whose card documents a tool-call format and names the harnesses it was tested with.
- Can your runtime serve it correctly? New architectures need recent vLLM, SGLang or llama.cpp builds, and some ship custom chat encodings.
The same logic applies to general model selection. Our local LLM overview covers the basics if you are new to self-hosting.
The shortlist: ten open-weight coding models
Checked against vendor model cards on 27 September 2026. The 4-bit column is planning arithmetic: total parameters × 0.55 bytes, which allows for quantization scales and a few layers kept at higher precision. Where a vendor ships a native low-precision checkpoint, the column shows the published checkpoint size instead.
| Model (vendor) | Released | License | Total / active params | Context | Weights at 4-bit | Agentic notes from the vendor |
|---|---|---|---|---|---|---|
| Qwen3-Coder-Next (Qwen) | Feb 2026 | Apache 2.0 | 80B / 3B MoE | 256K | ≈ 44 GB | Card names Claude Code, Qwen Code, Cline, Kilo, Trae, Qoder |
| Qwen3-Coder-30B-A3B-Instruct (Qwen) | Jul 2025 | Apache 2.0 | 30.5B / 3.3B MoE | 256K, 1M with YaRN | ≈ 17 GB | Own function-call format; Qwen Code and Cline |
| Qwen3.8-27B (Qwen) | Aug 2026 | Apache 2.0 | 27B dense | 262K, extensible to 1M | ≈ 15 GB | Thinking on by default; image input |
| Devstral Small 2 (Mistral) | Dec 2025 | Apache 2.0 | 24B dense | 256K | ≈ 13 GB | Vibe, Cline, Kilo Code, Claude Code, OpenHands, SWE-agent |
| Mistral Medium 3.5 (Mistral) | Apr 2026 | Modified MIT, revenue cap | 128B dense | 256K | ≈ 70 GB | Replaces Devstral 2 in Mistral Vibe |
| Gemma 4 31B (Google) | Apr 2026 | Apache 2.0 | 30.7B dense | 256K | ≈ 17 GB | Native function calling |
| gpt-oss-120b / 20b (OpenAI) | Aug 2025 | Apache 2.0 plus usage policy | 117B / 5.1B and 21B / 3.6B | 128K | 65 GB / 14 GB (native MXFP4) | Function calling; harmony format required |
| GLM-5.3-Flash (Z.ai) | Aug 2026 | MIT | 320B / 18B MoE | Up to 1M | ≈ 176 GB | Z.ai runs its terminal benchmarks inside Claude Code |
| DeepSeek-V4-Flash (DeepSeek) | Apr 2026 preview, Jul 2026 release | MIT | 284B / 13B MoE | 1M | 167 GB as shipped (FP4 + FP8) | Three reasoning modes; no Jinja chat template |
| Kimi K3 (Moonshot AI) | Jul 2026 | Kimi K3 License | 2.8T / 104B MoE | 1M | ≈ 1.56 TB (native MXFP4) | Evaluated with the Kimi Code harness |
Notes on each model
Qwen3-Coder-Next
Qwen describes this as a model “designed specifically for coding agents and local development.” Only 12 of its 48 layers use full attention, with 2 KV heads each; the rest use linear attention. That keeps the KV cache unusually small for a 256K model. It runs in non-thinking mode only. The card asks for vLLM 0.15.0 or SGLang 0.5.8 or later with the qwen3_coder tool-call parser. Qwen’s launch post reports over 70% on SWE-bench Verified using the SWE-Agent scaffold.
Qwen3-Coder-30B-A3B-Instruct
The smaller agentic Qwen coder from July 2025. With 3.3B active parameters it reads few bytes per token, which suits single-GPU workstations. Its 48 layers each keep 4 KV heads, so long sessions cost more memory than they do on the Next model.
Qwen3.8-27B
A general model, not a coder, but Qwen reports 61.7 on SWE-bench Pro using the Claude Code harness on its refined version of the benchmark. Thinking is on by default. Budget for longer outputs or lower the reasoning effort per request.
Devstral Small 2 and Mistral Medium 3.5
Devstral Small 2 is the Apache 2.0 option from Mistral. The card says it is light enough for a single RTX 4090 or a Mac with 32 GB of RAM, and Mistral reports 68.0% on SWE-bench Verified. Mistral Medium 3.5 is a dense 128B model that now replaces Devstral 2 in Mistral’s Vibe CLI, with a reported 77.6% on SWE-bench Verified. Its Modified MIT license grants no rights to any company whose consolidated monthly revenue exceeded $20 million in the previous month. Most enterprises reading this will need a commercial agreement.
Gemma 4 31B
Google released Gemma 4 under Apache 2.0. The 31B dense model interleaves 1,024-token sliding-window layers with global attention layers, and Google reports 80.0% on LiveCodeBench v6. The 26B A4B MoE sibling trades some quality for speed.
gpt-oss-120b and gpt-oss-20b
OpenAI ships both models natively quantized in MXFP4, so the 120b runs within 80 GB and the 20b within 16 GB. The catch for tooling is the harmony response format. OpenAI states the models should only be used with it, so confirm your runtime applies the chat template correctly.
GLM-5.3-Flash
Z.ai’s MIT-licensed, multimodal MoE uses hybrid sparse and linear attention to cut long-context serving cost. The FP8 checkpoint is 328 GB, which puts it on multi-GPU servers or a 256 GB-class machine at 4-bit. The larger GLM-5.3 (753B) uses a separate GLM-5.3 License with a security-review clause for very large model-service operators.
DeepSeek-V4-Flash
The July release (V4-Flash-0731) supersedes the April preview and keeps the MIT license. DeepSeek’s preview card reports 79.0 on SWE-bench Verified in its maximum reasoning mode. The release ships no Jinja chat template. DeepSeek supplies Python encoding scripts instead, so check how your runtime formats prompts before trusting results.
Kimi K3
At 2.8T parameters, Kimi K3 is a rack-scale model: the MXFP4 checkpoint alone is about 1.56 TB. Its license exempts internal use from both the model-as-a-service condition and the display requirement, which matters for teams that only serve their own developers.
Left off the list
Codestral 22B remains under the Mistral AI Non-Production License, which forbids production use. Qwen3.8-Flash-Next ships under the Qwen Community License 1.0, which requires a separate license for any business offering a model service or an “AI Work Assistant” such as a coding product. Internal use is exempt, but software vendors should note it.
Memory arithmetic for coding workloads
Three terms decide whether a model fits:
- Weights ≈ total parameters × bytes per parameter: about 2 at BF16, 1 at 8-bit, 0.5 to 0.6 at 4-bit.
- KV cache per token = 2 × full-attention layers × KV heads × head dimension × bytes per value. Multiply by tokens in context and by concurrent sessions.
- Headroom of 10 to 20 percent for activations, the runtime and fragmentation.
Three worked examples, using layer and head counts from each model’s config.json and a 16-bit KV cache:
| Scenario | Weights | KV cache | Before headroom |
|---|---|---|---|
| Qwen3-Coder-30B-A3B, 4-bit, one 64K session | 30.5B × 0.55 ≈ 16.8 GB | 2 × 48 × 4 × 128 × 2 = 98,304 B/token × 65,536 ≈ 6.4 GB | ≈ 23 GB |
| Devstral Small 2, 4-bit, one 128K session | 24B × 0.55 ≈ 13.2 GB | 2 × 40 × 8 × 128 × 2 = 163,840 B/token × 131,072 ≈ 21.5 GB | ≈ 35 GB |
| Qwen3-Coder-Next, 4-bit, four 128K sessions | 80B × 0.55 ≈ 44 GB | 2 × 12 × 2 × 256 × 2 = 24,576 B/token × 131,072 × 4 ≈ 12.9 GB | ≈ 57 GB, plus fixed linear-attention state |
The Devstral row shows why context is the variable to watch. A 24B dense model with 40 attention layers needs more memory for one 128K session than for its weights. Storing the KV cache at 8-bit halves that term; vLLM, for example, supports an FP8 KV cache. Our GPU sizing method walks through the same arithmetic for concurrency planning.
Hardware tiers for local coding
| Tier | Example hardware | Models from the shortlist at 4-bit |
|---|---|---|
| 16–32 GB | One 24–32 GB GPU; a Mac with 32 GB or more | gpt-oss-20b, Devstral Small 2, Qwen3.8-27B, Qwen3-Coder-30B-A3B, Gemma 4 31B, with 32K–64K context |
| 64–128 GB | DGX Spark, Ryzen AI Max+ 395 systems, Mac Studio M5 Max with 128 GB, one 80–96 GB GPU | Qwen3-Coder-Next, gpt-oss-120b; Mistral Medium 3.5 fits with limited context room |
| 256–512 GB | Mac Studio M5 Ultra, two to four linked DGX Sparks, a multi-GPU server | GLM-5.3-Flash, DeepSeek-V4-Flash |
| Rack | 8-GPU nodes | Kimi K3, GLM-5.3 |
Memory capacity decides the tier. Memory bandwidth and active parameters decide how quickly tokens arrive. A 3B-active MoE reads about a ninth of the weight bytes per generated token that a 27B dense model reads, which is why MoE coders suit bandwidth-limited unified-memory machines. We compare the three popular desk-side boxes in our DGX Spark, Mac Studio and Ryzen AI Max comparison.
Serving the model and connecting a coding agent
Runtimes
- Ollama is the quickest start. Its docs describe connecting Claude Code through Ollama’s Anthropic-compatible API and advise a context of 64K or more for larger repositories. Aider’s docs warn that Ollama’s default context is small and silently drops what overflows, so set it explicitly.
- LM Studio exposes OpenAI-compatible and Anthropic-compatible endpoints, and ships a headless daemon,
llmster, for servers. - llama.cpp (
llama-server) offers OpenAI-compatible routes, Anthropic Messages compatibility, and tool calling with the--jinjaflag. - vLLM and SGLang are the production-style options. Tool calls need
--enable-auto-tool-choiceplus the parser the model card names. - MLX-LM runs and quantizes models natively on Apple silicon.
Coding agents and editors
| Harness | How its docs reach a local model | Watch for |
|---|---|---|
| Continue | Ollama guide in the official docs | Its docs note that not every model claiming tool support works in agent mode |
| Cline | Ollama, LM Studio | Docs suggest the compact prompt and 64 GB+ for larger models |
| Aider | Ollama (ollama_chat/<model>), LM Studio, any OpenAI-compatible API | Context sizing on Ollama |
| OpenCode | Ollama, LM Studio, llama.cpp, custom OpenAI-compatible providers | Docs stress strong tool-calling support |
| Claude Code | ANTHROPIC_BASE_URL pointed at an Anthropic-format endpoint | Anthropic does not support routing it to non-Claude models |
| Qwen Code, Mistral Vibe | Vendor CLIs named on the Qwen and Mistral model cards | Tuned for their own model families |
General agent harnesses follow the same endpoint pattern. Our guide to running OpenClaw or Hermes Agent locally covers that setup. For the wider tool landscape, see our on-prem coding assistant comparison.
Governance for enterprise source code
Running the model locally moves inference inside your boundary. It does not by itself make the setup governable.
- License. Store the license file with the weights and record which version you approved. Revenue caps, model-service clauses and display requirements differ between the Mistral, Kimi and Qwen community licenses above. Our note on open-weight licensing terms covers the review.
- Data egress. Mirror weights to an internal registry and verify checksums, so developer machines never pull from the internet. Audit the harness too: editor extensions, update checks and web-fetch tools can still call out when the model is local.
- Audit. Log the model version, prompts, tool calls, file diffs and the developer who approved each change. A shared internal endpoint with per-developer credentials makes this possible. A model running on every laptop does not.
- Execution. Coding agents run shell commands. Run them in containers or sandboxes without production credentials, SSH keys or cloud CLIs.
- Artifacts. Community quantizations, such as the GGUF builds some model cards point to, are third-party files. Evaluate the exact file you deploy against your own test set, not the vendor’s full-precision scores.
How VDF AI fits
VDF Code is VDF AI’s coding assistant for teams that need this governance built in. According to its product page, it ships extensions for VS Code, JetBrains IDEs, Neovim and Visual Studio. It deploys in your VPC, on-premises on Kubernetes, OpenShift or bare metal, or fully air-gapped with signed offline update bundles. The on-premises tier includes open-weight model hosting for model families such as Qwen, Mistral and DeepSeek.
Teams that end up running more than one local model can put the choice in policy. VDF AI Router registers Ollama and custom on-premises deployments alongside approved cloud models, and its air-gap mode restricts routing to local models only. Shortlist two candidates from the table above, test both on your own repositories, and let routing rules decide which one serves each request.
Sources
Verified 27 September 2026.
- Qwen3-Coder-Next model card
- Qwen3-Coder-Next launch post (Alibaba Cloud)
- Qwen3-Coder-30B-A3B-Instruct model card
- Qwen3.8-27B model card
- Qwen Community License 1.0 (Qwen3.8-Flash-Next)
- Devstral Small 2 model card
- Devstral 2 and Mistral Vibe announcement
- Mistral Medium 3.5 model card
- Mistral Medium 3.5 license
- Mistral AI Non-Production License
- Gemma 4 31B model card
- Gemma 4 launch post
- Introducing gpt-oss (OpenAI)
- gpt-oss-120b model card
- GLM-5.3-Flash model card
- GLM-5.3 License
- DeepSeek-V4-Flash preview model card
- DeepSeek-V4-Flash-0731 model card
- Kimi K3 model card
- Kimi K3 License
- Ollama: Claude Code integration
- LM Studio developer docs
- llama.cpp server README
- vLLM tool calling
- vLLM quantized KV cache
- MLX LM
- Continue: Ollama guide
- Cline: running models locally
- Aider: Ollama
- OpenCode: providers
- Claude Code: LLM gateways
Choosing a local coding model for a regulated team? See how VDF Code runs on-premises or air-gapped, or book a demo.