Best Local Coding Models for a 24 GB GPU

Updated October 14, 2026 · Figures calculated live from our model data

For coding agents on a 24 GB GPU, context length matters as much as model quality. Agents such as Cline, Roo Code, Continue and Aider send 20K–100K tokens of files and history. Qwen 3.6 27B and Qwen 3.6 35B-A3B hold far longer contexts than older 32B models thanks to hybrid attention.

Models compared on 24 GB

Q4_K_M (gpt-oss-20b in native MXFP4). "Max context" is the longest that fits 24 GB with a 6% margin; speed is estimated on an RTX 3090 24GB at 32K context.

ModelVRAM at 8KMax context, FP16 cacheMax context, Q8_0 cacheSpeed
Qwen 3.6 27B16.9 GB98K185K~34 tok/s
Qwen 3.6 35B-A3B21.0 GB88K166K~131 tok/s
Qwen3-Coder 30B-A3B18.8 GB48K90K~93 tok/s
Gemma 4 31B19.8 GB43K89K~29 tok/s
gpt-oss-20b13.9 GB128K128K~144 tok/s
Mistral Small 3.1 24B15.6 GB52K98K~35 tok/s
Qwen 2.5 Coder 32B21.4 GB12K23K~7.4 tok/s

Our picks

  • Best overall: Qwen 3.6 27B. A dense model with strong coding results and room for about 98K tokens of context with an FP16 cache.
  • Fastest: Qwen 3.6 35B-A3B or Qwen3-Coder 30B-A3B. Only about 3B parameters are active per token, so they respond quickly even with long prompts.
  • Alternative: Gemma 4 31B, with a lean cache from sliding-window layers.
  • Most headroom: gpt-oss-20b, small enough to keep its full 128K context with memory to spare.

Why older 32B models struggle with agents

Qwen 2.5 Coder 32B was the local coding favourite, but every one of its 64 layers stores keys and values: 32K of context costs 8.0 GB in FP16. On 24 GB that leaves room for only about 12K tokens. Newer hybrid models need 2.1 GB for the same 32K.

Settings for coding agents

  1. Set the context explicitly to what your agent uses (32K–64K is typical). See Ollama VRAM settings.
  2. Use a Q8_0 KV cache to roughly double the usable context.
  3. Keep one parallel slot; agents send one request at a time.
  4. Prefer Q4_K_M or Q5_K_M over lower quants; small errors compound over multi-step edits.

With 32 GB (RTX 5090 32GB) you can step up to Q6_K or Q8_0 for the same models. With 16 GB, gpt-oss-20b is the strongest choice that fits fully.

Setting up a coding agent with a local model

  1. Run the model as a server: ollama serve, LM Studio's server, or llama-server.
  2. Set the context explicitly. For Qwen 3.6 27B on 24 GB, 64K with an FP16 cache uses 20.4 GB.
  3. In your editor tool (Continue, Cline, Roo Code, Aider), choose the OpenAI-compatible or Ollama provider and point it at the local server.
  4. Match the tool's context setting to the server's, so it does not send more than the model can hold.
llama-server -m Qwen3.6-27B-Q4_K_M.gguf -ngl 99 -c 65536 -fa on \
  --jinja --port 8080

The --jinja flag uses the model's own chat template, which many tool-calling agents need.

Autocomplete is a different job

Tab completion needs very low latency rather than deep reasoning. A small model such as Qwen 3.5 4B or Llama 3.2 3B works better than a 27B model for this. You can run both: a small completion model and a larger chat or agent model, as long as their combined memory fits.

What to expect

Local 27–35B models handle everyday coding tasks well: explaining code, writing functions and tests, refactoring within a file, and fixing clear bugs. They are weaker than the best hosted models at large multi-file changes and long autonomous runs. Using an agent's plan mode, keeping tasks small and giving clear file context makes a big difference.

Speed matters more than you think

Agents make many calls per task. At ~34 tokens/s a long agent run can take minutes; at ~131 tokens/s it feels interactive. Many people use the fast mixture-of-experts model for agent loops and switch to the dense model for harder single questions.

Frequently asked questions

What is the best coding LLM for an RTX 3090 or 4090?

Qwen 3.6 27B for quality, or Qwen 3.6 35B-A3B and Qwen3-Coder 30B-A3B for speed. All fit 24 GB at Q4_K_M with enough context for coding agents.

How much context do coding agents need?

Usually 32K–64K tokens for real projects; some agents use up to 128K. Size your model choice around that, not just the 8K figure.

Can I use a local model with Cline or Continue?

Yes. Both support Ollama and any OpenAI-compatible server such as LM Studio or llama-server. Set the context length on the server to what the tool uses.

What about 16GB GPUs for coding?

gpt-oss-20b fits fully with a long context and is fast. Qwen3-Coder 30B-A3B also works with partial offload thanks to its small active parameter count.

Related