Best Local LLMs for Coding (2026)
The best local LLM for coding depends on how much memory your machine has. This list ranks open-weight models you can run yourself, by independent benchmark runs and by developers who use them in coding agents.
What we track: Memory needed · Size · Context window
- Memory needed:
- How much RAM or VRAM the model used when someone ran it, with the quantization and machine named.
- Size:
- Parameter count. For mixture-of-experts models, the active count sets the speed.
- Context window:
- The most tokens it can read at once. Long contexts need much more memory.
These numbers inform the order but don’t set it: an editor ranks the picks, weighing them against what people who use them say, since stars and downloads also reflect hype and marketing.
The model most local-coding write-ups now start from. Piotr Migdał at Quesma found the 17 GB 4-bit file matched the full 55 GB model on Terminal-Bench 2.1, and Simon Willison drove the Pi coding agent with it on a 128 GB M5 Max MacBook Pro and an NVIDIA DGX Spark. The catch is speed: Willison saw 15 to 30 tokens a second, and it thinks at its highest effort by default, so turn reasoning down first.
- Memory needed 17 GB at Q4_K_M; fits a 24 GB RTX 4090 with about 64k tokens of context
- Size 27B parameters, dense
- Context window 262,144 tokens
For a 128 GB machine. It posted the best result in WonderRico's benchmark, 97 of 100 SWE-bench Verified tasks, on a single 96 GB RTX PRO 6000. Deepu K Sasidharan writes most of his Rust code with it on a 128 GB ASUS ROG Flow Z13 at about 46 tokens a second, though one feature took 130 minutes against 18 for Claude Opus. It is labelled an experimental preview, and its license is not Apache.
- Memory needed About 100 GB at UD-Q4_K_S with 180K context on a 128 GB M5 Max
- Size 125B, 6B active, plus a 51B n-gram embedding table
- Context window 262,144 tokens
Georgi Gerganov, who wrote llama.cpp, said he used this almost daily for maintainer chores, at 100 to 150 tokens a second on an RTX 5090 and about 40 on an M2 Ultra. It is the older sibling of Qwen3.8-27B, with the same size and memory needs. On a Mac Studio M3 Ultra, TerminalBytes measured it at twice the newer model's speed in Ollama, which is the reason to still pick it.
- Memory needed Q4 on a 32 GB RTX 5090, Q8 on an M2 Ultra (Georgi Gerganov's setup)
- Size 27B parameters, dense
- Context window 262,144 tokens
Google's largest open model is the one to try if you would rather not run a Qwen. In WonderRico's benchmark it scored 67 to 73 of 100 and needed fewer requests per solved task than most local models. Incept5's test on an Apple Silicon Mac had it ahead of Qwen3.5-27B, 59.4% to 42.2%. Its tool calling was broken at launch and fixed later, so use current files and a current runtime.
- Memory needed 19 to 20 GB download as gemma4:31b in Ollama
- Size 30.7B parameters, dense
- Context window 256K tokens
- Maker
- Google DeepMind
- License
- Apache 2.0
- Runs in
- Ollama (gemma4:31b), LM Studio, llama.cpp, vLLM
The fast one. It computes with only 3B of its 35B parameters per token, so it answers quickly on Macs and older cards. Red Hat's Coding Agent Bench ran it through all 500 SWE-bench Verified tasks: 65% with the Pi agent and 54.8% with OpenCode, same weights. WonderRico scored it 60 of 100, below the dense 27B models, and found this kind of model loses more when compressed.
- Memory needed 20.9 GB UD-Q4_K_S file ran on Simon Willison's MacBook Pro M5
- Size 35B total, 3B active (mixture of experts)
- Context window 262,144 tokens
Meta built this one for agents and tool use, not for code alone. WonderRico scored it 73 to 76 of 100, level with Qwen3.6-27B, but it needed about twice as many requests to get there. In rickyzzzzz's test on an M1 Max with 64 GB it passed 24 of 30 agent tasks where Qwen3.8-27B passed all 30. Hacker News user pram uses it as the agent that explores a codebase and leaves the coding to Qwen.
- Memory needed Meta's K-Quant-17GB build targets 24 GB of VRAM
- Size About 29.6B parameters, dense
- Context window 131,072 tokens
The pick for a 16 GB graphics card, because it fits whole. Abhinav Raj at XDA used it for a week on a 16 GB RTX 4070 Ti Super and it found and explained all three planted bugs, where Qwen3-Coder 30B and Devstral Small 2 did not. Rost Glukhov measured 139.93 tokens a second on an RTX 4080. It dates from August 2025 and takes text only, and some developers now consider it outclassed by newer Qwen models.
- Memory needed 14 GB loaded, all on the GPU, on a 16 GB RTX 4080 in Ollama
- Size 21B total, 3.6B active (mixture of experts)
- Context window 128K tokens
- Maker
- OpenAI
- License
- Apache 2.0
- Runs in
- Ollama (gpt-oss:20b, 14 GB), LM Studio, llama.cpp, vLLM
Speed is the reason to choose it. George Liu got 51 tokens a second on a 14-inch MacBook Pro M4 Pro with 48 GB and wired it into Claude Code, where he says it slowed down noticeably. For agent work the results are weaker: WonderRico scored it 54 of 100 and called it fast but quite poor. Developers on Hacker News rate it higher for writing, SQL and PHP than for long coding sessions.
- Memory needed 17.99 GB Q4_K_M ran on a 14-inch MacBook Pro M4 Pro with 48 GB
- Size 25.2B total, about 4B active (mixture of experts)
- Context window 256K tokens
- Maker
- Google DeepMind
- License
- Apache 2.0
- Runs in
- Ollama (gemma4:26b), LM Studio, llama.cpp
Only for big machines. WonderRico ran compressed builds across three GPUs with 192 GB of VRAM and got 90 to 92 of 100, second only to Qwen3.8-Flash-Next. Hemant Kumar at TerminalBytes puts the need at roughly 100 to 170 GB of memory, so a 256 GB Mac Studio holds it. The smallest file WonderRico tested, at 2 bits, is 96.8 GB. It takes text only, and a newer V4.1 Flash is larger.
- Memory needed 96.8 GB at UD-Q2_K_XL, 155.1 GB at UD-Q4_K_XL (Unsloth GGUF files)
- Size 284B total, 13B active (mixture of experts)
- Context window 1M tokens
- Maker
- DeepSeek
- License
- MIT
- Runs in
- llama.cpp (GGUF), vLLM
What to run when you have 8 GB. Rost Glukhov measured 90.89 tokens a second with all of it on a 16 GB RTX 4080, and Hacker News users name it for small tasks and as a helper model inside the Pi agent. Keep the jobs short. One user who tried it for coding gave up after it kept getting stuck rethinking the same step, and no independent test here shows it finishing long agent sessions.
- Memory needed 9.3 GB loaded, all on the GPU, on a 16 GB RTX 4080 in Ollama
- Size 9B parameters, dense
- Context window 262,144 tokens
A small model that reads images and audio as well as code, in a 7 GB file from Google. Hacker News user dofm, who runs it on an M1 Max, calls it quite good at coding jobs but weaker on nuance and not suited to long agent sessions. Another user found Gemma 4 models looping until he went back to the chat template Google first shipped. Use it for snippets, reviews and screenshots.
- Memory needed 7.0 GB for Google's own QAT 4-bit GGUF file
- Size 11.95B parameters, dense
- Context window 256K tokens
An MIT-licensed alternative in the 24 GB class. Hacker News user kamranjon ran it as a main model for months and calls it tenacious and very fast. It does not fit a 16 GB card: Rost Glukhov saw it load at 21 GB on an RTX 4080 with 27% spilling to the CPU, at 33.86 tokens a second. Another user who has run it locally says it was far behind the best models even at launch.
- Memory needed 21 GB loaded on a 16 GB RTX 4080, 27% on the CPU, in Ollama
- Size 30B total, 3B active (mixture of experts)
- Context window 198K tokens in Ollama
- Maker
- Z.ai
- License
- MIT
- Runs in
- Ollama (glm-4.7-flash, 19 GB), LM Studio, llama.cpp, vLLM, SGLang
How to choose
With 24 to 32 GB, start with Qwen3.8-27B. Its 17 GB 4-bit file matched the full model on Terminal-Bench 2.1 in Quesma's test. With 128 GB of unified memory, Qwen3.8-Flash-Next posted the top score in WonderRico's benchmark. With 16 GB, gpt-oss-20b fits whole on the card, and one developer reports useful work from a 2-bit Qwen3.8-27B. With 8 GB, try Qwen3.5-9B and keep the jobs small. At 64 GB, run the 27B models at 8-bit, a 29 GB file, with a longer context. The step above that needs about 100 GB.
A coding agent only works if the model emits tool calls your server can parse. Gemma 4 shipped with broken tool calling that was fixed later, and Qwen chat templates have needed community fixes, so update Ollama, LM Studio or llama.cpp before blaming the model. Agents also need room: LM Studio loads models with an 8,192-token context unless you raise it.
Scores on a model card are the maker's own. A mixture-of-experts model computes with a few billion parameters per token but still has to hold all of them in memory, and context takes memory on top of the file. Qwen3.8 thinks at its highest effort by default, which is slow on home hardware. Qwen3.8-Flash-Next is not Apache licensed. Older guides still recommend Qwen2.5-Coder, Qwen3-Coder and Devstral, which general-purpose models beat in the hands-on tests cited here.
The list is ordered by how many independent testers and developers recommend each model for coding, then by downloads.
Numbers checked October 11, 2026.
More lists like this
Best AI Coding Plans (2026)
The best AI coding plans give your coding agent a month of strong models for a flat fee, often a tenth of Claude Max.
Best OpenCode Alternatives (2026)
The best OpenCode alternatives are the terminal coding agents developers say they moved to in blog posts and Hacker News threads, checked against…
Best OpenCode Plugins (2026): Which Work on OpenCode 2
The best OpenCode plugins for OpenCode 2 (v2), from DCP to Superpowers, ranked by independent picks and hands-on tests. OpenCode 1 plugins won't load on 2.
OpenRouter Alternatives (2026): Cheaper or Self-Hosted
The best OpenRouter alternatives, hosted routers and gateways you run yourself, picked from developers who switched and reviewers who measured them.
Best Small Models for Text Classification on a Laptop (2026)
Small models for text classification you can run on a laptop: spam, intent, routing and moderation with no API bill, picked from independent tests by Red…
Pi Extensions (2026): Best Add-ons for the Pi Coding Agent
The best Pi extensions for subagents, web search, plan mode and permissions, picked from the setups developers publish, each with its pi install command.