Best Ollama Model for Coding: Picks by VRAM Tier
Want to go deeper than this article?
Free account unlocks the first chapter of all 25 courses — RAG, agents, MCP, voice AI, MLOps, real GitHub repos.
Learn Ollama properly, from install to daily driver
15 chapters: installing it on Windows, macOS and Linux, reading the model library, Modelfiles, making Ollama use your GPU, the API, and the errors that actually happen. Chapter 1, “What Ollama Is (and Three Jobs It's Wrong For)”, is free with an account. No card.
The best Ollama model for coding is whichever coder fits your VRAM with room left for context — and at every tier that is currently a Qwen or Mistral coder. On a 24GB card run qwen3-coder:30b. On 16GB, devstral-small-2:24b. On 12GB, qwen2.5-coder:14b. On 8GB, qwen2.5-coder:7b. With 64GB of GPU or unified memory, qwen3-coder-next. The rest of this page explains why the VRAM tier decides it, and where each pick stops being the right answer.
Model rankings change every few weeks. The amount of memory on your graphics card does not, and it is the constraint that actually determines what you can run. That is why this page is organised by card rather than by leaderboard.
Which Ollama coding model should I run?
| Your VRAM | Pull this | Weights at Q4_K_M | Published coding score | Why |
|---|---|---|---|---|
| 8GB | qwen2.5-coder:7b | 4.7GB | HumanEval 88.4% (Qwen2.5-Coder report) | The strongest coder in the 7B class, and it leaves room for a working context |
| 12GB | qwen2.5-coder:14b | 9.0GB | HumanEval 89.6% (Qwen2.5-Coder report) | A clear quality step over every 7B coder, and the 12GB ceiling |
| 16GB | devstral-small-2:24b | 15GB | SWE-bench Verified 68.0% (Mistral); 56.4% on swebench.com | Built for agentic coding; see the headroom caveat below |
| 24GB | qwen3-coder:30b | 19GB | 51.6% SWE-bench Verified on swebench.com (OpenHands) | Coding-specific MoE: 3.3B active per token, so it generates at small-model speed, with a 256K native context |
| 48-64GB+ | qwen3-coder-next | 52GB | SWE-bench Verified 70.6% (Qwen technical report) | The strongest Qwen coder that fits a 64GB Mac or two 32GB cards |
Sizes are the Q4_K_M weights as Ollama lists them (re-read November 2, 2026). Scores are as published by the vendor or the official swebench.com board, read October-November 2026; vendor and board numbers use different agent harnesses, so compare within a column source, not across.
Two 24GB alternatives worth knowing. qwen3.6:27b (18GB) is a dense general model whose Qwen model card reports 77.2% on SWE-bench Verified with Qwen's own agent, and qwen3.8:27b (18GB) is the newer all-rounder. Both beat the 30B coder on paper; the 30B is faster per token because only 3.3B of its parameters run each step. qwen2.5-coder:32b (20GB) still runs well for chat and completion but scores only 9.0% as an autonomous agent on swebench.com, so it is no longer the 24GB pick.
Sizes are not the whole memory requirement: the KV cache for your context sits on top, and it grows with how much code you feed the model. A model whose weights exactly fill your card will load and then disappoint you the moment you paste in a real file.
The 16GB caveat worth knowing before you pull
Devstral Small 2 24B (devstral-small-2:24b) is 15GB at Q4_K_M. Mistral reports 68.0% on SWE-bench
Verified for it, which is the strongest agentic-coding figure among models that fit a
16GB card — that number is Mistral's own published result, not ours; the official
swebench.com board lists the same model at 56.4% with its own harness. But 15GB of weights
on a 16GB card leaves roughly a gigabyte for everything else, which is not much of a
context window. (The plain devstral tag is the older Devstral Small, a 14GB download.)
If your work involves an agent reading several files at once, run the mixture-of-experts
gpt-oss:20b or drop to qwen2.5-coder:14b (~9GB) and spend the reclaimed memory on
context instead. More context with a slightly weaker model usually beats a stronger model
that cannot see your codebase. Our 16GB VRAM coding picks
go through the trade in more detail.
Reading articles is good. Building is better.
Free account = the first chapter of all 25 courses, with a per-chapter AI tutor. No card.
Why does VRAM decide this and not the benchmarks?
A model that does not fit does not run — or rather, Ollama will run it by spilling layers into system RAM, at which point it becomes slow enough that you stop using it. That is the whole game on consumer hardware.
Two models sit tantalisingly just outside the 16GB tier: Qwen3.6 27B at roughly 18GB and Qwen3-Coder 30B at roughly 19GB. Both miss a 16GB card by a margin too small to quantise away without hurting quality, and both fit a 24GB card easily. If you are choosing hardware rather than choosing a model, that gap is the entire argument for 24GB — see our hardware guide for what that costs at each build tier.
What if I have 48GB or more?
Two RTX 3090s or 4090s (48GB), two 32GB RTX 5090s, an 80GB data-center card, or a Mac with
64GB+ of unified memory opens the next step: qwen3-coder-next, an 80B mixture-of-experts
model with 3B parameters active per token. Ollama's Q4_K_M build is 52GB, so 48GB is not quite
enough to hold it on the GPU; 64GB is the realistic floor. Its technical report lists 70.6% on
SWE-bench Verified with the SWE-Agent harness, against 76.0% for Claude Sonnet 4.5 in the same
harness. The Qwen3-Coder-Next guide has the full table and setup.
With 48GB, a 30B-class model at Q8 (qwen3-coder:30b-a3b-q8_0, 32GB) plus a long context is
the better use of the memory.
Is Ollama fast enough for coding?
Ollama runs llama.cpp underneath, so its speed is the model's speed on your hardware. Our reference
measurement: qwen2.5-coder:7b generated 29.0 tokens per second on
an Apple M3 Pro (18GB, 150 GB/s) with Ollama 0.40.13 on 2 November 2026, against a bandwidth
ceiling of 32 tok/s for its 4.7GB file. A discrete GPU with more memory bandwidth raises that
ceiling: an RTX 4060's 272 GB/s gives the same file a ~58 tok/s ceiling. On a rented NVIDIA L4
(24 GB, 300 GB/s) the same tag measured 52.0 tok/s (Ollama 0.40.13, 3 November 2026; every row
is on /benchmarks). The MoE models above
(qwen3-coder:30b, qwen3-coder-next) generate much faster than their total size suggests,
because only a few billion parameters are read per token; we do not quote a ceiling for them.
Run this on your own machine and stop paying every month
Pay once and keep it. No renewal, no per-token bill, and nothing you feed it ever leaves your hardware.
What about DeepSeek Coder?
DeepSeek-Coder 6.7B (deepseek-coder:6.7b, 3.8GB) is the close second at 8GB, and DeepSeek-Coder-V2 Lite 16B (deepseek-coder-v2:16b) — a
mixture-of-experts model that is an 8.9GB download — is a strong 12GB option that feels
faster in an editor than its size suggests, because only a fraction of its parameters are
active per token.
The practical split: reach for DeepSeek when you are mostly doing fill-in-the-middle completion inline, and for Qwen when you are mostly asking questions and having it write whole functions. Both are a few gigabytes. Pull both and switch.
How do I actually use this in my editor?
Ollama on its own gives you a terminal. To get something that behaves like Copilot you need an editor extension pointed at it:
# pull the model for your tier
ollama pull qwen2.5-coder:14b
# confirm it is serving
curl http://localhost:11434/api/version
Continue.dev is the most direct route for VS Code and JetBrains — our Continue.dev and Ollama setup guide covers the config file and the two settings people usually get wrong. If you work in the terminal instead, Aider is the most local-model-tolerant of the coding agents by its own documented design goals.
One setting matters more than the model choice for agent work: the context length. Ollama
defaults conservatively, and an agent that cannot see enough of your repository will
behave as though the model is stupid when the real problem is the window. Raise
num_ctx per model rather than globally.
Which tier should I buy for?
If you are choosing a card specifically to run a local coding assistant, the honest ordering is: 24GB is where this becomes genuinely pleasant, 16GB is workable with the context caveat above, 12GB is fine for autocomplete and single-file questions, and 8GB works but you will feel the ceiling within a week. Above 24GB, the next useful step is 64GB of GPU or unified memory for Qwen3-Coder-Next.
Our per-tier pages go deeper on each: 8GB, 12GB, 16GB and 24GB. If you have not settled on a card yet, the VRAM calculator will tell you what a specific model needs before you spend anything.
Frequently asked questions
Ollama’s running. Here’s what to build with it.
Go from “ollama run” to RAG apps, agents, and fine-tuned models — structured and hands-on. First chapter free.
Stop piecing Ollama together from blog posts
Ollama Mastery is 15 chapters end to end — install, model choice, Modelfiles, GPU offload, the API, and the 20 errors that actually happen. Plus 24 more courses.
Liked this? 25 full AI courses are waiting.
From fundamentals to RAG, agents, MCP servers, voice AI, and production deployment with real GitHub repos. First chapter free, every course.
Build Real AI on Your Machine
RAG, agents, NLP, vision, and MLOps - chapters across 25 courses that take you from reading about AI to building AI.
Want the structured version?
Hands-on courses on local AI, from $8.99 a month. The first chapter of each is free.
Keep going
- PILLARBest Local AI for Coding 2026: 10 Models Ranked by VRAM
- Continue config.yaml: Working Ollama Setup Example (VS Code)
- Best 14B Coding Models (2026): Ranked by HumanEval + VRAM
- Best Claude Model for Coding: Opus, Sonnet, Fable, Haiku
- Tabby: Self-Hosted GitHub Copilot Alternative
- NPU vs GPU vs CPU for Local AI (2026): Copilot+ or RTX
- 7B vs 14B vs 32B vs 70B for Coding (2026): What Size?
- Kilo Code + Ollama: Free Local Coding Agent in VS Code
- Speculative Decoding Guide: EAGLE, Medusa, n-grams (2026)
- Goose + Ollama (2026): Run Block’s Open Coding Agent Locally
Comments (0)
No comments yet. Be the first to share your thoughts!
