# Running a Local AI Coding Model at 139–170 Tokens/Second on a Radeon

> Source: <https://dev.to/illusiondev/running-a-local-ai-coding-model-at-139-170-tokenssecond-on-a-radeon-4o53>
> Published: 2026-12-05 21:08:51+00:00

**Recommendation:** Size local models to GPU memory plus system RAM, not GPU memory alone, and keep only the active experts and KV cache on the card when serving MoE models.
More in the playbook "Inference and self-hosting": <https://wpnews.pro/playbooks/inference-serving>

I use AI coding assistants all day. Cloud services are fine, but rate limits interrupt flow, and waiting on

round trips gets old when you iterate fast. So I run these assistants on my own computer: no limits, private,

and fast enough to feel like part of the editor.

The reputation of home-run AI — slow, and slowest on AMD graphics cards — is true for a default setup. It is

not true by default. With the right approach, my desktop (a 24 GB Radeon RX 7900 XTX plus a spare NVIDIA card)

runs a large coding model at 139–170 tokens per second. Most of that speed came from four specific changes,

not from buying hardware.

Here is the machine, the easy baseline, what actually moved the number, and the traps.

| Part | What I run | 
|---|---|
| GPU 1 | Radeon RX 7900 XTX 24 GB | 
| GPU 2 | GeForce RTX 4070 12 GB | 
| CPU | Core i5-13600K | 
| RAM | 96 GB DDR5-4800 | 

The system RAM matters more than it sounds. For the models below, RAM is where most of the model lives.

The standard free tool is llama.cpp. Its Vulkan mode works on any graphics card — a small download, no special

toolkit. On both my cards, a 35-billion-parameter coding model (Qwen4-35B) runs at 79–82 tokens/second for

code, with 64K of context (how much text the model can see at once). For many people that is good enough, and

I recommend starting there.

But two things leave speed on the table: AMD's best kernels do not come through this path, and the default

setup ignores what makes these newer models special.

Modern large models are not one brain. They are many small "experts," and for each word, only a handful of

them do the work. (This design is called Mixture-of-Experts, or MoE.)

That changes what you need. You do not need all 35 billion parameters in graphics memory — only the *busy*

experts need to sit close and fast. The quiet ones can live in ordinary system RAM and be fetched when a word

needs them.

That is the whole trick: **keep busy experts on the graphics card, park the rest in RAM.** A 24 GB card can

serve a 35B model because of this.

[Strata](https://github.com/Niko1221/Strata) is a free engine built around this idea. My setup runs a patched

version — the patches, measurements, and tuning work are public:

[llamacpp-tuner](https://github.com/blackhat-7/llamacpp-tuner).

A useful rule from my testing: total size matters less than where the *busy* parts live. The experts a word

actually uses, plus each conversation's working memory, need to sit in fast memory. The rest can live in

system RAM — and with a fast SSD, part of it can even live on disk.

On my machine (24 GB graphics memory + 96 GB RAM):

Less system RAM lowers the ceiling the same way. Size the model to graphics memory + RAM, not graphics

memory alone.

It started with Qwen3.8-Flash-Next — a 125-billion-parameter model that fits on my machine at reduced

precision, with part of its memory kept on disk. Plain llama.cpp gave about 22 tokens/second on the same

file. With tuned settings and my engine patches, it reached roughly 4x that — about 90 tokens/second measured

the way real clients run it — and it became my daily driver for long coding sessions.

Most of the lessons below were learned on that model first.

Generating each token is limited by how fast memory can feed the chip. So I rewrote the low-level GPU programs

(kernels) for the RX 7900's chip — 33 patches in total, mostly kernels and scheduling.

Same model, same cards: 139–170 tokens/second for code. About 2x the easy baseline.

My RTX 4070 drives my monitors and games. But a branch of Strata I maintain lets the engine store a share of

the experts on the NVIDIA card as well — more expert memory without buying a bigger AMD card. That branch is

mine, not merged upstream yet.

Each running chat keeps a memory of everything said so far (the "KV cache"), and that memory fills the

graphics card fast. My fix: finished chats get moved aside and restored when needed — a 189K-token chat comes

back in 3.7 seconds instead of 96. That is what makes several coding agents on one card practical.

AMD ships an inference engine called Loom (open source, part of [ROCm/hrx-system](https://github.com/ROCm/hrx-system)).

With my changes — smaller conversation memory, a faster attention step, better sampling — it runs 29–48%

faster on another model: Inkling-2-Mini at 171/132 tokens/second with over 200K context.

Every speedup in my stack must produce the same output as before (or differ only by rounding), and I measure

at the setting real clients use — temperature 1, which controls how random the output is. Benchmarks run at

temperature 0 with lossy shortcuts overstate speed. I switch off any trick that makes numbers look better but

output worse.

Pooling cards mostly loses. Measured or reported on comparable hardware:

Splitting pays only when the model does not fit one card. Otherwise: one strong card, experts placed well, wins.

Two traps:

One desktop (specs above), one chat, temperature 1, tokens per second (code / prose):

| Model | Engine and cards | tok/s | Context | 
|---|---|---|---|
| Qwen4-35B (Q6_K quant) | Strata + my patches, both cards | 139–170 / 107–110 | 4 chats × 256K, or 1M | 
| Qwen4-35B (Q6_K quant) | llama.cpp Vulkan, both cards | 79–82 / 71 | 64K | 
| Inkling-2-Mini (Q4_K quant) | Loom + my changes, XTX alone | 171 / 132 | 204,800 | 

```
   llama-server -m models/qwen4-35b-Q4_K_M.gguf -ngl 99 -c 32768 -fa on
   # API now live at http://localhost:8080 — point any coding assistant at it
```

One desktop, temperature-1 measurements, code and prose scored separately. Your numbers depend on your memory

speed and your model choice. Nothing here needs exotic hardware — but it does need care about where experts

live, how the math is written, and how you measure.

Home-run coding assistants are not a party trick anymore. A 24 GB Radeon and 96 GB of RAM is a real

development box.

What are you running locally? I am curious whether the expert-placement trick holds up on cards with less

than 24 GB.
