# Best local LLM for coding: which model for 8 to 32 GB of VRAM

Which open-weight model to run Claude Code, Codex or OpenCode on: independent benchmark scores, the memory of each file and its context, the wait for a long prompt, and the setup.

2026-11-28


A coding agent such as Claude Code, Codex or OpenCode can work with an open-weight model on your own graphics card (GPU) in place of a cloud model. Your code then stays on your devices, and a request costs nothing. The agent works through tool calls, sends long instructions with every request and reads whole files, so it asks more of a model and of the graphics memory (VRAM) than a chat does.

This guide shows how the local models score on independent coding tests, which model and file fit your graphics memory with the context an agent needs, how long a long prompt takes, and how to start Claude Code or Codex on a local model. The [sources](#sources) of every number are at the end.

## TL;DR {#tldr}

- **On 24 GB, start with Qwen 3.8 27B.** On Artificial Analysis' index, it scored 20.1, level with Inkling 2 Mini and above every other model that fits a 24 GB card with a long context. It also solved 79.8 percent of Terminal-Bench 2.1. Its 4-bit file takes 17.5 GB, and a context of 65,536 tokens 4.3 GB more.
- **On 32 GB, Nanbeige4.3-33B scored highest of the local models on Terminal-Bench 4.1.** It solved 29.3 percent, against 5.6 for Qwen 3.8 27B. Its context takes much more memory: 7.4 GB at 65,536 tokens with an 8-bit cache, beside a file of 20.8 GB. See [how much memory the context takes](#context).
- **On 16 GB, take Qwen 3.6 35B-A3B at 3 bits.** Its file takes 13.2 GB, and it solved 44.9 percent of Terminal-Bench 2.1, against 13.9 for gpt-oss-20b, which fits the same card.
- **On 8 to 12 GB, take Qwen 3.5 9B.** It takes 5.7 GB and solved 29.2 percent of Terminal-Bench 2.1, but 0.5 percent of 4.1. Give it small changes that are easy to check.
- **Cloud models are far ahead on hard tasks.** On Terminal-Bench 4.1, four current cloud models solved 59 to 65 percent, and the local models 0 to 29. See [local or cloud](#local-or-cloud).

## What does a coding agent need? {#needs}

- **Tool calls.** The agent reads files, edits them and runs commands through tool calls, so the model must be made to use tools. In Explore, in the Hearthscale Server window, an icon on a result shows that the model can use tools.
- **A long context.** Ollama's guides ask for a context of at least 64,000 tokens for Claude Code, Codex and OpenCode, and LM Studio's guide for more than about 25,000 for Claude Code. The agent sends its instructions and the descriptions of its tools with every request, and the conversation grows with each file it reads.
- **Memory for that context.** The context needs memory beside the model's file, from about 1 GB to 14 GB at 65,536 tokens, depending on the model. See [how much memory the context takes](#context).
- **Fast prompt reading.** Before the model writes its first word, it reads the whole request, often 20,000 tokens or more. See [prompt processing speed](#speed).

## Benchmark scores {#scores}

Artificial Analysis tests models independently, each model with the same agent and settings. Three of its tests are about code:

- **Terminal-Bench 4.1**: 66 tasks that an agent does in a terminal, with the mini-swe-agent harness. A task counts only when every test of it passes. The agent sees its whole transcript, with no compaction.
- **FrontierCode-AA 2.0**: 132 changes to real open-source repositories, graded by held-out tests and by a rubric of what a maintainer asks for before a merge. A change that fails a blocking check scores zero.
- **Terminal-Bench 2.1**: an older set of 89 tasks of software engineering, system administration, data processing, model training and security, with the Terminus 2 harness. Artificial Analysis no longer uses it in its index, so newer models have no score.

The index, Intelligence Index v5.0.2, combines nine tests of knowledge work, coding, science and general knowledge. The table shows each model with reasoning on, at the highest effort that Artificial Analysis ran, in percent of tasks solved.

| Model                   | Parameters         | Index | Terminal-Bench 4.1 | FrontierCode 2.0 | Terminal-Bench 2.1 |
| ----------------------- | ------------------ | ----- | ------------------ | ---------------- | ------------------ |
| Ling-3.2-air            | 124B, 5.5B active  | 23.4  | 27.3               | 8.1              | –                  |
| Nanbeige4.3-33B         | 33B                | 20.4  | 29.3               | 10.7             | –                  |
| Inkling 2 Mini          | 26.4B, 3.4B active | 20.1  | 5.6                | 15.1             | –                  |
| Qwen 3.8 27B            | 27B                | 20.1  | 5.6                | 14.9             | 79.8               |
| Muse Glimmer 30B        | 30B                | 6.3   | 0.5                | 1.3              | 51.7               |
| Qwen 3.5 122B-A10B      | 122B, 10B active   | –     | 0.0                | –                | 47.6               |
| Qwen 3.6 35B-A3B        | 35B, 3B active     | –     | 0.0                | –                | 44.9               |
| Gemma 4 31B             | 31B                | 4.4   | 0.0                | 0.0              | 43.4               |
| Gemma 4 26B-A4B         | 25.2B, 3.8B active | 4.0   | 0.0                | 0.0              | 39.0               |
| Qwen3-Coder-Next        | 80B, 3B active     | –     | 0.0                | –                | 38.2               |
| Qwen 3.5 9B             | 9B                 | –     | 0.5                | –                | 29.2               |
| gpt-oss-120b            | 117B, 5.1B active  | 3.8   | 0.0                | 0.0              | 26.2               |
| gpt-oss-20b             | 21B, 3.6B active   | –     | 0.0                | –                | 13.9               |
| Claude Fable 5.2, cloud |                    | 64.8  | 61.6               | 48.8             | –                  |
| GPT-6.2 Astra, cloud    |                    | 62.2  | 64.6               | 45.4             | –                  |
| Gemini 4 Neon, cloud    |                    | 61.5  | 65.2               | 44.4             | –                  |
| Claude Opus 5.5, cloud  |                    | 59.1  | 59.1               | 46.9             | –                  |

A model with "active" parameters is a mixture-of-experts model: it holds all its parameters, but only a part of them computes each token, so it writes about as fast as a small model of that part's size. A dash means that Artificial Analysis has no score.

Three things the scores show:

- **Size alone does not decide.** Nanbeige4.3-33B and Qwen 3.8 27B score above gpt-oss-120b and Qwen 3.5 122B-A10B, which are three to four times their size.
- **The newest tests separate local and cloud models.** Most local models solve none of the tasks of Terminal-Bench 4.1. Nanbeige4.3-33B and Ling-3.2-air are the two that solve more than a quarter.
- **On the older test, the best local models are strong.** Qwen 3.8 27B solved 79.8 percent of Terminal-Bench 2.1, more than any model with closed weights that Artificial Analysis ran on it: the best of those solved 74.2. The four cloud models in the table were not run on it.

Artificial Analysis runs each model through an API provider, not as a 4-bit file on a graphics card. A 4-bit file loses a little quality: see [GGUF quantization explained](/blog/gguf-quantization).

### SWE-bench Verified {#swe-bench}

The SWE-bench team ran many models with one small agent, mini-SWE-agent, on 500 real issues from GitHub repositories. Its newest local models are from December 2025: Devstral Small 2 (24B) resolved 56.4 percent of the issues and Devstral 2 (123B) 53.8, against 76.8 for Claude 4.5 Opus and 75.8 for Gemini 3 Flash, both run in February 2026. gpt-oss-120b resolved 26.0 percent in August 2025.

Mistral's own model card gives Devstral Small 2 68.0 percent on the same test, with its own setup. A score that a model's maker reports is often higher than the same test run by others, so compare models on one independent board.

## Models by VRAM {#memory}

The table gives one model for each size of graphics memory, with its 4-bit file and the memory of a context of 65,536 tokens, the length that Ollama's guides ask for.

| Memory | Model and file               | File    | Context, 16-bit cache | Context, 8-bit cache |
| ------ | ---------------------------- | ------- | --------------------- | -------------------- |
| 8 GB   | Qwen 3.5 9B, Q4_K_M          | 5.7 GB  | 2.1 GB                | 1.1 GB               |
| 12 GB  | Qwen 3.5 9B, Q8_0            | 9.5 GB  | 2.1 GB                | 1.1 GB               |
| 16 GB  | Qwen 3.6 35B-A3B, UD-IQ3_XXS | 13.2 GB | 1.3 GB                | 0.7 GB               |
| 24 GB  | Qwen 3.8 27B, Q4_1           | 17.5 GB | 4.3 GB                | 2.3 GB               |
| 32 GB  | Nanbeige4.3-33B, Q4_K_M      | 20.8 GB | 14.0 GB               | 7.4 GB               |
| 32 GB  | Qwen 3.8 27B, Q4_K_M         | 19.4 GB | 4.3 GB                | 2.3 GB               |

A model also needs some working memory beside the two. The Server's **Load** tab shows the whole amount for the context you set. The files of the 8, 16 and 24 GB rows are the ones that Hearthscale recommended for those sizes on 28 November 2026. To see the current ones, choose the memory of your card on [What AI models can your device run?](/what-can-i-run)

Other models for each size:

- **12 GB with 32 GB of system memory**: Qwen 3.6 35B-A3B, with part of its experts in system memory. It writes more slowly than on a 16 GB card. See [offloading to system memory](#system-memory).
- **24 GB**: Inkling 2 Mini, with a file of 16.6 GB (UD-Q4_K_M), which needs llama.cpp b12549 or later. See [run a coding agent](#steps). Devstral Small 2 fits too (14.3 GB), but its context takes 10.7 GB at 65,536 tokens.
- **96 to 128 GB of system memory**, such as a Ryzen AI Max+ 395 with 128 GB: Ling-3.2-air (80.4 GB at Q4_K_M, 71.1 GB at IQ4_XS), which has the highest index of these local models, or Qwen 3.5 122B-A10B (76.5 GB). See [offloading to system memory](#system-memory).

### How much memory does the context take? {#context}

For each token of its context, a model keeps a key and a value in every layer with full attention. The memory per token is 2 × those layers × the key-value heads × the size of a head × 2 bytes, at 16 bits. The table above is computed this way from each model's published configuration, for 65,536 tokens.

The models differ by ten times:

| Model              | Layers with full attention | Context, 65,536 tokens |
| ------------------ | -------------------------- | ---------------------- |
| Qwen 3.6 35B-A3B   | 10 of 40                   | 1.3 GB                 |
| gpt-oss-20b        | 12 of 24                   | 1.6 GB                 |
| Qwen 3.5 122B-A10B | 12 of 48                   | 1.6 GB                 |
| Qwen 3.5 9B        | 8 of 32                    | 2.1 GB                 |
| gpt-oss-120b       | 18 of 36                   | 2.4 GB                 |
| Qwen 3.8 27B       | 16 of 64                   | 4.3 GB                 |
| Devstral Small 2   | 40 of 40                   | 10.7 GB                |
| Nanbeige4.3-33B    | 52 of 52                   | 14.0 GB                |

The Qwen 3.5, 3.6 and 3.8 models use a cheaper kind of attention in three of every four layers, and gpt-oss looks back only 128 tokens in every second layer. These layers need little memory for the context. Devstral Small 2 and Nanbeige4.3-33B use full attention in every layer, so a long context costs them several times more.

An 8-bit cache takes about half this memory, for a small loss of quality. Choose it on the model's **Load** tab, under **Memory and cache options**. A quantized V cache needs flash attention. See [Load settings](/docs/server/models/settings#load) and the [KV cache](/blog/gguf-quantization#kv-cache).

## Prompt processing speed {#speed}

A coding agent's first request in a session holds its instructions, the descriptions of its tools and your task: often 20,000 tokens or more. The model reads all of it before it writes. Later requests repeat that start, and llama.cpp reuses the part it has already read where it can, so they begin sooner.

The table shows gpt-oss-20b, all of it on the graphics card, reading a prompt of 32,768 tokens with llama.cpp, in tokens per second, and the time that takes. Writing is with an empty context.

| Graphics card                                | Prompt reading | 32,768 tokens take | Writing |
| -------------------------------------------- | -------------- | ------------------ | ------- |
| RTX 5080, 16 GB, February 2026               | 8,625          | 3.8 s              | 249     |
| RTX 4090, 24 GB, March 2026                  | 8,516          | 3.8 s              | 255     |
| RTX 4080 SUPER, 16 GB, August 2025           | 6,740          | 4.9 s              | 187     |
| RTX 5090, 32 GB, August 2025                 | 6,291          | 5.2 s              | 283     |
| RTX 3090, 24 GB, August 2025                 | 3,577          | 9.2 s              | 162     |
| RTX 5060 Ti, 16 GB, August 2025              | 3,078          | 10.6 s             | 112     |
| Radeon AI PRO R9700, 32 GB, March 2026, ROCm | 1,463          | 22.4 s             | 142     |

The results come from different devices and builds of llama.cpp: the two newest results are faster than the RTX 5090 of August 2025. A model with more active parameters reads and writes more slowly. For more cards, see [Local LLMs on NVIDIA GPUs](/blog/local-ai-nvidia-gpu), [on an AMD GPU](/blog/local-ai-amd-gpu) and [on an Intel Arc GPU](/blog/local-ai-intel-gpu).

### Offloading to system memory {#system-memory}

A mixture-of-experts model can keep part of its experts in system memory and the rest on the graphics card. Prompts and writing are then slower, but a model larger than the card's memory runs:

- **RTX 3060 with 12 GB**, Ryzen 7 5700X with 32 GB: gpt-oss-20b with part of the experts of 14 layers in system memory read 16,384 tokens at 1,960 tokens per second, in 8.4 seconds, and wrote 31 tokens per second.
- **RTX 4060 Laptop with 8 GB**, Core i7-14700HX with 64 GB of DDR5: gpt-oss-20b with the experts of 14 layers in system memory read 16,384 tokens at 1,567 tokens per second and wrote 42.
- **RTX 3090 with 24 GB**, Core Ultra 7 265K with 64 GB of DDR5: gpt-oss-120b with the experts of 25 layers in system memory read 32,768 tokens at 673 tokens per second, in 49 seconds, and wrote 27.
- **Ryzen AI Max+ 395 with 128 GB**, on Windows 11 with llama.cpp's Vulkan build: in one person's report, Qwen 3.6 35B-A3B wrote 55 to 62 tokens per second and began to answer a prompt of 22,500 tokens after 28.8 seconds. Qwen 3.5 122B-A10B wrote 23 tokens per second and began after 68.3 seconds.

On the Server's **Load** tab, **Advanced** holds the placement of a mixture-of-experts model. Keep its default unless the model needs another.

## Getting started {#steps}

::::steps
:::step

### Install Hearthscale

[Download Hearthscale](/download) for Windows or Linux and follow the first steps. Hearthscale is free, and you need no account.

:::
:::step

### Download a model that can use tools

Open **Explore** in the Hearthscale Server window and search for the model by name, such as Qwen 3.8 27B. An icon on a result shows that the model can use tools. Under **Download options**, choose a converted version under **Download source**, then the file, and choose **Download**. See [Find and download models](/docs/server/models/explore).

:::
:::step

### Set the context

On the model's **Load** tab, set **Context length** to 65,536 or more. The tab shows how much memory the model then takes. If it does not fit, choose an 8-bit cache under **Memory and cache options**, or a smaller file.

:::
:::step

### Start Claude Code or Codex

Open **Settings → Model API** and turn on **Let programs on this device use your models**. Choose the model on the card of Claude Code or Codex, then **Open in a folder…**, and select your project's folder. Or run `hearthscale launch claude` or `hearthscale launch codex` in that folder. See [Use Claude Code and Codex with your models](/docs/app/extend/coding-tools).

:::
::::

:::figure{caption="Settings → Model API, with Claude Code and Codex each set to a model of this device."}
![Settings → Model API in Hearthscale: the model API is on, with its address and token, two models of this device, and Claude Code and Codex, each set to Qwen 3.5 9B](https://hearthscale.com/shots/model-api-light.webp)
:::

`hearthscale model-api` lists each model with its id, its device and its context in tokens. When a tool starts, Hearthscale gives it the model's context, so the tool compacts the conversation before it grows past that length. OpenCode and other tools that let you set a base URL for OpenAI's or Anthropic's API use the same address and token.

A model that is newer than your build of llama.cpp may not load. Hearthscale 0.5.0 ships llama.cpp b12387, and Inkling 2 Mini, for example, needs b12549 or later. Hearthscale Server checks for new llama.cpp releases once a day: when the llama.cpp card in **Runtime** shows a newer build, choose **Install**. See [Runtime updates](/docs/server/runtime#updates).

The model can run on another of your devices: keep it on a desktop with a large graphics card, and work on your laptop. The tool reads and changes files on the laptop, and only its requests to the model go to the desktop. See [Claude Code and Codex with local models](/claude-code-local-models). In Hearthscale itself, [Ash](/local-ai-agent) works on a repository with the same models.

## Local vs cloud {#local-or-cloud}

- **A local model keeps your code on your devices and costs nothing per request.** It also works with no internet connection, and the usage limits of a cloud plan do not apply.
- **A cloud model solves far more hard tasks.** On Terminal-Bench 4.1, the four cloud models in the table solved 59 to 65 percent and the best local model 29. On FrontierCode-AA 2.0, they scored 44 to 49 percent and the best local model 15.
- **A local model needs more care with tools.** Thinking Machines writes on the card of Inkling 2 Mini that the model may delete or overwrite files without asking for confirmation, and may not report the result of its work accurately. Work in a repository under version control, and review the changes.

You can use both: a local model for private code, small changes and work with no connection, and a cloud model for large tasks. Anthropic supports Claude Code only with Claude models.

## Sources {#sources}

Read on 28 November 2026.

- Artificial Analysis, [leaderboard of models](https://artificialanalysis.ai/leaderboards/models) and [methodology](https://artificialanalysis.ai/methodology/intelligence-benchmarking): Intelligence Index v5.0.2, Terminal-Bench 4.1, FrontierCode-AA 2.0 and Terminal-Bench 2.1, with the reasoning effort of each model as listed there.
- SWE-bench, [leaderboards](https://www.swebench.com/): SWE-bench Verified with mini-SWE-agent, and Mistral's [card of Devstral Small 2](https://huggingface.co/mistralai/Devstral-Small-2-24B-Instruct-2512) for its own result.
- The model cards and configurations on Hugging Face of [Qwen 3.8 27B](https://huggingface.co/Qwen/Qwen3.8-27B), [Qwen 3.6 35B-A3B](https://huggingface.co/Qwen/Qwen3.6-35B-A3B), [Qwen 3.5 9B](https://huggingface.co/Qwen/Qwen3.5-9B), [Qwen 3.5 122B-A10B](https://huggingface.co/Qwen/Qwen3.5-122B-A10B), [Nanbeige4.3-33B](https://huggingface.co/Nanbeige/Nanbeige4.3-33B), [Ling-3.2-air](https://huggingface.co/inclusionAI/Ling-3.2-air), [Inkling 2 Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini), [gpt-oss-20b](https://huggingface.co/openai/gpt-oss-20b), [gpt-oss-120b](https://huggingface.co/openai/gpt-oss-120b) and [Devstral Small 2](https://huggingface.co/mistralai/Devstral-Small-2-24B-Instruct-2512), for the parameters, the layers and heads of the context memory, and Inkling 2 Mini's limits.
- The file sizes, read through the Hugging Face API: [ggml-org/Qwen3.8-27B-GGUF](https://huggingface.co/ggml-org/Qwen3.8-27B-GGUF), [unsloth/Qwen3.8-27B-GGUF](https://huggingface.co/unsloth/Qwen3.8-27B-GGUF), [unsloth/Qwen3.6-35B-A3B-GGUF](https://huggingface.co/unsloth/Qwen3.6-35B-A3B-GGUF), [unsloth/Qwen3.5-9B-GGUF](https://huggingface.co/unsloth/Qwen3.5-9B-GGUF), [unsloth/Qwen3.5-122B-A10B-GGUF](https://huggingface.co/unsloth/Qwen3.5-122B-A10B-GGUF), [bartowski/Nanbeige_Nanbeige4.3-33B-GGUF](https://huggingface.co/bartowski/Nanbeige_Nanbeige4.3-33B-GGUF), [bartowski/Ling-3.2-air-GGUF](https://huggingface.co/bartowski/Ling-3.2-air-GGUF), [unsloth/Inkling-2-Mini-GGUF](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF) and [unsloth/Devstral-Small-2-24B-Instruct-2512-GGUF](https://huggingface.co/unsloth/Devstral-Small-2-24B-Instruct-2512-GGUF).
- llama.cpp, [Running gpt-oss with llama.cpp](https://github.com/ggml-org/llama.cpp/discussions/15396): the results of [RTX 5080](https://github.com/ggml-org/llama.cpp/discussions/15396#discussioncomment-15891976), [RTX 4090](https://github.com/ggml-org/llama.cpp/discussions/15396#discussioncomment-16063223), [RTX 4080 SUPER](https://github.com/ggml-org/llama.cpp/discussions/15396#discussioncomment-14256257), [RTX 5090, RTX 3090 and RTX 5060 Ti](https://github.com/ggml-org/llama.cpp/discussions/15396#discussioncomment-14160169), [Radeon AI PRO R9700](https://github.com/ggml-org/llama.cpp/discussions/15396#discussioncomment-16154887), [RTX 3060](https://github.com/ggml-org/llama.cpp/discussions/15396#discussioncomment-14145339), [RTX 4060 Laptop](https://github.com/ggml-org/llama.cpp/discussions/15396#discussioncomment-14923651) and [RTX 3090 with gpt-oss-120b](https://github.com/ggml-org/llama.cpp/discussions/15396#discussioncomment-15552439).
- llama.cpp, [Strix Halo on Windows 11 with stock llama.cpp Vulkan](https://github.com/ggml-org/llama.cpp/discussions/31839): Qwen 3.6 35B-A3B and Qwen 3.5 122B-A10B on a Ryzen AI Max+ 395 with 128 GB.
- llama.cpp, [Inkling 2 support](https://github.com/ggml-org/llama.cpp/pull/32217) and the [fix of its attention mask](https://github.com/ggml-org/llama.cpp/pull/32429), first in release [b12549](https://github.com/ggml-org/llama.cpp/releases/tag/b12549).
- Ollama's guides for [Claude Code](https://docs.ollama.com/integrations/claude-code), [Codex](https://docs.ollama.com/integrations/codex) and [OpenCode](https://docs.ollama.com/integrations/opencode), LM Studio's [guide for Claude Code](https://lmstudio.ai/docs/integrations/claude-code), and Claude Code's [LLM gateway](https://code.claude.com/docs/en/llm-gateway) page on models other than Claude.
