The Best Local Open-Source LLM for Coding in 2026
You can now match GPT-4o-class coding performance on a single GPU, with no per-token bill and no code leaving your machine. Here are the five open models worth running.
- 01Qwen2.5-Coder-32B-Instruct matches GPT-4o coding performance and runs locally on a single 24GB GPU.
- 02Nearly 40% of AI interactions involve sensitive data, making local models crucial for IP protection.
- 03DeepSeek-Coder-V2-Lite uses a mixture-of-experts architecture to run efficiently on just 16GB of RAM.
- 04StarCoder2-15B is trained exclusively on transparently licensed data for compliance-sensitive teams.
- 05Local inference replaces recurring API token costs with a single, fixed hardware investment.

The best local open source LLM for coding right now is Qwen2.5-Coder-32B-Instruct. It's Apache 2.0 licensed, scores 92.7% on HumanEval, and performs comparably to GPT-4o on real-world code repair benchmarks.12 It's not the only serious option, though. Four other open models cover the rest of the hardware and licensing spectrum, from a 15B model built for compliance-sensitive teams to a mixture-of-experts model that runs on 16GB of RAM.
Why teams are moving coding work off the API
Every prompt you send to a hosted coding assistant is a line of your codebase leaving your network. Cyberhaven's 2026 AI Adoption & Risk Report found that 39.7% of all AI interactions already involve sensitive data, whether pasted text, uploaded files, or prompt content, and source code is one of the categories most commonly exposed to third-party AI tools.3 Employees send sensitive data to AI tools roughly once every three days.3 For engineering orgs with IP concerns or client contracts that forbid third-party data sharing, that's not a hypothetical risk. It's a running total.
Then there's the cost curve. GPT-4o's API runs $2.50 per million input tokens and $10.00 per million output tokens.4 Fine for a side project. It's a real budget line for a team running agentic coding workflows all day, and it never goes to zero no matter how much hardware you already own. A local model is a fixed cost instead: buy the GPU once, run it as much as you want. We've written about where that break-even actually lands in Local AI Models vs API Cost: The Real Break-Even Math, and it happens faster than most teams expect once usage is consistent.
How we picked these five
The list below was filtered against four criteria:
- Open weights with a usable license. Apache 2.0 or an equivalent permissive license, since a research-only license doesn't help you ship a product.
- Competitive benchmark scores. HumanEval, MBPP, Aider, and BigCodeBench results within striking distance of closed frontier models, not just "good for open source."
- Consumer hardware fit. 32B parameters or fewer (or an MoE with a small active parameter count) so the model runs on a single GPU, not a rack.
- Live tooling support. Works out of the box with Ollama, vLLM, or llama.cpp, so you're not hand-rolling an inference server.
1. Qwen2.5-Coder-32B-Instruct: the closest thing to a GPT-4o replacement
Alibaba's Qwen2.5-Coder-32B-Instruct is the flagship pick here. It scores 92.7% pass@1 on HumanEval and 90.2% on MBPP, in the same range as GPT-4o's roughly 90.2% on MBPP.12 On the Aider code-repair benchmark, a much harder test of whether a model can fix a bug in an existing file rather than write from scratch, it scored 73.7, again comparable to GPT-4o.2 It also posted state-of-the-art open-source results on EvalPlus, LiveCodeBench, and BigCodeBench.2
The practical part: it's Apache 2.0, so there's no commercial-use asterisk.2 On an M2 Max MacBook Pro with 64GB unified memory, it runs at 12-15 tokens per second in Q4_K_M quantization, fast enough to feel interactive.1 With a proper GPU, it also serves at full BF16 precision on a single A100-80GB through vLLM, though most readers will run the quantized version on a 24GB consumer card.1 For a broader look at what fits where, see What Hardware Do You Actually Need to Run LLMs Locally?
2. DeepSeek-Coder-V2: MoE efficiency for modest hardware
DeepSeek-Coder-V2 takes a different architectural approach. It's a Mixture-of-Experts model with 236 billion total parameters but only 21 billion active at inference time, and its makers say it achieves performance comparable to GPT4-Turbo on code-specific tasks.5 It expanded language support from 86 to 338 programming languages and extended context length from 16K to 128K tokens.5 It was further pretrained on 6 trillion tokens from a high-quality, multi-source corpus to sharpen both coding and math reasoning.6
The Lite variant is the one worth knowing about if your hardware budget is tight: it's small enough to run on 16GB of RAM, the practical choice for anyone without a dedicated 24GB GPU sitting around.
3. Codestral 22B: the fastest fill-in-the-middle completion model
Codestral is Mistral's dedicated code model, built for completion and fill-in-the-middle tasks rather than general chat. It supports over 80 programming languages and scores 81.1% on HumanEval Python, beating CodeLlama 70B's 67.1% despite being roughly a third the size.7
The catch: Codestral ships under Mistral's non-production license, which permits research and testing but restricts commercial deployment.7 Great model to prototype with in your IDE for personal use. Not the one to build a customer-facing product on unless you've squared the licensing with Mistral directly.
4. StarCoder2-15B: fully open training data for compliance-sensitive teams
StarCoder2 comes out of a collaboration between BigCode, Hugging Face, NVIDIA, and ServiceNow, and its defining feature isn't raw benchmark score. It's data provenance. The model is trained on the transparently licensed "Stack v2" dataset, filtered specifically for permissive licenses and code with no license at all.8 For legal teams worried about IP contamination from scraped, unlicensed training data, that transparency is the whole selling point.
It's not a compromise pick on capability either. The 15B model outperforms CodeLlama-34B, more than twice its size, and also beats DeepSeek-Coder-33B on several benchmarks.9 It's licensed under BigCode OpenRAIL-M and runs comfortably on around 11GB of VRAM, one of the lightest models on this list to host.
5. DeepSeek Coder 33B: the original open-source coder that started the wave
Before DeepSeek-Coder-V2, there was the original DeepSeek Coder series. It's the model that proved open-weight coding models could compete at all. It was pretrained on 2 trillion tokens (87% code, 13% natural language) across more than 80 languages, and ships in sizes from 1.3B up to 33B parameters, so there's a variant for almost any hardware tier. The 33B instruction-tuned version outperforms GPT-3.5-turbo on HumanEval. Need the smallest possible footprint? The 1.3B or 6.7B variants still give you a usable coding assistant on a laptop.
What hardware do you actually need to run these locally?
The practical ceiling for a single consumer GPU is around 30-32B parameters when quantized.10 Some concrete numbers to plan around:
- 24GB cards (RTX 3090, RTX 4090). Comfortably fit a 32B model at Q4 quantization, where Qwen2.5-Coder-32B and DeepSeek Coder 33B land.11
- 16GB cards. An IQ3_XS quant of a 32B model comes in at roughly 14GB, though you'll trade context window for that headroom.11
- 11GB and under. StarCoder2-15B and DeepSeek-Coder-V2-Lite are built for this tier.
- Apple Silicon with 48-64GB unified memory. Runs the 32B-class models at usable speeds without a discrete GPU at all.1
Ollama is the fastest on-ramp for any of these, and pairing it with a terminal agent like OpenCode gets you file access, shell execution, and code editing with zero API key and zero per-token billing.12 Our guide on running frontier models on 12GB of VRAM walks through the quantization tradeoffs in more depth, and the broader infrastructure landscape, including Ollama, llama.cpp, and vLLM, is covered in The Best Local Open-Source AI and Infrastructure Tools in 2026.
What do you give up by going local?
On single-file completion, bug fixes, and day-to-day coding assistant tasks, the benchmark gap to closed frontier models has mostly closed. On long-horizon agentic work, multi-step tool calling across a large codebase, and tasks that resemble SWE-bench more than HumanEval, local models still trail the best closed models more noticeably. If your workflow leans heavily on autonomous multi-agent pipelines rather than interactive coding, read Stop Searching for the 'Best' AI Model: How to Build a Multi-Agent Ecosystem before betting the whole stack on one local model.
The gap isn't nothing, but it's not the gap it was in 2023, when open coding models were a novelty rather than a real substitute. For most teams, that gap is now a rounding error against the cost and exposure of routing all your code through a third-party API.
Which local coding model should you pick?
Don't chase the highest benchmark number in isolation. Match the model to the constraint that actually matters for your team:
- Want the closest match to GPT-4o with no restrictions? Qwen2.5-Coder-32B-Instruct, if you have a 24GB GPU or a 64GB Mac.
- Limited to 16GB of RAM or less? DeepSeek-Coder-V2-Lite.
- Need fast IDE-style autocomplete and can live with a non-commercial license? Codestral 22B.
- Legal or compliance team asking about training data provenance? StarCoder2-15B.
- Want the smallest possible footprint across a range of hardware? DeepSeek Coder, from 1.3B up to 33B.
| License | Hardware fit | Benchmark strength | Commercial use OK | |
|---|---|---|---|---|
| RecommendedQwen2.5-Coder-32B-Instructa no-restrictions GPT-4o-class replacement | Apache 2.0 | 24GB GPU or 64GB Mac | High | Yes |
| DeepSeek-Coder-V2-Litemodest hardware (16GB RAM) | Open (MoE) | 16GB RAM | Medium | Yes |
| Codestral 22Bfast IDE-style autocomplete | Mistral Non-Production | Single consumer GPU | Medium | No |
| StarCoder2-15Bcompliance-sensitive teams needing clean training data | BigCode OpenRAIL-M | ~11GB VRAM | Medium | Yes |
This is also the kind of decision that pairs well with a platform that helps you route and manage which model handles which job rather than hard-coding one choice everywhere, something a tool like Remy is built to help internal teams sort out as they move workloads off rented APIs and onto owned infrastructure. Whichever model you pick, the underlying shift is the same one covered in How to Self-Host Your Company's AI Stack: the hardware cost is fixed, the token bill isn't, and the code stays on your machine.
Qwen2.5-Coder-32B-Instruct is generally the top pick. It scores 92.7% on HumanEval and 73.7 on the Aider code-repair benchmark, both comparable to GPT-4o, and it's Apache 2.0 licensed for unrestricted commercial use.
On standard benchmarks like HumanEval and MBPP, yes, Qwen2.5-Coder-32B-Instruct lands within a point or two of GPT-4o. On very long agentic tasks that require many tool calls in sequence, closed frontier models still tend to hold an edge.
A 32B model quantized to Q4_K_M typically needs about 24GB of VRAM, which fits on an RTX 3090 or RTX 4090. A more aggressive IQ3_XS quantization can shrink that to roughly 14GB at the cost of context window and some accuracy.
No. Codestral ships under Mistral's non-production license, which allows research and testing but restricts commercial deployment. For unrestricted commercial use, Qwen2.5-Coder or StarCoder2 are better fits.
StarCoder2-15B is the strongest choice here. It's trained on the transparently licensed Stack v2 dataset, filtered for permissive licenses, which matters for teams worried about IP contamination from scraped training data.
- 1Qwen2.5-Coder 32B: The Open-Source Coding Model That Rivals GPT-4oPristren
- 2Qwen2.5-Coder Series: Powerful, Diverse, Practical.Qwen Team (Alibaba)
- 3Sensitive Enterprise Data Is Flowing Into AI Tools at ScaleCyberhaven
- 4GPT-4o Pricing Per Million Tokens: Complete Cost Guide & Optimization Tips (2026)AI Free API
- 5DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code IntelligenceGitHub / DeepSeek-AI
- 6DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence (discussion)Reddit r/LocalLLaMA
- 7Codestral | Mistral AIMistral AI
- 8bigcode/starcoder2-15bHugging Face / BigCode
- 9FineTuning StarCoder2 on Google Colab T4 GPUMedium (Codex)
- 10GPU Requirements Cheat Sheet 2026: VRAM + Cost, 18 ModelsSpheron Network
- 11Cheapest hardware to run 32B modelsReddit r/LocalLLaMA
- 12Local AI coding agent setup with OpenCode and OllamaStridenote



