Best Local LLM for Coding (2026): 8 Models by GPU Memory
The best local LLM for coding depends on how much GPU memory you have. On a 24 GB card, start with Devstral Small 2 (24B) for agentic coding; with 32 GB, Qwen3.8-27B is the strongest dense model you can run comfortably. Below that, use gpt-oss-20b on 16 GB, Mellum2.1 on 12 GB and Qwen3.5-9B on 8 GB. With 48 to 64 GB, Qwen3-Coder-Next is built for coding agents, and an 80 GB GPU or a 96 to 128 GB Mac can hold gpt-oss-120b.
Most "best local coding model" lists you'll find were written for models that are now a year or more old, or they sort by hype rather than by the one number that decides what you can run: memory. This guide does the opposite. Every pick below is grouped by the VRAM (or Mac unified memory) it needs, with the actual size of the quantized file you'd download and the coding results each lab reports for its own model.
We did not run our own benchmarks. Model facts and scores come from each model's official card on Hugging Face; file sizes are the exact GGUF downloads listed on Hugging Face and the Ollama library, checked December 4, 2026. Vendor scores use different benchmarks and harnesses, so treat them as evidence about each model, not as a cross-model ranking.
- The 8 models at a glance
- How much memory a local coding model really needs
- 8 GB: Qwen3.5-9B
- 12 GB: Mellum2.1 Instruct
- 16 GB: gpt-oss-20b
- 24 GB: Devstral Small 2
- 32 GB: Qwen3.8-27B and Qwen3-Coder-30B-A3B
- 48 to 64 GB: Qwen3-Coder-Next
- 80 GB and up: gpt-oss-120b
- New, too big, or worth watching
- How to run them in a coding workflow
- FAQ
The 8 Best Local Coding Models at a Glance
File sizes are 4-bit downloads (Q4_K_M unless noted) from the linked GGUF repos, checked December 4, 2026. Add memory for context on top.
| GPU memory | Model | Size and type | 4-bit file | Best for | License |
|---|---|---|---|---|---|
| 8 GB | Qwen3.5-9B | 9B dense | 5.7 GB | Chat-style coding help on small cards | Apache 2.0 |
| 12 GB | Mellum2.1 Instruct | 12B MoE, 2.5B active | 8.1 GB (7.0 GB MXFP4) | Fast fixes, tool loops, sub-agents | Apache 2.0 |
| 16 GB | gpt-oss-20b | 21B MoE, 3.6B active | 12.1 GB (MXFP4) | Reasoning through bugs and design | Apache 2.0 |
| 24 GB | Devstral Small 2 | 24B dense | 14.3 GB | Agentic coding across a repo | Apache 2.0 |
| 32 GB | Qwen3.8-27B | 27B dense | 16.6 GB | Best quality under 32 GB | Apache 2.0 |
| 24 to 32 GB | Qwen3-Coder-30B-A3B | 30.5B MoE, 3.3B active | 18.6 GB | Speed on long files, no thinking delay | Apache 2.0 |
| 48 to 64 GB | Qwen3-Coder-Next | 80B MoE, 3B active | 48.5 GB | Local coding agents on big workstations | Apache 2.0 |
| 80 GB+ | gpt-oss-120b | 117B MoE, 5.1B active | 63.4 GB (MXFP4) | Heaviest reasoning you can run at home | Apache 2.0 |
How Much Memory a Local Coding Model Really Needs
Two things have to fit in GPU memory: the model weights and the context cache (the running memory of your conversation, files and tool output). The weights are the big, predictable part. The cache grows with every file you paste in, and coding is the use case that eats context fastest.
Quantization is how a 24B model fits on a consumer card. Full precision stores each weight in 16 bits; 8-bit roughly halves that, and 4-bit roughly halves it again. You can see it in Devstral Small 2's downloads: the Q8_0 file is 25.1 GB and the Q4_K_M file is 14.3 GB (GGUF repo). Q4_K_M is the usual sweet spot for local coding. Lower than 4-bit (Q3, Q2) fits bigger models on smaller cards, but you trade away accuracy, and code is less forgiving of small mistakes than prose.
A practical rule: pick a 4-bit file that leaves at least 2 to 4 GB of headroom on your card for a working context, and more if you plan to load whole repositories. If the model spills into system RAM, it still runs, just much slower.
- Mixture-of-experts (MoE) models such as gpt-oss and Qwen3-Coder need memory for all their parameters, but only a few billion are active per token. They feel fast for their size.
- Dense models such as Devstral Small 2 and Qwen3.8-27B use every parameter for every token. They're slower per token at the same file size, and often stronger at the same memory budget.
- Newer architectures need less cache. Qwen3.8-27B uses linear-attention (Gated DeltaNet) blocks in three of every four layers, per its model card, which is part of why recent Qwen models handle long contexts more cheaply than older designs.
- Macs count unified memory, not VRAM. The operating system needs its share, so a 32 GB Mac doesn't give a model all 32 GB.
8 GB VRAM: Qwen3.5-9B
Why it's here: Qwen3.5-9B is a 9B Apache 2.0 model with a 262,144-token native context (model card). It isn't a coding-only model, but it's the strongest small option we found with published coding numbers: in the comparison table JetBrains published for its own Mellum2.1, Qwen3.5-9B scores 49.8% on SWE-bench Verified without thinking and 55.6% with it (JetBrains model card).
Memory: the Q4_K_M file is 5.7 GB (GGUF), and Ollama's qwen3.5:9b tag is a 6.6 GB download (Ollama). That leaves a little room for context on an 8 GB card. Keep prompts focused on one file or function at a time.
Good for: explaining code, writing functions and tests, quick refactors. Don't expect it to run a long multi-file agent session on 8 GB; the context won't fit.
12 GB VRAM: Mellum2.1 Instruct
Why it's here: JetBrains released Mellum2.1 Instruct in November 2026 as a coding model for "fast agentic work, such as sub-agents, tool loops, small fixes, and questions about code" (model card). It's a 12B mixture-of-experts model with only 2.5B active parameters and a 131,072-token context, trained with reinforcement learning inside real repositories where it was rewarded when tests passed.
JetBrains reports 40.4% on SWE-bench Verified (up from 20.2% for Mellum2), 89.1% on HumanEval+ and 53.7% on LiveCodeBench v6. Note that its own table shows Qwen3.5-9B ahead on SWE-bench Verified, so Mellum2.1's selling point is speed and directness: it answers without a chain of thought, and JetBrains says it generates about half as many tokens as its Thinking sibling.
Memory: JetBrains publishes official GGUFs: 7.0 GB in MXFP4, 8.1 GB at Q4_K_M and 10.9 GB at Q6_K (GGUF repo). A 12 GB card runs the Q4 file with room for context. It wasn't in the Ollama library when we checked, so use LM Studio or llama.cpp with the GGUF.
16 GB VRAM: gpt-oss-20b
Why it's here: OpenAI's smaller open-weight model is a 21B mixture-of-experts with 3.6B active parameters, Apache 2.0, and OpenAI says it runs "within 16GB of memory" thanks to MXFP4 quantization of its expert weights (model card). It has adjustable reasoning effort (low, medium, high), which matters for coding: turn it up when you're chasing a bug, down for boilerplate.
Memory: the MXFP4 GGUF is 12.1 GB (ggml-org GGUF) and Ollama's gpt-oss:20b is a 14 GB download (Ollama). Z.ai's card for GLM-4.7-Flash lists gpt-oss-20b at 34.0% on SWE-bench Verified (GLM-4.7-Flash card), so it's a reasoning partner more than an autonomous agent.
Watch out for: the model was trained on OpenAI's harmony response format and the card says it "will not work correctly" without it. Ollama and LM Studio handle this for you; custom scripts need the chat template.
24 GB VRAM: Devstral Small 2
Why it's here: Devstral Small 2 is Mistral's coding agent model: 24B dense parameters, a 256k context window, Apache 2.0, and designed to "explore codebases, edit multiple files and power software engineering agents" (model card). Mistral says it's "light enough to run on a single RTX 4090 or a Mac with 32GB RAM."
Mistral reports 68.0% on SWE-bench Verified, 55.7% on SWE-bench Multilingual and 22.5% on Terminal Bench 2. It was released in December 2025, so it's no longer the newest model on this list, but it remains one of the few mid-size models built specifically for the agent loop of reading files, running tools and editing code.
Memory: Q4_K_M is 14.3 GB and Q6_K is 19.3 GB (GGUF repo); Ollama's devstral-small-2 is 15 GB (Ollama). On a 24 GB card the Q4 file leaves useful room for repository context. Mistral pairs it with its own terminal agent, Mistral Vibe, and it also works with agent tools such as Cline and OpenHands.
32 GB VRAM: Qwen3.8-27B (and Qwen3-Coder-30B-A3B for Speed)
Qwen3.8-27B: the strongest model under 32 GB
Why it's here: Qwen3.8-27B, released in August 2026, is the dense model in Qwen's current generation. The card describes "substantial gains across coding, professional work, research, and long-horizon agentic tasks" (model card). It has a 262,144-token native context, adjustable thinking, and native image input, so you can hand it a screenshot of a broken UI.
Qwen's own table puts it at 61.7 on SWE-bench Pro (run in the Claude Code harness) and 73.0 on Terminal Bench 2.1 (with the Terminus agent), up from 53.5 and 63.4 for Qwen3.6-27B. Those are vendor numbers on harder benchmarks than the SWE-bench Verified scores quoted elsewhere in this guide, so don't compare them directly.
Memory: the 4-bit file is 16.6 GB, Q6_K is 22.0 GB and Q8_0 is 29.0 GB (GGUF repo); Ollama's qwen3.8:27b is 18 GB (Ollama). It loads on a 24 GB card with short context. A 32 GB card such as an RTX 5090 lets you run Q5 or Q6 with real working room, which is why we place it here.
Qwen3-Coder-30B-A3B: the fast alternative
Qwen3-Coder-30B-A3B is a 30.5B mixture-of-experts coder with 3.3B active parameters and a 262,144-token native context (model card). It's a non-thinking model, so it starts writing code immediately, and its small active size makes it noticeably quicker than a dense 27B on the same hardware. It's older (July 2025), but with 1.9 million downloads on Hugging Face as we checked, it's one of the best-supported local coders in tools like Qwen Code and Cline.
Memory: Q4_K_M is 18.6 GB and Q6_K is 25.1 GB (GGUF repo); Ollama's qwen3-coder:30b is 19 GB (Ollama).
Also in this tier: GLM-4.7-Flash, an MIT-licensed 30B-A3B model from Z.ai. Its card reports 59.2% on SWE-bench Verified (model card), and the Q4_K_M file is 18.3 GB (GGUF repo). It's a good choice if your company prefers MIT licensing.
48 to 64 GB: Qwen3-Coder-Next
Why it's here: Qwen describes Qwen3-Coder-Next as "designed specifically for coding agents and local development" (model card). It has 80B parameters with only 3B active, a 256k context, and the card says it works with scaffolds including Claude Code, Qwen Code, Kilo, Trae and Cline. It's a non-thinking model trained for long-horizon tasks and "recovery from execution failures," which is exactly what goes wrong most often in agent sessions.
Memory: the 4-bit files are 48 to 49.6 GB, Q3 builds are about 36 to 38 GB and Q8_0 is 84.8 GB (GGUF repo); Ollama lists 52 GB for q4_K_M (Ollama). That means two 24 GB or 32 GB GPUs, a 48 GB workstation card at Q3, or a Mac with 64 GB or more. If it runs out of memory, Qwen's card suggests a shorter context such as 32,768 tokens.
80 GB and Up: gpt-oss-120b
Why it's here: OpenAI's larger open-weight model has 117B parameters with 5.1B active and is built to fit "a single 80GB GPU (like NVIDIA H100 or AMD MI300X)" (model card). For local use, that means a data-center card, a multi-GPU rig, or a Mac with 96 to 128 GB of unified memory. Like its smaller sibling, it has adjustable reasoning effort and an Apache 2.0 license.
Memory: the MXFP4 GGUF is 63.4 GB (ggml-org GGUF) and Ollama's gpt-oss:120b is 65 GB (Ollama).
If you have 128 GB or more, Qwen3.8-Flash-Next is worth a look too. It's a 180B-parameter model (per Hugging Face's parameter count) whose 4-bit file is 111.3 GB (GGUF repo).
New, Too Big, or Worth Watching
- Qwen4-35B-A3B (released December 3, 2026). The first open model in Qwen4 has 35B parameters with 3B active, plus a 20B n-gram embedding and a 1,048,576-token native context (model card). Despite the "35B" name, the 4-bit file is 35.2 GB (GGUF repo) and Ollama's tag is 36 GB, so treat it as a 48 GB-tier model. It's a day old as we publish, its scores so far come only from Qwen's own chart, and quantized builds are brand new, so we'd give the community a few weeks of real-world reports before switching.
- DeepSeek V4.1 Flash, GLM-5.3 and Qwen3-Coder 480B. All are open-weight and capable, but Hugging Face lists DeepSeek V4.1 Flash at about 763B parameters (model page) and GLM-5.3 at about 753B (model page) and Ollama's
qwen3-coder:480bis a 290 GB download. These are server models, not desk models. - Qwen2.5-Coder. It still shows up in many older guides and has huge download counts, but it's a 2024 model. Every tier above has a newer option.
How to Run Them in a Coding Workflow
For most people, the easiest path is Ollama or LM Studio. Both download the quantized file and expose a local API that's compatible with OpenAI's, which most coding tools can point at. If you want finer control over quantization and context, llama.cpp is what both build on.
- Pick the model by memory first, using the table above, then pick the largest quantization that still leaves context room.
- Choose a front end. Chat-style help works in the Ollama or LM Studio app. For an agent that edits files and runs commands, use Qwen Code, Cline, OpenHands or Mistral Vibe pointed at your local endpoint.
- Set the context deliberately. Local tools often default to short contexts. Raise it for repository work, and lower it again if you run out of memory.
- Keep a cloud model for the hard 10%. Many developers run a local model for private, routine work and switch to a frontier model for big refactors. Our comparison of Codex vs Claude Code covers the cloud side.
Most of these agent tools also speak MCP, so you can connect the same external tools and context to a local model that you'd give a cloud assistant. If MCP is new to you, start with what MCP is and how it differs from a regular API.
One limit no local model fixes: it knows code in general, not how your team writes it. Your naming rules, review checklist and the mistakes your seniors always catch sit in a different layer, which we call the Judgment Layer. That layer travels better as a shared tool than as a long system prompt you paste into every session.
What is the best local LLM for coding right now?
For a 24 GB GPU, Devstral Small 2 is the best agentic coding model, and with 32 GB Qwen3.8-27B is the strongest dense option. On smaller cards use gpt-oss-20b (16 GB), Mellum2.1 (12 GB) or Qwen3.5-9B (8 GB). With 48 GB or more, Qwen3-Coder-Next is built for coding agents.
Can I run a coding LLM on 8 GB of VRAM?
Yes. Qwen3.5-9B at Q4_K_M is a 5.7 GB file, which leaves some room for context on an 8 GB card. Keep tasks to one file or function at a time, because long multi-file sessions need more memory for context.
Which local coding model fits on an RTX 4090?
Devstral Small 2 is designed for it: Mistral says it runs on a single RTX 4090 or a 32 GB Mac. Its Q4_K_M file is 14.3 GB. Qwen3-Coder-30B-A3B (18.6 GB at Q4) and Qwen3.8-27B (16.6 GB at 4-bit) also load on 24 GB with shorter context.
Is a local LLM as good as Claude or GPT for coding?
Not at the frontier. Local models handle everyday coding, tests and refactors well, and they keep code on your machine. For large, multi-step changes across a big codebase, hosted frontier models are still stronger, so many developers use both.
How much VRAM do I need for a 30B coding model?
About 18 to 19 GB for the 4-bit file of Qwen3-Coder-30B-A3B or GLM-4.7-Flash, plus a few GB for context. A 24 GB card works; 32 GB gives you room for longer context or higher-quality quantization.
What quantization should I use for coding?
Q4_K_M is the usual balance of size and accuracy. Use Q5 or Q6 if you have spare memory, since code is sensitive to small errors. Go below 4-bit only when it's the only way a much larger model fits.
Can I run these models on a Mac?
Yes. Apple Silicon Macs use unified memory, so a 32 GB Mac can run Devstral Small 2, and Macs with 64 GB or more can run Qwen3-Coder-Next. Leave room for macOS itself; the model can't use every gigabyte.
Are local coding models free for commercial use?
All eight models in this guide are released under Apache 2.0, and GLM-4.7-Flash uses MIT. Always read the license on the model card before shipping, because terms can differ between model versions.