{"slug": "running-a-local-ai-coding-model-at-139-170-tokens-second-on-a-radeon", "title": "Running a Local AI Coding Model at 139–170 Tokens/Second on a Radeon", "summary": "A developer running a home setup with a 24 GB Radeon RX 7900 XTX and a 12 GB RTX 4070 reported reaching 139–170 tokens per second on a 35-billion-parameter coding model by keeping only the busy Mixture-of-Experts weights in GPU memory and parking the rest in 96 GB of system RAM. The work, built on the Strata engine with 33 custom GPU kernel and scheduling patches published in the llamacpp-tuner repository, roughly doubled the 79–82 tokens/second achieved by a default llama.cpp Vulkan setup, and a 125-billion-parameter model went from about 22 to roughly 90 tokens/second.", "body_md": "I use AI coding assistants all day. Cloud services are fine, but rate limits interrupt flow, and waiting on\n\nround trips gets old when you iterate fast. So I run these assistants on my own computer: no limits, private,\n\nand fast enough to feel like part of the editor.\n\nThe reputation of home-run AI — slow, and slowest on AMD graphics cards — is true for a default setup. It is\n\nnot true by default. With the right approach, my desktop (a 24 GB Radeon RX 7900 XTX plus a spare NVIDIA card)\n\nruns a large coding model at 139–170 tokens per second. Most of that speed came from four specific changes,\n\nnot from buying hardware.\n\nHere is the machine, the easy baseline, what actually moved the number, and the traps.\n\n| Part | What I run | \n|---|---|\n| GPU 1 | Radeon RX 7900 XTX 24 GB | \n| GPU 2 | GeForce RTX 4070 12 GB | \n| CPU | Core i5-13600K | \n| RAM | 96 GB DDR5-4800 | \n\nThe system RAM matters more than it sounds. For the models below, RAM is where most of the model lives.\n\nThe standard free tool is llama.cpp. Its Vulkan mode works on any graphics card — a small download, no special\n\ntoolkit. On both my cards, a 35-billion-parameter coding model (Qwen4-35B) runs at 79–82 tokens/second for\n\ncode, with 64K of context (how much text the model can see at once). For many people that is good enough, and\n\nI recommend starting there.\n\nBut two things leave speed on the table: AMD's best kernels do not come through this path, and the default\n\nsetup ignores what makes these newer models special.\n\nModern large models are not one brain. They are many small \"experts,\" and for each word, only a handful of\n\nthem do the work. (This design is called Mixture-of-Experts, or MoE.)\n\nThat changes what you need. You do not need all 35 billion parameters in graphics memory — only the *busy*\n\nexperts need to sit close and fast. The quiet ones can live in ordinary system RAM and be fetched when a word\n\nneeds them.\n\nThat is the whole trick: **keep busy experts on the graphics card, park the rest in RAM.** A 24 GB card can\n\nserve a 35B model because of this.\n\n[Strata](https://github.com/Niko1221/Strata) is a free engine built around this idea. My setup runs a patched\n\nversion — the patches, measurements, and tuning work are public:\n\n[llamacpp-tuner](https://github.com/blackhat-7/llamacpp-tuner).\n\nA useful rule from my testing: total size matters less than where the *busy* parts live. The experts a word\n\nactually uses, plus each conversation's working memory, need to sit in fast memory. The rest can live in\n\nsystem RAM — and with a fast SSD, part of it can even live on disk.\n\nOn my machine (24 GB graphics memory + 96 GB RAM):\n\nLess system RAM lowers the ceiling the same way. Size the model to graphics memory + RAM, not graphics\n\nmemory alone.\n\nIt started with Qwen3.8-Flash-Next — a 125-billion-parameter model that fits on my machine at reduced\n\nprecision, with part of its memory kept on disk. Plain llama.cpp gave about 22 tokens/second on the same\n\nfile. With tuned settings and my engine patches, it reached roughly 4x that — about 90 tokens/second measured\n\nthe way real clients run it — and it became my daily driver for long coding sessions.\n\nMost of the lessons below were learned on that model first.\n\nGenerating each token is limited by how fast memory can feed the chip. So I rewrote the low-level GPU programs\n\n(kernels) for the RX 7900's chip — 33 patches in total, mostly kernels and scheduling.\n\nSame model, same cards: 139–170 tokens/second for code. About 2x the easy baseline.\n\nMy RTX 4070 drives my monitors and games. But a branch of Strata I maintain lets the engine store a share of\n\nthe experts on the NVIDIA card as well — more expert memory without buying a bigger AMD card. That branch is\n\nmine, not merged upstream yet.\n\nEach running chat keeps a memory of everything said so far (the \"KV cache\"), and that memory fills the\n\ngraphics card fast. My fix: finished chats get moved aside and restored when needed — a 189K-token chat comes\n\nback in 3.7 seconds instead of 96. That is what makes several coding agents on one card practical.\n\nAMD ships an inference engine called Loom (open source, part of [ROCm/hrx-system](https://github.com/ROCm/hrx-system)).\n\nWith my changes — smaller conversation memory, a faster attention step, better sampling — it runs 29–48%\n\nfaster on another model: Inkling-2-Mini at 171/132 tokens/second with over 200K context.\n\nEvery speedup in my stack must produce the same output as before (or differ only by rounding), and I measure\n\nat the setting real clients use — temperature 1, which controls how random the output is. Benchmarks run at\n\ntemperature 0 with lossy shortcuts overstate speed. I switch off any trick that makes numbers look better but\n\noutput worse.\n\nPooling cards mostly loses. Measured or reported on comparable hardware:\n\nSplitting pays only when the model does not fit one card. Otherwise: one strong card, experts placed well, wins.\n\nTwo traps:\n\nOne desktop (specs above), one chat, temperature 1, tokens per second (code / prose):\n\n| Model | Engine and cards | tok/s | Context | \n|---|---|---|---|\n| Qwen4-35B (Q6_K quant) | Strata + my patches, both cards | 139–170 / 107–110 | 4 chats × 256K, or 1M | \n| Qwen4-35B (Q6_K quant) | llama.cpp Vulkan, both cards | 79–82 / 71 | 64K | \n| Inkling-2-Mini (Q4_K quant) | Loom + my changes, XTX alone | 171 / 132 | 204,800 | \n\n```\n   llama-server -m models/qwen4-35b-Q4_K_M.gguf -ngl 99 -c 32768 -fa on\n   # API now live at http://localhost:8080 — point any coding assistant at it\n```\n\nOne desktop, temperature-1 measurements, code and prose scored separately. Your numbers depend on your memory\n\nspeed and your model choice. Nothing here needs exotic hardware — but it does need care about where experts\n\nlive, how the math is written, and how you measure.\n\nHome-run coding assistants are not a party trick anymore. A 24 GB Radeon and 96 GB of RAM is a real\n\ndevelopment box.\n\nWhat are you running locally? I am curious whether the expert-placement trick holds up on cards with less\n\nthan 24 GB.", "url": "https://wpnews.pro/news/running-a-local-ai-coding-model-at-139-170-tokens-second-on-a-radeon", "canonical_source": "https://dev.to/illusiondev/running-a-local-ai-coding-model-at-139-170-tokenssecond-on-a-radeon-4o53", "published_at": "2026-12-05 21:08:51+00:00", "updated_at": "2026-12-05 21:14:44.324772+00:00", "lang": "en", "topics": ["ai-infrastructure", "large-language-models", "ai-tools", "mlops", "developer-tools"], "entities": ["Strata", "llama.cpp", "AMD", "Radeon RX 7900 XTX", "NVIDIA", "GeForce RTX 4070", "Qwen", "llamacpp-tuner"], "also_reported_by": [], "takeaway": "Keeping only the busy MoE experts and KV cache in GPU memory while parking idle experts in system RAM, plus custom AMD kernels, took a 35B coding model from 79–82 to 139–170 tokens/second on a 24 GB RX 7900 XTX.", "recommendation": {"advice": "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.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/running-a-local-ai-coding-model-at-139-170-tokens-second-on-a-radeon", "markdown": "https://wpnews.pro/news/running-a-local-ai-coding-model-at-139-170-tokens-second-on-a-radeon.md", "text": "https://wpnews.pro/news/running-a-local-ai-coding-model-at-139-170-tokens-second-on-a-radeon.txt", "jsonld": "https://wpnews.pro/news/running-a-local-ai-coding-model-at-139-170-tokens-second-on-a-radeon.jsonld"}}