[{"data":1,"prerenderedAt":658},["ShallowReactive",2],{"blog-post-best-local-llm-for-coding":3,"related-posts-best-local-llm-for-coding":628,"decoder-links-best-local-llm-for-coding":654,"hero-size-best-local-llm-for-coding":655},{"id":4,"title":5,"author":6,"body":11,"bottomCta":597,"category":598,"date":599,"definedTerm":597,"description":600,"extension":601,"featured":602,"hideToc":602,"image":603,"imageAlt":604,"imageHeight":605,"imageWidth":606,"itemList":597,"lang":597,"lead":597,"meta":607,"navigation":608,"noindex":602,"path":609,"primaryHub":597,"readingTime":610,"redirected":602,"relatedSlugs":611,"seo":615,"seoTitle":616,"stem":617,"subtitle":618,"tags":619,"updatedDate":599,"__hash__":627},"blog/blog/best-local-llm-for-coding.md","Best Local LLM for Coding: Match the Model to the Task",{"name":7,"role":8,"avatar":9,"bio":10},"Shabnam Katoch","Growth Head","/img/avatars/shabnam-profile.jpeg","Shabnam leads growth at BetterClaw and has spent the past three years building organic distribution for AI-native products. She writes about no-code agent builders, content strategy, and what it actually takes to grow without an ads budget.",{"type":12,"value":13,"toc":568},"minimark",[14,18,21,24,27,30,46,51,58,61,143,148,151,154,162,165,168,172,175,180,199,204,219,223,229,232,236,239,247,250,276,284,287,291,294,305,309,312,315,318,379,382,390,394,397,412,415,419,422,425,429,435,438,458,462,465,469,472,475,478,481,489,493,496,499,502,512,520,524,528,531,535,538,542,550,554,557,561,564],[15,16,17],"p",{},"Picture the usual setup. You read a leaderboard, download the top open model that fits your GPU, and wire it into your editor for tab completion.",[15,19,20],{},"Every suggestion takes four seconds. Half of them start with \"Sure! Here's the code you asked for.\"",[15,22,23],{},"So you switch it to agent mode instead, and it confidently edits six files to fix a bug that lived in one.",[15,25,26],{},"Nothing was wrong with the model. It was the wrong model for both jobs.",[15,28,29],{},"\"Best local LLM for coding\" isn't one answer. It's at least four, and the right one depends on what you're asking the model to do.",[31,32,33],"blockquote",{},[15,34,35,39,40,45],{},[36,37,38],"strong",{},"The short version:"," pick by task first, hardware second. For tab completion you need a small model trained on fill-in-the-middle with thinking off; Continue recommends Qwen 2.5 Coder 1.5B or 7B locally. For repository edits and agent work you need a larger model with reliable tool calls and at least 64K of context. Then check what fits your VRAM (our ",[41,42,44],"a",{"href":43},"/blog/best-coding-model-12gb-vram","12GB VRAM coding guide"," is a good start), and test on your own repo before you trust any leaderboard.",[47,48,50],"h2",{"id":49},"the-best-local-llm-for-coding-starts-with-your-task-not-a-leaderboard","The best local LLM for coding starts with your task, not a leaderboard",[15,52,53],{},[54,55],"img",{"alt":56,"src":57},"Four coding jobs, four kinds of evidence: tab completion needs a small FIM model with thinking off, judged by latency; small edits need an instruction model, judged by pass rate; repo edits need long context, judged by tests and the diff; agent work needs tool calls and 64K+ context, judged by task success","/img/blog/best-local-llm-for-coding-four-tasks.jpg",[15,59,60],{},"Here's how the four jobs differ:",[62,63,64,83],"table",{},[65,66,67],"thead",{},[68,69,70,74,77,80],"tr",{},[71,72,73],"th",{},"Task",[71,75,76],{},"What the model must do",[71,78,79],{},"What matters most",[71,81,82],{},"Evidence that actually tells you something",[84,85,86,101,115,129],"tbody",{},[68,87,88,92,95,98],{},[89,90,91],"td",{},"Tab completion",[89,93,94],{},"Fill the gap between the code before and after your cursor",[89,96,97],{},"Latency and a fill-in-the-middle (FIM) format",[89,99,100],{},"Time to first suggestion; acceptance rate in your own editor",[68,102,103,106,109,112],{},[89,104,105],{},"Small edits and chat",[89,107,108],{},"Rewrite a function, explain an error, write a test",[89,110,111],{},"Instruction following, short answers",[89,113,114],{},"Pass rate on small, checkable tasks",[68,116,117,120,123,126],{},[89,118,119],{},"Repository edits and review",[89,121,122],{},"Change several files consistently; spot real bugs",[89,124,125],{},"Context length, diff discipline",[89,127,128],{},"Tests passing after the change; reviewer agreement",[68,130,131,134,137,140],{},[89,132,133],{},"Agent work",[89,135,136],{},"Plan, call tools, run commands, iterate",[89,138,139],{},"Tool-call reliability, long context",[89,141,142],{},"Task success on a real repo across several attempts",[144,145,147],"h3",{"id":146},"completion-and-agentic-coding-need-different-evidence","Completion and agentic coding need different evidence",[15,149,150],{},"This is where most people get it wrong. A benchmark like SWE-bench Verified measures whether a model can resolve a GitHub issue end to end. That says nothing about whether it can finish your line in 200 milliseconds.",[15,152,153],{},"The reverse is also true. A model that's brilliant at completion may never have been trained to call tools at all.",[15,155,156,157,161],{},"And if you're not yet sure local is right for you at all, our guide on ",[41,158,160],{"href":159},"/blog/how-to-choose-llm-for-your-task","how to choose an LLM for your task"," compares local and hosted by cost, speed and privacy.",[15,163,164],{},"The public leaderboards have also aged. Aider's polyglot leaderboard, one of the few that ran open models through the same test setup, was last updated on 20 November 2025.",[15,166,167],{},"It scores 225 Exercism exercises across C++, Go, Java, JavaScript, Python and Rust. Most newer local-model scores are self-reported by vendors on their own scaffolds, which makes them hard to compare.",[47,169,171],{"id":170},"our-test-protocol-and-what-it-cannot-prove","Our test protocol and what it cannot prove",[15,173,174],{},"We don't trust a coding model until we've run it on code we know. Here's the protocol behind every result we publish.",[15,176,177],{},[36,178,179],{},"The test pack:",[181,182,183,187,190,193,196],"ol",{},[184,185,186],"li",{},"A public repository pinned to one commit, so anyone can check out the same code.",[184,188,189],{},"A fixed set of tasks in each category: completions, small edits, multi-file changes, review prompts and agent tasks.",[184,191,192],{},"Pass criteria decided in advance, usually \"the existing tests pass and the new test passes.\"",[184,194,195],{},"Several attempts per task, because local models vary run to run.",[184,197,198],{},"A log for every run: model and quantisation, runner and version, hardware, settings, pass and attempt counts, latency and peak memory.",[15,200,201],{},[36,202,203],{},"What it can't prove:",[205,206,207,210,213,216],"ul",{},[184,208,209],{},"That a model is best for your codebase. A small task set is a signal, not a verdict.",[184,211,212],{},"That results carry across hardware. Speed and memory change with the GPU, the runner and the quantisation.",[184,214,215],{},"That the model hasn't seen similar code in training. Public repos can leak into training data.",[184,217,218],{},"That today's result holds after the next model or runner update.",[144,220,222],{"id":221},"make-the-test-pack-reproducible","Make the test pack reproducible",[15,224,225],{},[54,226],{"alt":227,"src":228},"A reproducible test pack: pin a public repository at one commit, fix the tasks (completion, edits, multi-file, review, agent), repeat runs with pass rules set first, and log the model, quantisation, runner, hardware and memory; no test log, no ranking","/img/blog/best-local-llm-for-coding-test-pack.jpg",[15,230,231],{},"If someone can't rerun your test, it's an anecdote. So we publish the repository commit, the task list, the exact prompts, the runner configuration and the raw log alongside the results. Each result in our table links to its log.",[47,233,235],{"id":234},"choose-a-shortlist-for-completion-and-small-edits","Choose a shortlist for completion and small edits",[15,237,238],{},"For tab completion, the rule is simple: use a model trained for fill-in-the-middle, and keep it small.",[15,240,241,242,246],{},"Continue, an open-source editor extension that supports local models, explains why. Its docs say the recommended autocomplete models ",[243,244,245],"em",{},"\"are trained with a highly specific prompt format,\""," and that some of the best commercial chat models aren't, so they don't produce useful completions. For local use, Continue recommends Qwen 2.5 Coder in its 1.5B and 7B sizes.",[15,248,249],{},"Here's the weird part. Bigger doesn't help much here. Continue notes that most state-of-the-art autocomplete models are no more than 10B parameters.",[251,252,257],"pre",{"className":253,"code":254,"language":255,"meta":256,"style":256},"language-bash shiki shiki-themes github-light","ollama pull qwen2.5-coder:1.5b\n","bash","",[258,259,260],"code",{"__ignoreMap":256},[261,262,265,269,273],"span",{"class":263,"line":264},"line",1,[261,266,268],{"class":267},"s7eDp","ollama",[261,270,272],{"class":271},"sYBdl"," pull",[261,274,275],{"class":271}," qwen2.5-coder:1.5b\n",[15,277,278,279,283],{},"Prefer a desktop app to the command line? Our ",[41,280,282],{"href":281},"/blog/ollama-vs-lm-studio","Ollama vs LM Studio guide"," compares the two for local coding.",[15,285,286],{},"For small edits and chat in VS Code, you can run a second, larger instruction model alongside the completion model. Continue lets you assign different models to different roles in the same config.",[144,288,290],{"id":289},"when-latency-matters-more-than-a-longer-answer","When latency matters more than a longer answer",[15,292,293],{},"Tab completion lives or dies on speed. If a suggestion arrives after you've typed the next word, it's noise.",[15,295,296,297,300,301,304],{},"So switch thinking off. Continue's docs warn that ",[243,298,299],{},"\"thinking-type models are not recommended as they generate more slowly,\""," and show how to send ",[258,302,303],{},"think: false"," for models that can toggle it. If you're on a Mac, try an MLX build of your completion model and compare latency against the GGUF version.",[47,306,308],{"id":307},"compare-repository-edits-review-and-agent-tools","Compare repository edits, review and agent tools",[15,310,311],{},"This is where model size starts to matter. Multi-file edits and agent loops need long context, steady instruction following and tool calls that don't break.",[15,313,314],{},"Our runner guide puts the floor at 64K tokens of context for coding agents, and notes that tool-call reliability depends more on the model than on the runner.",[15,316,317],{},"Here are the candidates we test first for this tier. The scores are vendor-reported on the vendor's own scaffold, not our tests:",[62,319,320,336],{},[65,321,322],{},[68,323,324,327,330,333],{},[71,325,326],{},"Candidate",[71,328,329],{},"Size",[71,331,332],{},"Vendor-reported coding scores",[71,334,335],{},"Source",[84,337,338,352,365],{},[68,339,340,343,346,349],{},[89,341,342],{},"Qwen 3.6 27B",[89,344,345],{},"27B, 262K native context",[89,347,348],{},"SWE-bench Verified 77.2; Terminal-Bench 2.0 59.3; LiveCodeBench v6 83.9",[89,350,351],{},"Qwen model card",[68,353,354,357,360,363],{},[89,355,356],{},"Qwen 3.6 35B-A3B",[89,358,359],{},"35B total, 3B active, 262K native context",[89,361,362],{},"SWE-bench Verified 73.4; Terminal-Bench 2.0 51.5; LiveCodeBench v6 80.4",[89,364,351],{},[68,366,367,370,373,376],{},[89,368,369],{},"Gemma 4 12B",[89,371,372],{},"11.95B, 256K context",[89,374,375],{},"LiveCodeBench v6 72.0% (no SWE-bench score published)",[89,377,378],{},"Google model card",[15,380,381],{},"Qwen notes its SWE-bench numbers use an internal agent scaffold with bash and file-edit tools and a 200K context window.",[15,383,384,385,389],{},"Your agent, your context limit and your quantisation will all move the result. Wondering whether a 27B model fits your card? Our ",[41,386,388],{"href":387},"/blog/best-local-llm-16gb-vram-32gb-ram","16GB VRAM and 32GB RAM guide"," covers the quantisations.",[144,391,393],{"id":392},"wiring-a-local-model-into-a-coding-agent","Wiring a local model into a coding agent",[15,395,396],{},"People search for \"local LLM for Claude Code\" and \"local LLM with OpenCode\" a lot. Both work through a local server.",[15,398,399,400,403,404,407,408,411],{},"Ollama has the shortest path. Since v0.15, ",[258,401,402],{},"ollama launch claude",", ",[258,405,406],{},"ollama launch opencode"," or ",[258,409,410],{},"ollama launch codex"," picks a model and starts the agent with no config files; LM Studio and llama.cpp work too, but you point the agent at the port yourself. The Ollama vs LM Studio guide linked above covers each setup.",[15,413,414],{},"Whichever agent you use, set the context to at least 64K. A model with a short window will run out of room halfway through a multi-file change.",[144,416,418],{"id":417},"read-the-diff-before-trusting-the-result","Read the diff before trusting the result",[15,420,421],{},"Stay with me here, because this is the habit that matters most. A local model can produce a change that passes the tests and still be wrong. It might delete a check, widen a type or edit a file it didn't need to touch.",[15,423,424],{},"So for repository edits, review the diff the way you'd review a junior developer's pull request. For code review tasks, judge the model on whether it found real problems, not on how many comments it wrote.",[47,426,428],{"id":427},"check-hardware-fit-in-the-dedicated-guides","Check hardware fit in the dedicated guides",[15,430,431],{},[54,432],{"alt":433,"src":434},"Where to check what fits your GPU: 8 GB for completion models, 12 GB in the 12GB VRAM guide, 16 GB plus 32 GB RAM in the 16GB VRAM guide, 24 GB for weights plus 64K context, and MLX builds on Apple silicon Macs","/img/blog/best-local-llm-for-coding-hardware-fit.jpg",[15,436,437],{},"We keep hardware fit in separate guides, because the answer changes with every gigabyte:",[205,439,440,446,452],{},[184,441,442,445],{},[36,443,444],{},"12 GB cards:"," our 12GB VRAM coding guide (linked above) covers what fits, from Gemma 4 12B to mixture-of-experts models that spill into system RAM.",[184,447,448,451],{},[36,449,450],{},"16 GB cards with 32 GB of RAM:"," our 16GB guide (linked above) covers the 27B-class plan and MoE options.",[184,453,454,457],{},[36,455,456],{},"8 GB and 24 GB:"," the same rules apply. Fit the weights plus your context in VRAM, and test before you buy.",[144,459,461],{"id":460},"separate-model-choice-from-runner-choice","Separate model choice from runner choice",[15,463,464],{},"Choose the model for the task first. Then choose how to run it: Ollama, LM Studio, llama.cpp or MLX on a Mac. The runner affects speed, setup and API compatibility, but it doesn't make a weak model good at agent work.",[47,466,468],{"id":467},"when-a-local-llm-for-coding-is-the-wrong-trade-off","When a local LLM for coding is the wrong trade-off",[15,470,471],{},"Local coding models are great for privacy, offline work and fast completions. They're a harder sell for three jobs.",[15,473,474],{},"Large repositories need long context, and long context needs memory. A model that fits comfortably at 8K may not fit at 64K.",[15,476,477],{},"Long agent loops punish small mistakes. A model that's right 90% of the time on each step fails often over a 20-step task.",[15,479,480],{},"And your time costs something. If you're spending evenings tuning quantisations to get an agent to finish a task a hosted model would finish in minutes, that's a cost too.",[15,482,483,484,488],{},"A common split is to keep completion local and send hard agent work to a hosted model. If you'd like BetterClaw agents to use a model on your own Mac, BetterClaw Desktop shares models from Ollama, LM Studio or llama.cpp with your agents; our ",[41,485,487],{"href":486},"/docs/models-and-skills/local-models","local models docs"," explain the setup and requirements.",[47,490,492],{"id":491},"the-best-local-llm-for-coding-is-the-one-youve-tested-yourself","The best local LLM for coding is the one you've tested yourself",[15,494,495],{},"Here's the honest takeaway.",[15,497,498],{},"Leaderboards are a starting point, not an answer. They test someone else's tasks, on someone else's setup, at someone else's quantisation. Your repository is the only benchmark that predicts how a model will behave on your repository.",[15,500,501],{},"So build a small test pack, run your shortlist through it, and keep the log. It takes an afternoon. It saves weeks of working with the wrong model.",[15,503,504,505,511],{},"If you'd rather run agents without managing any of this, ",[41,506,510],{"href":507,"rel":508},"https://app.betterclaw.io/sign-in",[509],"nofollow","start free with BetterClaw",".",[15,513,514,515,519],{},"The free plan includes 100 credits a month, and you bring your own model key, hosted or local, so you still pay your provider for hosted inference (",[41,516,518],{"href":517},"/pricing","see full pricing","). We handle the infrastructure. You handle the interesting part.",[47,521,523],{"id":522},"frequently-asked-questions","Frequently Asked Questions",[144,525,527],{"id":526},"what-is-the-best-local-llm-for-coding","What is the best local LLM for coding?",[15,529,530],{},"It depends on the task. For tab completion, use a small fill-in-the-middle model such as Qwen 2.5 Coder 1.5B or 7B with thinking off. For repository edits and agent work, use a larger model with reliable tool calls and 64K or more of context, then test it on your own code before trusting a leaderboard.",[144,532,534],{"id":533},"how-does-a-local-coding-llm-compare-to-a-hosted-model","How does a local coding LLM compare to a hosted model?",[15,536,537],{},"Local models win on privacy, offline use and fast completions. Hosted models still tend to finish more long, multi-step agent tasks on large repositories. Many developers keep completion local and send hard agent work to a hosted model.",[144,539,541],{"id":540},"how-do-i-use-a-local-llm-with-claude-code-or-opencode","How do I use a local LLM with Claude Code or OpenCode?",[15,543,544,545,407,547,549],{},"The shortest route is Ollama v0.15 or newer: ",[258,546,402],{},[258,548,406],{}," picks a model and starts the agent with no config files. LM Studio and llama.cpp work too, but you point the agent at the local port yourself. Set the context to at least 64K.",[144,551,553],{"id":552},"is-a-local-llm-for-coding-worth-it","Is a local LLM for coding worth it?",[15,555,556],{},"For completion and small edits, usually yes: a 1.5B completion model runs on modest hardware and costs nothing per token. For agent work, factor in the GPU you need for 27B-class models and the time you'll spend tuning. If that's more than a hosted model costs you, local isn't the saving it looks like.",[144,558,560],{"id":559},"is-a-local-coding-model-reliable-enough-for-agent-work","Is a local coding model reliable enough for agent work?",[15,562,563],{},"Only after you've tested it on your own repository. Even a change that passes the tests can delete a check or touch files it shouldn't, so read every diff before you merge. Vendor scores such as SWE-bench come from the vendor's own setup, not yours.",[565,566,567],"style",{},"html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sYBdl, html code.shiki .sYBdl{--shiki-default:#032F62}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":256,"searchDepth":569,"depth":569,"links":570},2,[571,575,578,581,585,588,589,590],{"id":49,"depth":569,"text":50,"children":572},[573],{"id":146,"depth":574,"text":147},3,{"id":170,"depth":569,"text":171,"children":576},[577],{"id":221,"depth":574,"text":222},{"id":234,"depth":569,"text":235,"children":579},[580],{"id":289,"depth":574,"text":290},{"id":307,"depth":569,"text":308,"children":582},[583,584],{"id":392,"depth":574,"text":393},{"id":417,"depth":574,"text":418},{"id":427,"depth":569,"text":428,"children":586},[587],{"id":460,"depth":574,"text":461},{"id":467,"depth":569,"text":468},{"id":491,"depth":569,"text":492},{"id":522,"depth":569,"text":523,"children":591},[592,593,594,595,596],{"id":526,"depth":574,"text":527},{"id":533,"depth":574,"text":534},{"id":540,"depth":574,"text":541},{"id":552,"depth":574,"text":553},{"id":559,"depth":574,"text":560},null,"Guides","2026-12-02","Choose a local coding LLM for completion, repository edits, review or agent tasks. See a reproducible test method and links to hardware guides.","md",false,"/img/blog/best-local-llm-for-coding.jpg","Best local LLM for coding, chosen by task: a small FIM model for tab completion, an instruction model for small edits, long context for repo edits and review, reliable tool calls for agent work",512,1024,{},true,"/blog/best-local-llm-for-coding","11 min read",[612,613,614],"best-coding-model-12gb-vram","best-local-llm-16gb-vram-32gb-ram","ollama-vs-lm-studio",{"title":5,"description":600},"Best Local LLM for Coding: Choose by Task","blog/best-local-llm-for-coding","Tab completion, small edits, repository changes, code review and agent work each need different evidence. How to choose a local coding model by task, the test method we use, what it can't prove, and where to check hardware fit. Checked 1 December 2026.",[620,621,622,623,624,625,626],"best local llm for coding","local llm for coding","best local coding model","local llm for agentic coding","local llm for claude code","local llm vscode autocomplete","local coding model mac","fhBhaLSj7OD9oTh-5KIqKKON40heHDW56M9NDx0l7mQ",[629,638,645],{"stem":630,"title":631,"description":632,"date":633,"image":634,"category":635,"redirected":602,"author":636,"readingTime":637},"blog/best-coding-model-12gb-vram","Best Coding Model for 12GB VRAM: Ollama Picks That Fit","Best coding model for 12GB VRAM in 2026: Gemma 4 12B, Bonsai 2 27B, Qwen 3.5 9B and Qwen 2.5 Coder 14B on fit, context and tools, with Ollama commands.","2026-11-12","/img/blog/best-coding-model-12gb-vram.jpg","Hardware",{"name":7,"role":8,"avatar":9,"bio":10},"10 min read",{"stem":639,"title":640,"description":641,"date":642,"image":643,"category":635,"redirected":602,"author":644,"readingTime":637},"blog/best-local-llm-16gb-vram-32gb-ram","Best Local LLM for 16GB VRAM and 32GB RAM: What Fits","Best local LLM for 16GB VRAM and 32GB RAM in 2026: picks for coding agents, chat and long documents, with quants, published speeds and what to skip.","2026-11-13","/img/blog/best-local-llm-16gb-vram-32gb-ram.jpg",{"name":7,"role":8,"avatar":9,"bio":10},{"stem":646,"title":647,"description":648,"date":649,"image":650,"category":651,"redirected":602,"author":652,"readingTime":653},"blog/ollama-vs-lm-studio","LM Studio vs Ollama (November 2026): Speed, Mac MLX, APIs, Setup and the Verdict","LM Studio vs Ollama compared on speed, Mac unified memory and MLX, API, setup and agent use, plus Bionic, Jan and llama.cpp. Verdict first, Nov 2026.","2026-06-04","/img/blog/ollama-vs-lm-studio.jpg","Comparison",{"name":7,"role":8,"avatar":9,"bio":10},"25 min read",[],{"width":656,"height":657},1536,768,1796202880782]