Software Development

Best Local LLMs for Coding in 2026: Open-Weight Models Compared

Ten open-weight coding models you can run on your own hardware, checked against their model cards in September 2026 and compared on license, parameters, context, tool calling, memory needs and the coding agents that can use them.

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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)ReleasedLicenseTotal / active paramsContextWeights at 4-bitAgentic notes from the vendor
Qwen3-Coder-Next (Qwen)Feb 2026Apache 2.080B / 3B MoE256K≈ 44 GBCard names Claude Code, Qwen Code, Cline, Kilo, Trae, Qoder
Qwen3-Coder-30B-A3B-Instruct (Qwen)Jul 2025Apache 2.030.5B / 3.3B MoE256K, 1M with YaRN≈ 17 GBOwn function-call format; Qwen Code and Cline
Qwen3.8-27B (Qwen)Aug 2026Apache 2.027B dense262K, extensible to 1M≈ 15 GBThinking on by default; image input
Devstral Small 2 (Mistral)Dec 2025Apache 2.024B dense256K≈ 13 GBVibe, Cline, Kilo Code, Claude Code, OpenHands, SWE-agent
Mistral Medium 3.5 (Mistral)Apr 2026Modified MIT, revenue cap128B dense256K≈ 70 GBReplaces Devstral 2 in Mistral Vibe
Gemma 4 31B (Google)Apr 2026Apache 2.030.7B dense256K≈ 17 GBNative function calling
gpt-oss-120b / 20b (OpenAI)Aug 2025Apache 2.0 plus usage policy117B / 5.1B and 21B / 3.6B128K65 GB / 14 GB (native MXFP4)Function calling; harmony format required
GLM-5.3-Flash (Z.ai)Aug 2026MIT320B / 18B MoEUp to 1M≈ 176 GBZ.ai runs its terminal benchmarks inside Claude Code
DeepSeek-V4-Flash (DeepSeek)Apr 2026 preview, Jul 2026 releaseMIT284B / 13B MoE1M167 GB as shipped (FP4 + FP8)Three reasoning modes; no Jinja chat template
Kimi K3 (Moonshot AI)Jul 2026Kimi K3 License2.8T / 104B MoE1M≈ 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:

ScenarioWeightsKV cacheBefore headroom
Qwen3-Coder-30B-A3B, 4-bit, one 64K session30.5B × 0.55 ≈ 16.8 GB2 × 48 × 4 × 128 × 2 = 98,304 B/token × 65,536 ≈ 6.4 GB≈ 23 GB
Devstral Small 2, 4-bit, one 128K session24B × 0.55 ≈ 13.2 GB2 × 40 × 8 × 128 × 2 = 163,840 B/token × 131,072 ≈ 21.5 GB≈ 35 GB
Qwen3-Coder-Next, 4-bit, four 128K sessions80B × 0.55 ≈ 44 GB2 × 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

TierExample hardwareModels from the shortlist at 4-bit
16–32 GBOne 24–32 GB GPU; a Mac with 32 GB or moregpt-oss-20b, Devstral Small 2, Qwen3.8-27B, Qwen3-Coder-30B-A3B, Gemma 4 31B, with 32K–64K context
64–128 GBDGX Spark, Ryzen AI Max+ 395 systems, Mac Studio M5 Max with 128 GB, one 80–96 GB GPUQwen3-Coder-Next, gpt-oss-120b; Mistral Medium 3.5 fits with limited context room
256–512 GBMac Studio M5 Ultra, two to four linked DGX Sparks, a multi-GPU serverGLM-5.3-Flash, DeepSeek-V4-Flash
Rack8-GPU nodesKimi 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 --jinja flag.
  • vLLM and SGLang are the production-style options. Tool calls need --enable-auto-tool-choice plus the parser the model card names.
  • MLX-LM runs and quantizes models natively on Apple silicon.

Coding agents and editors

HarnessHow its docs reach a local modelWatch for
ContinueOllama guide in the official docsIts docs note that not every model claiming tool support works in agent mode
ClineOllama, LM StudioDocs suggest the compact prompt and 64 GB+ for larger models
AiderOllama (ollama_chat/<model>), LM Studio, any OpenAI-compatible APIContext sizing on Ollama
OpenCodeOllama, LM Studio, llama.cpp, custom OpenAI-compatible providersDocs stress strong tool-calling support
Claude CodeANTHROPIC_BASE_URL pointed at an Anthropic-format endpointAnthropic does not support routing it to non-Claude models
Qwen Code, Mistral VibeVendor CLIs named on the Qwen and Mistral model cardsTuned 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.


Choosing a local coding model for a regulated team? See how VDF Code runs on-premises or air-gapped, or book a demo.

Frequently asked questions

What is the best local LLM for coding in 2026?

It depends on the memory you have and the license your legal team accepts. On a single 24 to 32 GB GPU, Devstral Small 2, Qwen3.8-27B and Qwen3-Coder-30B-A3B are the strongest Apache 2.0 options at 4-bit. With 64 to 128 GB of unified memory or one 80 to 96 GB GPU, Qwen3-Coder-Next and gpt-oss-120b are the practical picks. GLM-5.3-Flash and DeepSeek-V4-Flash are MIT-licensed but need multi-GPU servers or a 256 GB machine.

How much VRAM do I need to run a coding model locally?

Add three terms. Weights take roughly the total parameter count times the bytes per parameter, about 0.55 bytes at 4-bit. The KV cache grows with every token of context and every concurrent session, and for dense models with many attention layers it can exceed the weights at 128K tokens. Then leave 10 to 20 percent for the runtime. A 30B mixture-of-experts coder at 4-bit with one 64K session lands near 26 GB.

Can Claude Code, Cline, Aider or OpenCode use a local model?

Yes, through a local endpoint. Cline, Aider and OpenCode document Ollama and LM Studio as providers, and OpenCode and Aider also accept any OpenAI-compatible server. Claude Code needs an Anthropic-format endpoint, which Ollama, LM Studio and llama.cpp's server now expose. Anthropic's own documentation says it does not support routing Claude Code to non-Claude models, so treat that combination as outside the vendor's support boundary.

Which local coding models are safe to use commercially?

Models under Apache 2.0 or MIT carry the fewest conditions: the Qwen3-Coder line, Qwen3.8-27B, Devstral Small 2, Gemma 4, gpt-oss, GLM-5.3-Flash and DeepSeek-V4-Flash. Mistral Medium 3.5 withdraws all rights from companies above 20 million dollars in monthly revenue. Kimi K3 adds conditions for hosted model services and very large products but exempts internal use. Codestral 22B is non-production only. Read the license file in the repository you download.

Is a local model good enough for agentic coding?

For many tasks, yes, provided the model was trained for tool use and the harness sends it enough context. Vendors now publish agentic results, for example Mistral reports 68.0 percent on SWE-bench Verified for the 24B Devstral Small 2. Those scores come from each vendor's own harness and settings, so they are not directly comparable. Build a small test set from your own repositories and run your top two candidates through the harness your developers will actually use.

Filed under
local LLMagentic codingopen-weight modelslocal coding modelsAI coding assistantson-premises AI
On-Prem AI

Plan your on-prem AI deployment

Book an architecture call and we will scope a private, on-prem AI deployment for your environment — integrations, hardware, and governance included.

Keep reading