Engineering17 min readDecember 6, 2026

The best Ollama models for coding, picked by the job and by the memory on your card

Best Ollama models for coding by job and VRAM, December 2026. In Ollama the newest agent models lack fill-in-the-middle, and 64K can add 10.7 GB of cache.

Charafeddine Mouzouni
Charafeddine Mouzouni
Diagram of four Ollama coding models at a 64K context window against a 24 GiB card, which holds 25.8 GB in Ollama's decimal units: qwen3.8:27b at 17.7 GB of weights plus 4.3 GB of cache with 3.7 GB spare, qwen3-coder:30b at 18.6 plus 6.4 with 0.8 GB spare, devstral-small-2 at 15.2 plus 10.7 and over, and flint-1.1 at 24.2 plus 1.9 and over, at the default 16-bit cache

The best Ollama models for coding in December 2026 depend on the job and on your GPU memory. For agentic coding in Claude Code, OpenCode or Codex: qwen3.8:27b (18 GB) on a 24 GB card, mimo-v2.6:9b or qwen3.5:9b (about 7 GB) on 12 to 16 GB, qwen3.6:35b-coding or flint-1.1 (about 24 GB each) on 32 to 48 GB, and qwen3-coder-next (52 GB) from 64 GB up. For editor autocomplete, qwen2.5-coder:1.5b or :7b. For chat about code, gemma4:12b on 16 GB and qwen3.8:27b on 24 GB. Every tag and size was read on ollama.com on 6 December 2026, with Ollama at v0.40.21.

Each job asks something different of the model. Autocomplete needs a fill-in-the-middle template, which ollama show lists as the insert capability, and in Ollama the newest agent models do not have one. Agents need the tools capability and a window of at least 64K tokens, and that window adds its own memory on top of the download: about 4.3 GB for qwen3.8:27b and 10.7 GB for devstral-small-2. Shortlist two models for your memory, then test both on a bug your repository has already fixed.

A common first week with local coding models starts on a model card. Someone with a 24 GB graphics card reads that Flint 1.1 scores 76.6% on SWE-bench Verified, sees a 24 GB download, and decides it fits.

It loads. Then they follow Ollama's page for Claude Code and raise the window to 64K, and every reply gets much slower. ollama ps shows part of the model in system memory, because the cache for 64,000 tokens needs space the weights had already taken.

So they try the same model in the editor for autocomplete, and that fails in a different way. Flint has no fill-in-the-middle template, so Ollama has no way to hand it the code that comes after the cursor.

One model was asked to do three jobs, and it was picked on a benchmark score that says little about fit.

Three coding jobs, three different requirements

"Coding" covers three jobs that load a model very differently. Autocomplete fires on every pause in your typing and has to answer in a fraction of a second. Chat about code is a conversation where you paste what matters. An agent reads files, edits them, runs commands and keeps going for an hour.

JobWhat the model needsHow to checkWindow
Autocompletea fill-in-the-middle template, small and fastinsert under Capabilities in ollama showsmall is fine
Chat about codegood reasoning on code you pasteyour own prompts16K to 32K
Agentic codingreliable tool calls, a long windowtools badge on the model page64K or more

The window column matters because of a default. Ollama's context length page gives a model 4K tokens on a GPU under 24 GiB, 32K from 24 to 48 GiB, and 256K above that. The same page says agents and coding tools need at least 64,000, so on most machines you have to raise it yourself.

Units cause the second surprise. Ollama prints sizes in decimal gigabytes, while a "24 GB" card holds 24 GiB, which is about 25.8 GB in Ollama's units. Every fit in this article uses Ollama's units against that real capacity.

The best Ollama models for coding by VRAM

Rows are the memory your GPU has. Read across for the job. Where a cell holds two names, they are close enough that your own repository should decide.

MemoryAutocompleteChat about codeAgentic coding
8 GBqwen2.5-coder:1.5bqwen3.5:4ba cloud model
12 to 16 GBqwen2.5-coder:1.5bgemma4:12bmimo-v2.6:9b, qwen3.5:9b
24 GBqwen2.5-coder:1.5bqwen3.8:27bqwen3.8:27b, devstral-small-2 (8-bit cache)
32 to 48 GBqwen2.5-coder:7bqwen3.6:35bqwen3.6:35b-coding, flint-1.1
64 GB and upqwen2.5-coder:7bqwen4qwen3-coder-next, qwen4

The autocomplete column stays small on purpose. It runs next to your chat or agent model, so on a 16 or 24 GB card the 1.5B leaves the room to the model doing the heavy work. With 32 GB or more, the 7B is affordable.

On 8 GB, qwen3.5:4b does fit at 64K: about 3.3 GB of weights and 2.1 GB of cache. It is a good way to learn how an agent loop behaves. For agent work you care about, a cloud model is the realistic choice at that size, and our Ollama Cloud vs local models guide covers what that means for your code.

On a Mac, unified memory is shared with macOS and your editor, so plan below the number on the box. Two models are worth knowing there. inkling-2-mini, from Thinking Machines, is a 19 to 20 GB download whose page says it runs on a Mac with 32 GB or more. Laguna XS 2.1, a 20 GB coding model, currently carries a notice that its publisher is investigating an issue on macOS.

Autocomplete: the models that support fill-in-the-middle

Autocomplete is a fill-in-the-middle job. The editor sends the code before the cursor and the code after it, and the model writes what belongs in between. In Ollama's API that second part is the suffix field of /api/generate.

Ollama only accepts a suffix when the model's prompt template has a place for it. Its v0.40.21 source turns that into a capability called insert, and a request with a suffix to a model without it comes back as a 400 error saying the model does not support insert.

That rules out the models in the agent column. qwen3.8, qwen3-coder, flint-1.1 and mimo-v2.6 are served through built-in renderers that have no suffix input, and the templates of qwen3.5, gemma4 and devstral-small-2 have no suffix slot either. The models that do support it are older code families.

TagDownloadContextLicense
qwen2.5-coder:1.5b986 MB32KApache 2.0
qwen2.5-coder:3b1.9 GB32KQwen Research
qwen2.5-coder:7b4.7 GB32KApache 2.0
qwen2.5-coder:14b9.0 GB32KApache 2.0
codestral:22b13 GB32KMistral Non-Production
starcoder2:3b1.7 GB16KBigCode OpenRAIL-M
deepseek-coder-v2:16b8.9 GB160KDeepSeek License

The license column is easy to skip. The Qwen 2.5 Coder 3B ships under a research license while its neighbors are Apache 2.0, and Codestral's license is for non-production use. If the setup is for paid work, the 1.5B, 7B and 14B are the clean choices.

You can confirm the capability on any model you have pulled. ollama show qwen2.5-coder:1.5b prints a Capabilities block, and insert should be in it. Then try a completion by hand.

curl http://localhost:11434/api/generate -d '{
  "model": "qwen2.5-coder:1.5b",
  "prompt": "def is_leap(year):\n    ",
  "suffix": "\n\nprint(is_leap(2024))",
  "stream": false,
  "options": {"temperature": 0, "num_predict": 64}
}'

The response field holds what the model proposes for the gap. Ollama wraps your prefix and suffix in the model's own fill-in-the-middle tokens, so you send plain code.

For the editor, Continue's autocomplete guide recommends this exact model for local use, and its configuration is a few lines in config.yaml.

models:
  - name: Qwen 1.5b Autocomplete Model
    provider: ollama
    model: qwen2.5-coder:1.5b
    roles:
      - autocomplete

The same guide says most good autocomplete models are 10B parameters or smaller, and that thinking models are usually too slow for it. That matches the cost structure: a completion you wait two seconds for is a completion you stop reading.

Agentic coding models: tool calling and a long window

An agent is a loop. The model asks for a file, the tool returns it, the model asks to edit a line, the tool reports the result, and it goes on for dozens of turns. Every model page on ollama.com shows capability badges under its description, and the tools badge is the first filter. The tools search lists only those.

On 12 to 16 GB, mimo-v2.6:9b is the newest option. It is Xiaomi's 9B for code and agent work, fine-tuned from Qwen3.5-9B, with images, thinking, tools and a 256K window, under MIT. Its card reports 61.1 on SWE-bench Verified, averaged over three runs, against 60.0 for the Qwen3.5-9B it started from, and a larger jump on SWE-bench Pro, 44.6 against 32.0. qwen3.5:9b is the safer default, because it is one of the two models Ollama's own launch picker recommends to run locally.

On 24 GB, qwen3.8:27b is the pick I would start with. It is an 18 GB dense model with a 256K window, vision, tools and thinking, under Apache 2.0. Qwen's model card reports 73.0 on Terminal-Bench 2.1 and 61.7 on SWE-bench Pro, against 63.4 and 53.5 for Qwen3.6-27B.

devstral-small-2, Mistral's 24B coding model, is the alternative on the same card. It is a 15 GB download with a 384K window under Apache 2.0, and Mistral's model card lists it at 68.0% on SWE-bench Verified. It needs the 8-bit cache to fit at 64K, for a reason the next section shows.

From 32 GB, the mixture-of-experts models open up. qwen3.6:35b-coding is 23 to 24 GB with 3B parameters active per token. flint-1.1, from Recursive, is 24 GB with about 2.5B active and a 256K window, and its card reports 76.6% on SWE-bench Verified with tool calls that fail 0.4% of the time or less across the coding tools Recursive tested.

TagDownloadActive paramsContextLicense
qwen3.5:9b6.6 to 7.6 GBdense 9B256KApache 2.0
mimo-v2.6:9b6.6 to 8.7 GBdense 9B256KMIT
devstral-small-215 GBdense 24B384KApache 2.0
qwen3.8:27b18 GBdense 27B256KApache 2.0
qwen3-coder:30b19 GB3.3B256KApache 2.0
inkling-2-mini19 to 20 GB5.4B1MApache 2.0
qwen3.6:35b-coding23 to 24 GB3B256KApache 2.0
flint-1.124 GBabout 2.5B256KApache 2.0
qwen436 to 37 GB3B1MApache 2.0
qwen3-coder-next52 GB3B256KApache 2.0

qwen4 arrived on 4 December and needs Ollama v0.40.21. It fits a 48 GB card, and its download is larger than "35B with 3B activated" suggests because, per Qwen's card, it also carries 20B parameters of n-gram embeddings. From 64 GB, qwen3-coder-next is the coding specialist: 80B parameters with 3B active, no thinking mode, and a page that lists Claude Code, Qwen Code, Cline and OpenCode as tools it works with.

What a 64K window costs on top of the download

A model's memory bill has three parts: the weights, the cache that holds the conversation, and the runtime's working space. The download covers the first. For an agent at 64K the cache can be the deciding part, and its size comes from the architecture far more than from the parameter count.

The cache column below is my arithmetic from each model's published config, at Ollama's default 16-bit cache: two tensors per full-attention layer, times the key-value heads, times the head size, times 65,536 tokens. Downloads come from the registry manifests, which the tag pages round.

TagDownloadCache at 64KTotal
qwen3.5:9b, mimo-v2.6:9b6.6 GB2.1 GB8.7 GB
qwen3.8:27b17.7 GB4.3 GB22.0 GB
qwen3.6:35b-coding22.6 GB1.3 GB24.0 GB
qwen3-coder:30b18.6 GB6.4 GB25.0 GB
devstral-small-215.2 GB10.7 GB25.9 GB
flint-1.124.2 GB1.9 GB26.1 GB

Set those totals against the 25.8 GB a 24 GiB card really holds, before the runtime takes its share. qwen3.8:27b fits with room to spare, and qwen3.6:35b-coding fits on paper with under 2 GB left. qwen3-coder:30b is too tight to trust, and the last two are over.

The order flips between the two columns because of attention design. Devstral keeps a full cache on all 40 of its layers, and Qwen3-Coder on all 48. The Qwen 3.5, 3.6 and 3.8 models keep one on a quarter of their layers and a small fixed state on the rest, and Flint uses a 513-token sliding window on 35 of its 49 layers. That is how a 15 GB download ends up with the largest cache in the table.

The fix for Devstral and Qwen3-Coder is to store the cache at 8 bits. Ollama's FAQ says q8_0 uses about half the memory of f16 (53% by its block format) with a very small loss in precision, and that it needs flash attention, which Ollama turns on where the hardware supports it. It is a global setting, so it applies to every model the server loads.

OLLAMA_KV_CACHE_TYPE=q8_0 \
OLLAMA_CONTEXT_LENGTH=65536 ollama serve

That brings Devstral to about 20.9 GB and Qwen3-Coder to about 22.0 GB. Then load the model, send it a prompt and run ollama ps. PROCESSOR should read 100% GPU and CONTEXT should show the window you set. A split between CPU and GPU means part of the model has moved to system memory, which is the slowdown from the opening. To run the same arithmetic on any pulled model, the script in our best Ollama models guide reads the numbers from /api/show.

What the published coding benchmarks measure

Every benchmark score in this article comes from the publisher of the model, read on its card. That makes them useful for building a shortlist and weak for settling between two finalists. It helps to know what each benchmark asks the model to do.

BenchmarkWhat it measuresExample score
SWE-bench Verifieda patch for a real GitHub issue, checked by running the repo's testsdevstral-small-2 68.0%
SWE-bench Prolonger, multi-file tasks from 41 maintained reposqwen3.8:27b 61.7
Terminal-Bench 2.1end-to-end tasks done in a real terminalflint-1.1 64.5%
LiveCodeBench v6contest problems, collected over timegemma4:31b 80.0%

SWE-bench draws its tasks from real issues in 12 Python repositories, and Verified is a subset of 500 that humans filtered. It is close to agent work, and it is Python only. LiveCodeBench collects problems from LeetCode, AtCoder and Codeforces and dates each one, so a model can be scored on problems published after its training. That makes it a test of algorithm puzzles more than of repositories.

The setup behind a score changes it, and the cards say so. Qwen ran its SWE-bench Pro numbers inside the Claude Code harness with a 256K window, and Recursive ran SWE-bench Verified in mini-swe-agent, averaging five attempts. A 24 GB card at Ollama's default 32K window is a different setup from either.

Versions matter too. Laguna's card reports Terminal-Bench 2.0, Flint and Qwen report 2.1, and the public leaderboard has moved on to 4.1, so scores across versions do not line up.

Quantization is the last gap. Recursive measured a loss of 1.2 points for Flint 1.1 at 4 bits, but that was the NVFP4 format, while the default Ollama tag is q4_K_M. I made the broader case in the letter Do LLM Benchmarks Still Matter?, which argues that a score tells you less than a test on your own work.

Which coding tools work with Ollama, and how to connect them

Ollama serves an OpenAI-compatible API and an Anthropic-compatible API on the same port as its own, so most coding tools connect with a base URL. For the main agents, ollama launch does the wiring for you.

ToolHow to connectWindow note
Claude Codeollama launch claudepasses your explicit window since v0.40.20
OpenCodeollama launch opencodewrites the loaded window into its limits
Codex CLIollama launch codex, or codex --ossat least 64K
VS CodeOllama extension in VS Code Chatset 64K in Ollama's settings
ClineAPI Provider set to Ollamaat least 32K, per Ollama's page
Aideraider --model ollama_chat/<model>sizes the window per request
Continueprovider: ollama in config.yamlautocomplete needs insert

The Claude Code row changed in late November. Since v0.40.20, when you set the window yourself, ollama launch claude tells Claude Code that number for a local model in the standard GGUF builds, so the two sides agree on how much room there is. With the automatic default it still passes nothing, which is one more reason to set OLLAMA_CONTEXT_LENGTH explicitly. The longer story of that mismatch is in our Claude Code with Ollama guide.

OLLAMA_CONTEXT_LENGTH=65536 ollama serve
ollama launch claude --model qwen3.8:27b

In VS Code, Ollama's extension adds your models to the Chat model picker and needs VS Code 1.127 or newer. Its page warns that VS Code may show a model's maximum window while Ollama allocates a smaller one, so set 64K in Ollama's settings and reload the window. Zed and JetBrains IDEs connect through their settings, and JetBrains requires its AI subscription for it.

Aider deserves a word because it solves the window problem on its own side. By default it asks Ollama for a window large enough for each request plus 8K tokens for the reply, and its page recommends the ollama_chat/ prefix over ollama/. Its page still describes Ollama's default window as 2K, which is out of date. The behavior it describes, Ollama dropping what does not fit without a warning, is still how Ollama works.

How to test two models on your own repository

Your git history already contains a benchmark built for you. Find three to five commits that fixed a real bug and added a test for it. Each one gives you a task with a known answer: check out the commit before the fix, describe the bug the way the issue did, and see whether the model's change makes the new test pass.

That is SWE-bench in miniature, on your own code, your own conventions and your own build. Put the bug description in task.md, written the way a colleague would report it, without hints from the fix. This script runs Claude Code headless with each model in its own worktree, hides the test until the agent is done, then runs it.

#!/usr/bin/env bash
# usage: ./trial.sh FIX_SHA TEST_FILE "TEST_CMD" MODEL...
set -u
fix=$1; test_file=$2; test_cmd=$3; shift 3
task=$(cat task.md)
for m in "$@"; do
  dir="/tmp/trial-$(echo "$m" | tr ':/' '__')-$fix"
  git worktree add -q --detach "$dir" "$fix^"
  start=$SECONDS
  (cd "$dir" && ollama launch claude --model "$m" \
    --yes -- -p "$task" --permission-mode acceptEdits \
    --max-turns 40) > "$dir.log" 2>&1
  secs=$((SECONDS - start))
  git -C "$dir" add -A
  stat=$(git -C "$dir" diff --cached --shortstat)
  git -C "$dir" checkout -q "$fix" -- "$test_file"
  if (cd "$dir" && bash -c "$test_cmd") >> "$dir.log" 2>&1
  then r=PASS; else r=FAIL; fi
  echo "$m $r ${secs}s $stat"
done

Run it as ./trial.sh 3f2a91c tests/test_dates.py "pytest -q tests/test_dates.py" qwen3.8:27b devstral-small-2, with the server already started at your window. The flags after -- go straight to Claude Code: -p runs one task and exits, acceptEdits lets it write files without asking, and --max-turns stops a model that is going in circles. Commands that need approval are denied in this mode, so add --allowedTools with your test command if you want the agent to run tests along the way.

Each line of output gives you the model, pass or fail, the time it took and the size of its change. The test file is restored from the fix commit after the agent finishes, so a model that quietly edits the test does not get credit for it.

Then read the two diffs side by side, including the ones that passed. A pass with a 400-line change to fix a three-line bug is a cost you will pay in review every week. The letter The Slot Machine That Codes For You describes exactly that: the code compiled, the tests passed, and the developer had no idea what was in it. Five real bugs and two honest readings will tell you more than any table in this article.

If coding is one of several jobs on your machine, the best Ollama models guide covers chat, reasoning, vision and embeddings by memory size. The Ollama API reference covers /api/generate, /api/show and the rest of the endpoints used here. And the Qwen3.8-27B deployment guide goes deeper on serving the 24 GB pick.

What I'd do

Decide which of the three jobs you need locally, and write down the memory you really have, in Ollama's units. For autocomplete, pull qwen2.5-coder:1.5b, confirm insert in ollama show, and wire it into your editor. For agent work, take the two names from your row of the table, start the server with OLLAMA_CONTEXT_LENGTH=65536, add the 8-bit cache if the arithmetic says you need it, and check ollama ps for 100% GPU. Run the trial script on three fixed bugs, read the diffs, and keep the model whose changes you would merge. Record the winner's tag, window and date where your team will find it; in an AI Operating System that note is part of the setup. The AI OS Course has a lesson on letting an agent like Claude Code work inside your own folder under your rules. If you are building the harness and evals around an agent yourself, the Engineering Series covers it in six courses, with Building Accountable AI Agents on tools, approvals and the journal of what the agent did.

FAQ

What is the best Ollama model for coding in 2026?

For agentic coding, qwen3.8:27b on a 24 GB GPU, mimo-v2.6:9b or qwen3.5:9b on 12 to 16 GB, and qwen3.6:35b-coding or flint-1.1 from 32 GB. For autocomplete, qwen2.5-coder:1.5b. Test two candidates on bugs your own repository has already fixed before you commit to one.

What is the best Ollama model for Claude Code?

Ollama's launch picker recommends qwen3.5 and gemma4 to run locally. With 24 GB, qwen3.8:27b fits at a 64K window with room to spare. Start the server with OLLAMA_CONTEXT_LENGTH=65536, and since v0.40.20 ollama launch claude passes that window to Claude Code for the standard GGUF builds.

What is the best Ollama model for coding with 16 GB of VRAM?

mimo-v2.6:9b or qwen3.5:9b for agent work. Each needs about 8.7 GB with a 64K cache, which leaves room for qwen2.5-coder:1.5b as autocomplete next to it. For chat about code, gemma4:12b at 7.7 to 8.0 GB. Raise the window yourself, because Ollama defaults to 4K under 24 GiB.

Which Ollama models support fill-in-the-middle autocomplete?

Models whose template accepts a suffix, which ollama show lists as insert. Among the tags I checked, that means older code families: qwen2.5-coder, codestral, starcoder2, deepseek-coder-v2 and codegemma:2b or codegemma:code. The newer agent models such as qwen3.8, qwen3-coder and devstral-small-2 do not support it.

How do I use a local Ollama model in VS Code?

Install Ollama's VS Code extension, which needs VS Code 1.127 or newer, open Chat, and choose a model from the Ollama section of the model picker. Set the context length to at least 64K in Ollama's settings and reload the window. For autocomplete, use Continue with provider: ollama and a fill-in-the-middle model.

What is the best Ollama cloud model for coding?

Ollama's launch picker in v0.40.21 still lists four cloud models, older than the newest cloud tags in the library: kimi-k2.6:cloud, qwen3.5:cloud, glm-5.1:cloud and minimax-m2.7:cloud, all with windows of about 200K tokens or more. A cloud model sends your code to Ollama's servers, so decide that per repository before you switch.

That first pick was a strong model. What they were missing was a split by job, and the second number, the memory the window takes once the agent starts reading files.

Choose the job first, then the memory, and let your own git history pick the winner.

Charafeddine MouzouniDecember 6, 2026

The script works. Production is a different sport.

The AI OS letter covers the part tutorials skip: verification, trust, what breaks with real users. One idea, every Saturday, from CM, Cohorte's founder, who has shipped 60+ AI systems.

Free weekly. No spam. Unsubscribe in one click.

Subscribed ✓

The next letter arrives Saturday. Go finish the build.