More from The Desk Brief

Best Local LLM for Coding: What to Run on Your Hardware

There is no single best local LLM for coding, and anyone who hands you one model name is answering a narrower question than the one you asked. The right model for your desk comes down to two unglamorous facts: how much memory your computer has, and whether you want inline autocomplete, a chat window to paste code into, or an agent that edits files on its own. Sort those two out and the shortlist picks itself.

The gap between local and cloud has closed enough that this is a genuine choice now, not a hair-shirt exercise. A 7-billion-parameter coding model that fits on a thin laptop can draft functions, explain a stack trace, and finish the line you are halfway through typing. It still won’t match a frontier cloud model on a tangled refactor across dozens of files, and going in expecting that is how people quit in week two. If you are still deciding how much memory to buy for this kind of work, our RAM for local AI guide sizes that question on its own. Here I’m assuming the machine already on your desk is the one you’ll use.

Every size below comes from the Ollama model library this week, because download size is the honest proxy for whether a model will even load. These models are free to run, so cost isn’t the deciding factor. Memory is.

Last updated: September 2026. Model tags, package sizes, context labels, and engine support were checked again for this refresh.

NVIDIA RTX GPU die surrounded by AI software tool icons that run local models on RTX PCs
Image: NVIDIA newsroom

For recommendations beyond code, the best local LLM guide compares current models for chat, writing, reasoning, documents, and lightweight agents.

Table of Contents

Start with two questions, not a leaderboard

Skip the benchmark tables for a minute. The first question is how much memory the model can occupy. When you run a model through Ollama or llama.cpp, it loads into RAM or, if you have a discrete GPU, into video memory. The download size at 4-bit quantization is close to that footprint, so a 9GB model needs roughly 9GB free plus a couple of gigabytes of headroom for the context window. A 16GB laptop comfortably holds a 9GB model with room for your editor and browser; a 24GB graphics card holds a 19GB one.

The second question is what you actually want the model to do. Inline autocomplete, conversational help, and autonomous file editing are three different jobs, and the model that wins one can lose another. A tiny model that suggests the end of your current line in fifty milliseconds is useless as an agent, and a 30-billion-parameter agent is overkill for closing a bracket. Answer both questions and you have narrowed a field of hundreds down to two or three.

The best local LLM for coding by memory tier

All five models below have an Ollama package smaller than 16GB. That does not make every one comfortable on a 16GB Windows laptop. The operating system, editor, browser, and context cache need memory too, so the 13GB and 14GB packages are borderline system-RAM choices even though they load on a 16GB GPU or tightly managed unified-memory machine.

ModelParametersOllama packagePractical RAM targetCode-quality strengthBest engine
Qwen3.5 9B9B6.6GB12GB minimum; 16GB comfortableBest current all-rounder for code chat, debugging, and mixed technical questionsOllama; LM Studio for a GUI
Qwen2.5-Coder 14B14B9.0GB16GBMore code-focused than Qwen3.5, strong at completion, fixes, and routine generationOllama or llama.cpp
DeepCoder 14B Preview14B9.0GB16GBBest of this group for deliberate code reasoning, but slower and less natural for autocompleteOllama or LM Studio
DeepSeek-Coder-V2 Lite16B total, 2.4B active8.9GB16GBFast code chat with broad language coverage and useful long-context handlingOllama or llama.cpp
Codestral 22B22B13GB16GB only when tightly managed; 24GB preferredBest fill-in-the-middle specialist here; weaker value for general agent workllama.cpp for control; Ollama for setup

Qwen3.5 9B is my first download on an ordinary 16GB machine. It is newer, needs less memory than the 14B coding specialists, accepts text and image input, and carries a 256K context label in Ollama. Qwen2.5-Coder 14B remains worth keeping when the task is mostly code generation and repair rather than mixed reasoning.

DeepCoder 14B spends more time reasoning, which helps with contained algorithmic problems but makes it a poor keystroke-by-keystroke assistant. DeepSeek-Coder-V2 Lite is the efficient option: 16B total parameters with 2.4B active and an 8.9GB package. Codestral still earns a place for fill-in-the-middle completion, but its 13GB package leaves almost no breathing room in 16GB of shared system memory.

Qwen3-Coder 30B and Devstral Small 2 are current and stronger agent candidates, but they do not belong in a truthful 16GB list. Their Ollama packages are 19GB and 15GB respectively. The latter may technically load in a stripped-down 16GB environment, but useful context and an editor push it into the 24GB class.

Which inference engine should you use?

Use Ollama when you want the shortest route from a model name to a local API. Use LM Studio when you want to browse compatible downloads, adjust offload and context settings in a GUI, and expose an OpenAI-compatible local server. Use llama.cpp when you want direct control over GGUF quantization, GPU layers, batching, and command-line deployment.

The engine rarely rescues a model that is wrong for the job. It can change speed, memory use, supported quantizations, and prompt handling enough to affect the experience, though. Apple buyers choosing how much unified memory to purchase should compare the Mac mini and Mac Studio for local AI before treating a model’s file size as the whole hardware requirement.

Autocomplete, chat, and agents want different models

Memory tells you how big you can go. The best local LLM for coding also depends on which of three jobs you’re hiring it for, and the winner is different each time.

For inline autocomplete, the kind that finishes your line as you type, latency beats intelligence. You want a small, fast model that supports fill-in-the-middle, the trick that lets it see the code on both sides of your cursor instead of only what came before. Codestral is built for exactly this; its own description calls out completing partial code with a fill-in-the-middle mechanism. A small Qwen2.5-Coder works well here too. Point your editor’s completion plugin at a 7B or smaller model and you’ll barely notice the round trip.

For a chat window where you paste code and ask questions, Qwen3.5 9B is the balanced 16GB choice. Qwen2.5-Coder 14B is more narrowly code-focused, while DeepCoder 14B is better reserved for a problem that rewards slow reasoning. Qwen3-Coder 30B remains stronger for repository-scale agent work, but its 19GB package requires more than the memory promised by this page title.

For agents, the models that read a repository, plan an edit, and change several files, you want something trained for the workflow. Devstral is built as an agentic model for software engineering, and Mistral reports it scores 46.8% on SWE-bench Verified, a benchmark of real GitHub issues. Qwen3-Coder is trained the same way, with execution-driven reinforcement learning aimed at making its code actually run. If you’re wiring one of these into a local coding agent, our home AI agent setup guide covers the plumbing.

What the size and context numbers actually buy

Two numbers on every model page decide more than the benchmark scores: the quantization and the context length.

Quantization is compression. Q4_K_M, the default I’ve quoted throughout, is a 4-bit format that shrinks a model to roughly a quarter of its full-precision size while keeping most of its quality. It’s the standard sweet spot for local coding. Go lower and mistakes start creeping in; go higher, to 8-bit or full precision, and the download balloons for a difference most people can’t feel on everyday tasks. llama.cpp supports everything from about 1.5-bit up to 8-bit if you want to experiment.

Context length is how much code the model can hold at once. Qwen2.5-Coder and Codestral carry 32K labels in Ollama, DeepCoder carries 128K, DeepSeek-Coder-V2 Lite reaches 160K, and Qwen3.5 9B carries 256K. Those are supported ceilings, not sensible defaults on a 16GB machine. The key-value cache grows with context, so begin around 8K or 16K and raise it only when the task actually needs more repository material.

Why the best keeps moving, and why that is fine

If you came here hoping I’d crown one model and end the argument, I won’t, because the answer changes every few weeks. New open coding models land constantly, and the leader on any given benchmark in July can be mid-table by autumn. Marrying one model is the mistake. Pulling a new one is a single command, and swapping it into your editor takes a minute, so treat your choice as this month’s default, not a lifelong commitment.

The reason to run any of them locally is the part that doesn’t change. Your code never leaves your machine, which matters if you work on anything under NDA or just dislike pasting a proprietary codebase into someone else’s server. You pay nothing per token, so you can let autocomplete run all day. And it works on a plane. If you want the full walkthrough of getting a model running, our guide to running an LLM locally covers install to first answer, and if you’re shopping for hardware to do it well, the Beelink GTR9 Pro is the kind of mini PC that holds a 30B model without complaint.

My honest recommendation is to start smaller than you think you need. Most people reach for the biggest model their machine can technically load and then wonder why autocomplete feels sluggish. A 7B model you barely notice will do more for your day than a 30B model you sit and wait on.

FAQ

What is the best local LLM for coding on a laptop?

On a typical 16GB laptop, start with Qwen3.5 9B. Its 6.6GB Ollama package leaves more working room than the 9GB coding models and handles code chat, debugging, and general technical questions well. Move to Qwen2.5-Coder 14B when code generation quality matters more than the newer model’s broader skill set.

How much RAM do I need to run a local coding model?

8GB is the realistic floor and runs a 7B model. 16GB is the comfortable middle and opens up 14B-class models. 24GB of video memory or 32GB of system memory lets you run 30B models like Qwen3-Coder. Budget the model’s download size plus two to three gigabytes for the context. If memory turns out to be your bottleneck, it’s worth checking whether it’s a good time to buy more RAM before you commit to an upgrade, since kit prices have swung a lot this year.

Is a local coding model as good as a cloud model like Copilot?

For autocomplete, explaining code, and routine edits, a good local model is close enough that you won’t miss the cloud. For sprawling reasoning across a large codebase, frontier cloud models still lead. Plenty of developers run both: local for the constant small stuff, cloud for the occasional hard problem.

Which local model is best for autocomplete in an editor?

Codestral, because it’s built around fill-in-the-middle completion, or a small Qwen2.5-Coder if you want something lighter. Both are fast enough to suggest code as you type without a noticeable lag.

Do I need an NVIDIA GPU?

No. These models run on CPU and system RAM through Ollama or llama.cpp, and they run especially well on Apple Silicon Macs, which share memory between the CPU and GPU. A discrete NVIDIA card mostly buys you speed and the ability to hold a larger model in fast video memory.

The Short Version

On a 16GB machine, start with Qwen3.5 9B for balanced code chat, Qwen2.5-Coder 14B for code-focused generation, DeepCoder 14B for deliberate reasoning, DeepSeek-Coder-V2 Lite for efficient long-context work, or Codestral 22B for fill-in-the-middle completion. Codestral is the tightest fit and works better with 24GB.

Ollama is easiest, LM Studio has the friendliest controls, and llama.cpp gives you the most deployment control. Keep the context conservative, leave memory for the editor and operating system, and use Qwen3-Coder 30B or Devstral Small 2 only after moving beyond 16GB.

Leave a Comment