best local open source LLM for codinglocal coding modelsQwen2.5-Coder

The Best Local Open-Source LLM for Coding in 2026

Five Apache-licensed local coding models that match GPT-4o on benchmarks, run on one GPU, and cost nothing per token. A practical buyer's guide.

Portrait of Luis Chavez-Mattos
Edited by Luis Chavez-Mattos, Director, Product··RSS
A single GPU module feeding five interchangeable model tiles through a highlighted output channel toward an empty result frame, representing local open-source LLMs run for coding on one graphics card.

What is the best local open-source LLM for coding in 2026?

The best local open source LLM for coding right now is Qwen2.5-Coder-32B-Instruct. It's Apache 2.0 licensed and scores 92.7% on HumanEval. 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.

TL;DR

  • Qwen2.5-Coder-32B-Instruct matches GPT-4o-class coding performance and runs locally on a 24GB consumer GPU in quantized form.
  • About 39.7% of AI interactions involve sensitive data, so keeping code on your own machine with a local model protects your IP.
  • DeepSeek-Coder-V2 is a mixture-of-experts model, and its Lite variant is small enough to run on 16GB of RAM.
  • StarCoder2-15B is trained on transparently licensed data, which makes it the pick for compliance-sensitive teams.
  • Codestral 22B ships under a non-production license, so it suits prototyping rather than customer-facing products.
  • Local inference replaces recurring API token costs with a single, fixed hardware investment.

Why are teams 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. Employees send sensitive data to AI tools roughly once every three days. 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.

Figure 1
Sensitive Data Exposure to AI Tools
39.7%
AI interactions involving sensitive data
Includes pasted text, uploaded files, and prompt content; source code is among the most commonly exposed categories.
Illustrative figure. Constructed for explanation, not a measured source.

Then there's the cost curve. GPT-4o's API runs $2.50 per million input tokens and $10.00 per million output tokens. 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.

Figure 2
GPT-4o API Pricing
$2.5/M
Input tokens
$10/M
Output tokens
Illustrative figure. Constructed for explanation, not a measured source.

How did we pick 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.

Is 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, compared with GPT-4o's roughly 90.2% on the same split. 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. On LiveCodeBench, which uses real competitive problems that are not data-contaminated, it outperforms CodeLlama 70B by a wide margin.

Figure 3
HumanEval Pass@1 Scores
Qwen2.5-Coder-32B-Instruct92.7%Codestral 22B81.1%CodeLlama 70B67.1%
Illustrative figure. Constructed for explanation, not a measured source.

The practical part: it's Apache 2.0, so there's no commercial-use asterisk. 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. On an A100-80GB, you can also serve the full BF16 weights at full speed through vLLM. For a broader look at what fits where, see What Hardware Do You Actually Need to Run LLMs Locally?

Can DeepSeek-Coder-V2 deliver MoE efficiency on 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. It expanded language support from 86 to 338 programming languages and extended context length from 16K to 128K tokens. It was further pretrained on 6 trillion tokens from a high-quality, multi-source corpus to sharpen both coding and math reasoning.

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.

Is 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. According to Mistral, it is trained on a diverse dataset of 80+ programming languages.

The catch: Codestral ships under Mistral's non-production license, which permits research and testing but restricts commercial deployment. 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.

Does StarCoder2-15B's fully open training data suit 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. 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.

Is 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. 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.
  • 16GB cards. An IQ3_XS quant of a 32B model comes in at roughly 14GB, though you'll trade context window for that headroom.
  • 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.
Figure 4
VRAM Needed to Run Each Model Locally
32B model (Q4 quant, e.g. Qwen2.5-Coder-32B)24DeepSeek-Coder-V2-Lite1632B model (IQ3_XS quant)14StarCoder2-15B11
Illustrative figure. Constructed for explanation, not a measured source.

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. 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.
Figure 5
Local Coding Model Comparison
Local Coding Model Comparison
LicenseHardware fitBenchmark strengthCommercial use OK
RecommendedQwen2.5-Coder-32B-Instructa no-restrictions GPT-4o-class replacementApache 2.024GB GPU or 64GB MacHighYes
DeepSeek-Coder-V2-Litemodest hardware (16GB RAM)Open (MoE)16GB RAMMediumYes
Codestral 22Bfast IDE-style autocompleteMistral Non-ProductionSingle consumer GPUMediumNo
StarCoder2-15Bcompliance-sensitive teams needing clean training dataBigCode OpenRAIL-M~11GB VRAMMediumYes
Ratings are relative across these options, not absolute.
Illustrative figure. Constructed for explanation, not a measured source.

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.

Frequently Asked Questions

5 questions

What is the best local open source LLM for coding in 2026?

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.

Can a local coding model really match GPT-4o?

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.

How much GPU memory do I need to run a 32B coding model?

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.

Is Codestral free to use commercially?

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.

Which local coding model is best for compliance-sensitive teams?

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.

How we source, write, and correct our articles. Editorial standards

Related articles

Straight to your inbox.
New pieces as they publish. No noise.