AI

Local LLMs for Coding: Context Is the Wall, Not the Model

Qwen3-Coder 30B is 19GB of weights, and Ollama’s docs ask coding tools for 64,000 tokens of context. What to set, and what fits.

Code in a dark-mode editor, shown at an angle.
Photo: César Gaviria / Pexels
Reading mode

If you buy through our links, we may earn a commission. It never affects our verdicts or scores — how that works. As an Amazon Associate I earn from qualifying purchases.

If a local model is disappointing you as a coding agent, check its context before you change the model. Ollama starts any machine with under 24 GiB of VRAM at a 4k context, and its own documentation says agents and coding tools “should be set to at least 64000 tokens”, about sixteen times as much.

Ollama documents both halves, on the same page:

VRAM Ollama’s default context Against the 64,000 it recommends for coding
Under 24 GiB 4k about a sixteenth
24–48 GiB 32k half
48 GiB or more 256k four times over

So a machine with a 12GB or 16GB card starts at 4k unless you change it. Ollama’s FAQ gives a flat 4096 tokens rather than the VRAM tiers, but under 24GB the two agree.

Why coding needs more than chat

A chat turn is short. An agent’s turn is not.

Point a coding tool at a repository and the context fills with the file it is editing, the files it opened to understand that one, the output of every command it ran, its own earlier reasoning and the instructions you gave it at the start. Then it carries all of that into the next step.

When the window is full, older material drops out. That tends to look like the model being weak rather than like an error: it forgets the file it just edited, re-reads things, contradicts itself. Ollama’s own Claude Code page puts it as “Choose a model with enough context for your repository.”

Raise it, then check it took

Ollama gives four ways to set the context, and one way to read it back:

Where you run the model How to set 64k
Ollama app the context slider in settings
Server, for every client OLLAMA_CONTEXT_LENGTH=64000 ollama serve
ollama run session /set parameter num_ctx 64000
API call "options": { "num_ctx": 64000 }

Then run ollama ps. The CONTEXT column shows what was allocated, and PROCESSOR shows where the model landed. If raising the context pushed part of it into system RAM, it reads as a CPU/GPU split rather than 100% GPU, and what that split costs in speed is the next thing to weigh.

Ollama is direct about the trade: “Setting a larger context length will increase the amount of memory required to run a model. Ensure you have enough VRAM available.”

The arithmetic that decides your machine

Weights first, because those are published. From Ollama’s library, with the context each tag lists:

Model Weights Listed context
qwen3:8b 5.2GB 40K
qwen3:14b 9.3GB 40K
qwen3-coder:30b 19GB 256K
qwen3:32b 20GB 40K
qwen3-coder:480b 290GB 256K

Two things follow. qwen3-coder:30b is 19GB of weights on a 24GB card before any context is allocated, which leaves roughly 5GB for the 64k Ollama says the job needs. How much 64k costs for that model is not published, and we have not measured it, so ollama ps is the test.

And a smaller model only helps if its window reaches 64k. Ollama lists Qwen3’s 8B, 14B and 32B at 40K, below its own recommendation for coding tools, while both Qwen3-Coder tags list 256K. Check the Context column on a model’s tags page before you plan around it. Qwen 3.6 asks for 128K, twice Ollama’s figure, and its memory needs start from the same place.

What each tier can realistically do

Read this as the shape of the constraint, not a promise. It is our arithmetic from the sizes above, not a measurement:

VRAM Realistic for coding
8GB An 8B model at a small context. Suited to completion and single-file questions more than to an agent.
12–16GB Room for a model up to about 14B with headroom to spend on context, if the model lists a window that large.
24GB A 30B coding model’s weights fit, and 64k of context is tight beside them. The first tier where agentic work is realistic.
48GB+ Ollama’s defaults stop working against you: 256k out of the box.

Claude Code, Codex and other agents on a local model

Ollama documents both. ollama launch claude connects Claude Code to local and cloud models through Ollama’s Anthropic-compatible API, and its page says to “choose a model and set a 64k+ context window” for local models. ollama launch codex does the same for OpenAI’s Codex CLI, with “a context window of at least 64k tokens”. Its integrations list also names Cline, OpenCode, Goose and Roo Code, among others.

Anthropic’s side is different. Its Claude Code documentation says it “doesn’t support routing Claude Code to non-Claude models through any gateway”. So Claude Code on a local model is set up by Ollama’s instructions and is not something Anthropic supports.

What to do

  • Raise the context before you change model. Set 64k, then judge the same model again. It costs nothing to try.
  • Read ollama ps. CONTEXT should show what you set, and PROCESSOR should say 100% GPU.
  • Check the model’s listed context. A tag that lists 40K will not give you the 64k Ollama recommends for coding tools.
  • Buy on total memory, not parameter count. Then split it deliberately between weights and context, as what fits on the card you already own sets out by size.
  • Be honest about your tier. At 8GB, local completion is the realistic job; a local agent is a stretch.

Update, 27 November 2026. We re-read Ollama’s documentation and library today. The VRAM defaults, the 64,000-token recommendation and the 19GB size of qwen3-coder:30b are unchanged. New in this version: the context each model lists, which shows Qwen3’s 8B, 14B and 32B at 40K; every way Ollama documents to set the context; whether Claude Code and Codex can run against a local model, from Ollama’s pages and Anthropic’s; and the questions readers ask.

Questions people ask

Can Claude Code use a local LLM?

Ollama documents it: ollama launch claude connects Claude Code to local models through Ollama’s Anthropic-compatible API, and Ollama asks for a 64k+ context window for them. Anthropic’s own documentation says it “doesn’t support routing Claude Code to non-Claude models through any gateway”, so it runs on Ollama’s instructions, without Anthropic’s support.

What is Ollama’s default context length?

Ollama’s context-length page sets it by VRAM: 4k under 24 GiB, 32k from 24 to 48 GiB and 256k at 48 GiB or more. Its FAQ still says 4096 tokens by default. On a card under 24GB, both come to 4k.

How do I increase the context length in Ollama?

Move the context slider in the Ollama app’s settings, or start the server with OLLAMA_CONTEXT_LENGTH=64000 ollama serve. Inside ollama run, use /set parameter num_ctx; through the API, pass num_ctx in options. Then run ollama ps and read the CONTEXT column.

How much context does a local coding agent need?

Ollama says agents and coding tools should be set to at least 64,000 tokens. Its Codex CLI page asks for at least 64k, and its Claude Code page says 64k or higher for larger repositories.

Does qwen3-coder 30B fit on a 24GB GPU?

Its weights do: Ollama lists qwen3-coder:30b at 19GB, which leaves about 5GB of a 24GB card for context and everything else. Ollama does not publish how much memory 64k of context costs for it, so check ollama ps after raising it: 100% GPU means it still fits.

Why does my local model forget files during a coding task?

A small context window does exactly this. An agent carries files, command output and its own earlier steps from turn to turn, and when the window is full, older material drops out. Under 24GB, Ollama starts at 4k, against the 64,000 tokens it recommends for coding tools.

How we researched this

No one at bitcritiq has handled this product. Everything here comes from published sources, listed below.

What this cannot tell you
The memory cost of a given context length is not published per model and varies with architecture, quantisation and attention design, so this page shows its direction, not its size. bitcritiq has run none of these models and measured no speed or quality. Ollama’s FAQ and its context-length page give different defaults; this page follows the context-length page, which is the more specific, and both come to 4k under 24GB. Ollama does not say what happens when the context you set exceeds the one a model lists. Ollama’s defaults are Ollama’s; llama.cpp and LM Studio set their own.
How we chose this, and what we did
Why this subject
Selected on 27 November 2026 as the page with the most Search Console impressions outside the top ten that had not been refreshed in 21 days. Google Trends for the week to 22 November shows “claude code local llm” up 110% and “ai coding tools” up 60%, with “local llm models” and “best local llm models” rising, so this version adds whether coding agents run against a local model at all, and how to set the context they need.
How we looked at it
Read through a browser on 27 November 2026: Ollama’s context-length page, its Local FAQ, its Claude Code and Codex CLI integration pages, its qwen3-coder and qwen3 tags pages, and the “Other LLM gateways” page of Anthropic’s Claude Code documentation. The context defaults, the 64,000-token recommendation and the 19GB size are unchanged from our 31 August read. The context column in the weights table is new, copied from the same tags pages.

What this rests on

6 claims, all official. Nothing here was measured by bitcritiq — see how we test for why. Open a claim to read the source it came from.

  • Ollama defaults to a 4k context with under 24 GiB of VRAM, 32k from 24 to 48 GiB, and 256k at 48 GiB or more.Official

    Ollama’s context-length page: “< 24 GiB VRAM: 4k context; 24-48 GiB VRAM: 32k context; >= 48 GiB VRAM: 256k context”. Its FAQ separately says “By default, Ollama uses a context window size of 4096 tokens.”

  • Coding tools and agents should be set to at least 64,000 tokens.Official

    Ollama’s context-length page: “Tasks which require large context like web search, agents, and coding tools should be set to at least 64000 tokens.” Its Codex CLI page: “Use a context window of at least 64k tokens for Codex.”

  • qwen3-coder:30b is 19GB of weights and lists a 256K context.Official

    Ollama’s qwen3-coder tags page lists qwen3-coder:30b at 19GB with a 256K context.

  • Ollama lists Qwen3’s 8B, 14B and 32B models with a 40K context, below the 64,000 tokens it recommends for coding tools.Official

    Ollama’s qwen3 tags page: qwen3:8b 5.2GB, 40K; qwen3:14b 9.3GB, 40K; qwen3:32b 20GB, 40K.

  • Ollama documents running Claude Code against local models, and asks for a 64k+ context window for them.Official

    Ollama’s Claude Code page: “Ollama connects Claude Code to local and cloud models through its Anthropic-compatible API” and, for local models, “Choose a model and set a 64k+ context window.”

  • Anthropic does not support routing Claude Code to non-Claude models.Official

    Claude Code’s “Other LLM gateways” page: Anthropic “doesn’t support routing Claude Code to non-Claude models through any gateway.”

Sources 7

  1. Context length — Ollama documentation (opens in a new tab)Officialaccessed Nov 27, 2026
  2. Local FAQ — Ollama documentation (opens in a new tab)Officialaccessed Nov 27, 2026
  3. Claude Code — Ollama integrations (opens in a new tab)Officialaccessed Nov 27, 2026
  4. Codex CLI — Ollama integrations (opens in a new tab)Officialaccessed Nov 27, 2026
Show 3 more · 3 official or standards
  1. Other LLM gateways — Claude Code documentation (opens in a new tab)Officialaccessed Nov 27, 2026
  2. qwen3-coder tags — Ollama model library (opens in a new tab)Officialaccessed Nov 27, 2026
  3. qwen3 tags — Ollama model library (opens in a new tab)Officialaccessed Nov 27, 2026

Pass it on

Know someone weighing this up? Send them the answer.

bitcritiq.com/avv4

The link is permanent: it opens this article for good, even if the title changes.

read next

Hermes Agent: what it needs to run. Nous Research’s MIT-licensed AI agent, from its README and docs, read 16 October 2026. With an API: a cloud provider’s key, or one Nous Portal sign-in. With a local model: Ollama, vLLM, llama.cpp or LM Studio, with at least 64,000 tokens of context. By default: commands run on your machine with no isolation; the docs advise Docker for production. Talk to it from a terminal, Telegram, Discord, Slack and more.
AI · Explainer

Hermes Agent Is Nous Research’s Open-Source AI Agent

It runs on your machine, a server or a cloud sandbox, and uses a cloud API or a local model with at least 64,000 tokens of context.

OpenClaw can run on a local model, from OpenClaw's and Ollama's documentation, read 14 October 2026. Ollama: use the native address; the /v1 address breaks tool calling. LM Studio: its local server at 127.0.0.1:1234, Responses API. llama.cpp: a server OpenClaw manages, chosen in onboarding. Needs: tool calls that work and 64k or more context, per Ollama. Local models skip hosted safety filters, so tighten tool permissions.
AI · Explainer

OpenClaw Runs on a Local LLM via Ollama or LM Studio

OpenClaw's docs also cover llama.cpp, vLLM and any OpenAI-compatible server. Ollama advises 64k context; small models are easier to hijack.

What the free plans cap, and what paid costs. US list prices from each maker’s own page, read 12 October 2026. Grammarly Free: 100 AI prompts a month; paid, $30 a month or $144 a year. QuillBot Free: paraphrases of up to 125 words; paid, $19.95 a month or $99.95 a year. Wordtune Basic: 10 rewrites and AI suggestions a day; paid, $13.99 a month, or $6.99 a month billed yearly. ProWritingAid Free: 10 Rephrases a day, and reports on up to 500 words; paid, $30 a month or $120 a year. Microsoft Editor: basic spelling and grammar; paid, $9.99 a month or $99.99 a year. Cheapest paid plan from each, before tax; Microsoft’s is Microsoft 365 Personal. Not a ranking.
AI · Explainer

Free AI Writing Tools Ration Rewrites in Different Units

Grammarly gives 100 AI prompts a month, Wordtune 10 rewrites a day, QuillBot 125 words a paraphrase. Yearly billing halves most prices.

Specifications