{"slug": "running-qwen4-35b-a3b-at-1m-context-on-two-radeon-ai-pro-r9700s", "title": "Running Qwen4-35B-A3B at 1M Context on Two Radeon AI PRO R9700s", "summary": "A two-card server built from two AMD Radeon AI PRO R9700 GPUs running radiance 2.5.0 read a 950K-token prompt through Qwen4-35B-A3B in about two minutes, roughly 7,900 tokens per second, according to the author's benchmark post. The author reports prefill of about 11K to 13K tok/s up to 233K tokens, 118 of 120 hidden access codes recalled across six context lengths from 24K to 900K tokens, and that RadixArk's DFlash2 drafter at 3 tokens per pass beat both no drafter and the file's default of 7, delivering 40% more output with one client and 9% more with 16 clients. The author advises leaving the drafter on for very long prompts, where turning it off dropped answer speed to about 50 tok/s from 150.", "body_md": "# Running Qwen4-35B-A3B at 1M Context on Two Radeon AI PRO R9700s\n\nQwen4-35B-A3B came out December 4, and it can take a one-million-token prompt. I wanted to see what\ntwo Radeon AI PRO R9700s in [the six-GPU box](https://doug.sh/posts/six-gpus-one-x16-slot/) could do with\nsomething close to that, so I gave them a 950K-token prompt, roughly 700,000 words. They read the\nwhole thing in about two minutes.\n\nThat’s about 7,900 tokens per second (tok/s). The rest of this post is how they do with shorter\nprompts and more people at once, and the config to [run it yourself](#run-it-yourself).\n\n## The model and the setup [🔗](#the-model-and-the-setup)\n\nQwen4-35B-A3B is a mixture-of-experts model. It has 35 billion parameters and uses about 3 billion per token (the A3B).\n\nThree of every four layers are linear attention, which keeps a fixed-size state instead of a cache that grows with your prompt. The rest are sparse attention, which only looks at the best 512 blocks of four tokens. That’s how a one-million-token context fits on two 32 GB cards.\n\nThe engine is [radiance](https://codeberg.org/StillDeadcode/radiance) 2.5.0 with\n[StillDeadcode’s IQ8R file](https://huggingface.co/StillDeadcode/qwen4-35b-a3b-iq8r-rtn). IQ8R is\nradiance’s name for this 8-bit format, which rounds the weights to 8-bit integers (int8) with no\ncalibration data.\n\nRadixArk’s DFlash2 drafter is merged into the same file. It’s a small model that guesses a few tokens ahead for the big one to check.\n\nThe two cards run as one tensor-parallel server, which splits every layer across both (`tp: 2` in\nthe config, TP2 in the charts). The KV cache, which holds the results of reading tokens, is int8\ntoo.\n\nEach card is capped at 215 W. AMD rates them at\n[300 W](https://www.amd.com/en/products/graphics/workstations/radeon-ai-pro/ai-9000-series/amd-radeon-ai-pro-r9700.html).\n\n## Prefill from 2K to 950K tokens [🔗](#prefill-from-2k-to-950k-tokens)\n\nPrefill is the server reading your prompt. Up to 233K tokens it runs at about 11K to 13K tok/s.\n\nThe two longest prompts (the orange bars) are slower, and they needed the server’s context set to 1M instead of 262K. Shorter prompts ran as fast at 1M as at 262K, so I’d put the slowdown on prompt length.\n\nAt 950K the read took about the same two minutes with the drafter off, but the answer then came out at about 50 tok/s instead of 150. On prompts this long I’d leave it on.\n\n## Recall in long documents [🔗](#recall-in-long-documents)\n\nThe recall test hides 40 five-digit access codes in filler sentences and asks for 8 by name, at low reasoning effort.\n\nIt returned 118 of 120 across six lengths from 24K to 900K tokens. It missed one code at 70K and one at 900K. I ran three documents at each length up to 145K and two at each longer one. With samples this small, I can’t say recall falls with length.\n\nThe drafter was off for the 900K documents and at its default of 7 tokens a pass for the rest. In\nradiance 2.5.0 that default has [an open issue](https://codeberg.org/StillDeadcode/radiance/issues/816),\nwhere it changed greedy output (the model always taking its likeliest token) on 11 of 16 prompts.\n\nI didn’t run 360K or 650K with it off. [A four-card server](#four-cards-two-pairs-against-one-server)\nhas to run with the drafter off, though, and at the three shorter lengths it scored the same or one\ncode better than two cards with it at 7.\n\n## Sixteen clients and the drafter [🔗](#sixteen-clients-and-the-drafter)\n\nAt 7 tokens, the drafter gets you 23% more output with one client than no drafter. With 16 clients it costs you 8% of the total.\n\nAt 3 tokens it beat both other settings at every client count. Against no drafter, that’s 40% more with one client and 9% more with 16. I wouldn’t serve with the file’s default.\n\n## Agent sessions [🔗](#agent-sessions)\n\nA coding agent resends its whole conversation every turn, so its prompt keeps growing. I ran code-reading agent sessions over the radiance source tree, with real tool calls, for five minutes each. Each session grew to about 180K tokens. Nobody graded the answers, so this is cache behavior and speed only.\n\nThe server can skip what it has already read, but only from a saved snapshot of the session’s linear\nattention state. It has a set number of slots for those (`checkpoint-slots`), and I had it at 32.\n\nWith four sessions, 96% of prompt tokens came from cache and the median first token arrived in under a second. With twelve, the cached share fell to 85% and one request waited two and a half minutes for its first token. Twelve sessions were all reading and writing at once, so a long prompt had to share the cards with everyone else’s output.\n\nThirty-two is probably too few for twelve growing sessions. With 128, the cached share came back above 92% and output rose 42%. One request still waited 51 seconds.\n\nFor agents I’d run the drafter at 3 or off. It guesses badly on tool-heavy traffic, at least on this one workload. At 7 tokens it had 17 to 19% of its tokens accepted, and turning it off produced 14% more output with a faster first token. At 3 tokens it had about a third accepted and landed between the two.\n\n## Four cards: two pairs against one server [🔗](#four-cards-two-pairs-against-one-server)\n\nThe merged drafter can’t be split across four cards, so a `tp: 4` server (TP4 in the chart) only\nstarts with it off (`num-speculative-tokens: 0`). Otherwise you get this:\n\n```\nradiance: draft num_key_value_heads = 2 is not divisible by world_size = 4\n```\n\nTwice the cards got you 17% more output at 16 clients than two cards with the drafter off.\n\nPrefill got slower, to about 10,200 tok/s for a 2K prompt and 8,800 for a 233K one. Most of the loss is the exchange between cards, since every layer now waits on four of them.\n\nradiance has a lossy 6-bit wire format for that exchange (`tp-wire: wht6`). It brought prefill back\nto about 10,700 to 11,900 tok/s on prompts up to 125K.\n\nYou can also run four cards as two servers of two, and each pair keeps the drafter. I ran the same clients against both pairs at once, each with the drafter at 3 tokens, and added the totals.\n\nTwo pairs gave about 55% more output at every count. It isn’t a fair fight, since only the pairs had the drafter.\n\nYou give up the one big cache. On four cards, the startup log reports the KV cache pool as 13.9 full-length sessions at 262K tokens, about 3.6 million tokens. On a pair it’s 1.8 at 1M, about 1.9 million, and one pair can’t use the other’s.\n\nSo a conversation has to keep going back to the same pair. For my agents I’d take the pairs and a router that pins sessions.\n\n## What I’d run [🔗](#what-id-run)\n\nFor a few long agent sessions on two cards, I’d set the context to 1M and the drafter to 3 tokens,\nwhich is [the config below](#the-config).\n\nAt 1M I only measured the drafter at 7 and off, so 3 there is my guess. Off was faster in the agent test, but those sessions stopped at about 180K tokens, and at 950K the answer without the drafter came out at about 50 tok/s.\n\nFor lots of short requests, change `max-num-seqs` to 16, `max-model-len` to 262144, and\n`max-num-batched-tokens` to 4096 in the same file. With four cards, run one server per pair, each\nwith its own cards, port, and container name.\n\n## Run it yourself [🔗](#run-it-yourself)\n\nThe two-card 1M config runs in a Docker container with a systemd user unit to keep it up. Every command here was run on 2.5.0.\n\n### What you need [🔗](#what-you-need)\n\n- Two R9700s, 32 GB each. The weights take about 18 GiB a card.\n- Docker, and your user in the `render` and`video` groups.\n- An `amdgpu` kernel driver that supports ROCm 10.1, AMD’s GPU compute stack. You don’t need ROCm installed on the host,\naccording to[radiance’s Docker\nguide](https://codeberg.org/StillDeadcode/radiance/src/branch/main/docs/DOCKER.md) . My box runs\nthe driver that ships with kernel 7.0.6.\n- `amdgpu.cwsr_enable=1` (compute wave save/restore), the driver’s default. It lets the driver pause\nGPU work and resume it later, and with it off the card can hang. radiance refuses to start without it.\nCheck it with`cat /sys/module/amdgpu/parameters/cwsr_enable` .\n- 55 GiB of disk, on a fast drive if you use `ngram-placement: disk` .\n- 3 to 11 GiB of pinned host RAM (it can’t be swapped out) with two cards, plus 19 GiB if you pin the n-gram table in RAM. The config below pins about 23 GiB. The table is a 20-billion-parameter lookup of two- and three-token sequences.\n\n### Pull the image and the model [🔗](#pull-the-image-and-the-model)\n\nWe’ll need the image, the model, and an empty directory for the tuning cache:\n\n```\ndocker pull stilldeadcode/radiance:2.5.0\nhf download StillDeadcode/qwen4-35b-a3b-iq8r-rtn --local-dir ~/models/rad/qwen4\nmkdir -p ~/models/rad-home-qwen4\n```\n\n### The config [🔗](#the-config)\n\nradiance 2.x takes one YAML file. Save this one as `~/qwen4.yaml`:\n\n```\nserver:\n  host: 0.0.0.0\n  port: 8081\n  radiance-home: /opt/radiance/share/radiance:/rad-home\n  keep-alive-timeout: 120\ncards: all\nmodels:\n  qwen4-35b-a3b:\n    aliases: [Qwen4]\n    model: /models/qwen4/qwen4-35b-a3b-iq8r-df2.rad\n    tp: 2\n    max-num-seqs: 4\n    max-model-len: 1048576\n    max-num-batched-tokens: 2048\n    kv-cache-dtype: i8\n    ngram-placement: ram\n    num-speculative-tokens: 3\n```\n\n`host: 0.0.0.0` lets anyone who can reach this machine use the server, and there’s no key. If only this\nmachine calls it, use `127.0.0.1`.\n\n`ngram-placement: ram` copies the 19 GiB n-gram table into pinned host memory at startup, and `disk`\nreads its rows from the model file.\n\nDisk saves you those 19 GiB. It cost about 4 to 5% on long prompts and at 16 clients (753 tok/s\nagainst 781), and about a quarter of prefill speed on a 2K prompt, one run each. `disk` is what I\nrun on my daily server.\n\n`max-num-batched-tokens` is the largest prefill step. At 1M tokens a step of 8192 doesn’t fit, and\n`rad-tune`, the optional tuning step below, defaults to 8192, which is how I found out:\n\n```\nqwen4exp: the QSA score plane would be 8192 MiB -- 8192 rows\n(--max-num-batched-tokens 8192) by --max-model-len 1048576 / compress ratio 4. Lower either.\n```\n\n`num-speculative-tokens: 3` is how many tokens the drafter guesses per pass. At 3,\n[issue 816](https://codeberg.org/StillDeadcode/radiance/issues/816) reports output that matches no\ndrafter.\n\nThe config leaves `checkpoint-slots` automatic, which gave 48 at 1M. If you run many long agent\nsessions at 1M, I’d raise it to 128. That’s what brought the cache hits back for twelve sessions in\nthe agent test, where I set it by hand.\n\n[radiance’s guide](https://codeberg.org/StillDeadcode/radiance/src/branch/main/docs/GUIDE.md) warns\nthat a large automatic count can stall output for tens of seconds on this model. It didn’t with 32\nor 128 set: no request’s output ran below 10 tok/s, and the long waits came before the first token.\n\n### Choose the cards [🔗](#choose-the-cards)\n\nThe container only sees the cards you name in `ROCR_VISIBLE_DEVICES`. ROCr, ROCm’s runtime, numbers the R9700s from 0\nin PCI order, and `rocm-smi --showbus` prints the mapping.\n\nWe’ll keep the Docker flags every radiance command shares in a shell array:\n\n```\nRAD=(\n  --network host\n  --init\n  -e ROCR_VISIBLE_DEVICES=0,1\n  --device /dev/kfd\n  --device /dev/dri\n  --security-opt seccomp=unconfined\n  --ulimit memlock=-1\n  --group-add \"$(getent group render | cut -d: -f3)\"\n  --group-add \"$(getent group video | cut -d: -f3)\"\n  -v \"$HOME/models/rad:/models:ro\"\n)\n```\n\n`seccomp=unconfined` turns off Docker’s default syscall filter, because radiance uses `io_uring`\n(Linux’s fast async disk I/O) and that filter blocks it.\n\n`--check` reads the config and exits:\n\n```\ndocker run --rm \"${RAD[@]}\" \\\n  -v ~/models/rad-home-qwen4:/rad-home:ro \\\n  -v ~/qwen4.yaml:/etc/radiance.yaml:ro \\\n  stilldeadcode/radiance:2.5.0 \\\n  --config /etc/radiance.yaml \\\n  --check\n```\n\n### Tune the kernels (optional) [🔗](#tune-the-kernels-optional)\n\n`rad-tune` benchmarks radiance’s GPU kernels and writes the winners to the cache directory as root (deleting them takes `sudo`). The\nserver runs without it, and I couldn’t measure a gain, so I’d skip it. To run it:\n\n```\ndocker run --rm \"${RAD[@]}\" \\\n  -v ~/models/rad-home-qwen4:/rad-home \\\n  --entrypoint rad-tune \\\n  stilldeadcode/radiance:2.5.0 \\\n  -m /models/qwen4/qwen4-35b-a3b-iq8r-df2.rad \\\n  --home /rad-home:/opt/radiance/share/radiance \\\n  --tp 2 \\\n  --max-seqs 4 \\\n  --max-tok 2048 \\\n  --max-ctx 1048576 \\\n  --kv-cache-dtype i8\n```\n\nThose last five flags have to match the config (`--max-tok` is `max-num-batched-tokens`), and you’ll\nrerun it whenever they change.\n\n### Start the server [🔗](#start-the-server)\n\nThe launcher script needs a directory:\n\n```\nmkdir -p ~/bin\n```\n\nSave this as `~/bin/serve-qwen4.sh`. It repeats the `RAD` array, since a script can’t see your\nshell’s:\n\n``` bash\n#!/usr/bin/env bash\n\nRAD=(\n  --network host\n  --init\n  -e ROCR_VISIBLE_DEVICES=0,1\n  --device /dev/kfd\n  --device /dev/dri\n  --security-opt seccomp=unconfined\n  --ulimit memlock=-1\n  --group-add \"$(getent group render | cut -d: -f3)\"\n  --group-add \"$(getent group video | cut -d: -f3)\"\n  -v \"$HOME/models/rad:/models:ro\"\n)\n\n# Remove a container left over from the last run.\ndocker rm -f qwen4 >/dev/null 2>&1 || true\n\nexec docker run --rm --name qwen4 \"${RAD[@]}\" \\\n  -v ~/models/rad-home-qwen4:/rad-home:ro \\\n  -v ~/qwen4.yaml:/etc/radiance.yaml:ro \\\n  stilldeadcode/radiance:2.5.0 \\\n  --config /etc/radiance.yaml\n```\n\nMake it executable and run it in the foreground:\n\n```\nchmod +x ~/bin/serve-qwen4.sh\n~/bin/serve-qwen4.sh\n```\n\nFrom another terminal, mine answered its health check in about 15 seconds:\n\n```\ncurl -sf localhost:8081/health\n```\n\n### Send a request [🔗](#send-a-request)\n\nThe API is OpenAI-compatible, and the model answers to `qwen4-35b-a3b` or the alias `Qwen4`:\n\n```\ncurl -s localhost:8081/v1/chat/completions \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n  \"model\": \"Qwen4\",\n  \"messages\": [{\"role\": \"user\", \"content\": \"What is 17*23? Answer briefly.\"}],\n  \"max_tokens\": 400,\n  \"chat_template_kwargs\": {\"reasoning_effort\": \"low\"}\n}'\n```\n\nReasoning effort defaults to `high`, and there’s no `medium`. The server says the template “takes\n’low’, ‘high’ and ‘xhigh’; ’none’ and ‘minimal’ turn thinking off”.\n[Qwen’s model card](https://huggingface.co/Qwen/Qwen4-35B-A3B) says `off`, but\n[radiance 2.5.0 rejects that with HTTP 400](https://codeberg.org/StillDeadcode/radiance/issues/829).\n\nA limit this small can come back empty at the default effort, because reasoning can use the\nwhole `max_tokens`. If you see that, raise `max_tokens` or set a lower effort.\n\n### Run it as a service [🔗](#run-it-as-a-service)\n\nWe’ll run it from a systemd user unit, `~/.config/systemd/user/qwen4.service`:\n\n```\n[Unit]\nDescription=Qwen4-35B-A3B on 2x R9700 (radiance 2.5.0, TP2), port 8081\nStartLimitIntervalSec=0\n\n[Service]\nExecStart=%h/bin/serve-qwen4.sh\nExecStop=/usr/bin/docker stop -t 60 qwen4\nExecStopPost=-/usr/bin/docker rm -f qwen4\nRestart=always\nRestartSec=10\nTimeoutStopSec=90\n\n[Install]\nWantedBy=default.target\n```\n\nEnabling it replaces the server you started by hand (the launcher removes its container):\n\n```\nsystemctl --user daemon-reload\nsystemctl --user enable --now qwen4.service\n```\n\n*I had help with this one. Claude set up the server, ran the benchmarks on the box, and helped me\ndraft this post. I read all the words and checked the numbers, so the mistakes are mine.*\n\n## Sources [🔗](#sources)\n\n- [Qwen/Qwen4-35B-A3B](https://huggingface.co/Qwen/Qwen4-35B-A3B) , the model card: layer layout, the 1M-token context, and the reasoning effort levels\n- [vLLM’s Qwen4-35B-A3B launch post](https://vllm.ai/blog/2026-12-04-qwen4-35b-a3b) , the sparse attention block budget\n- [StillDeadcode/qwen4-35b-a3b-iq8r-rtn](https://huggingface.co/StillDeadcode/qwen4-35b-a3b-iq8r-rtn) , the radiance model file\n- [RadixArk/Qwen4-35B-A3B-Dflash2](https://huggingface.co/RadixArk/Qwen4-35B-A3B-Dflash2) , the drafter\n- [radiance](https://codeberg.org/StillDeadcode/radiance) , the inference engine, with the Docker and configuration guides\n- [radiance issue 816](https://codeberg.org/StillDeadcode/radiance/issues/816) , DFlash2 at 7 tokens a pass changing greedy output\n- [radiance issue 829](https://codeberg.org/StillDeadcode/radiance/issues/829) ,`reasoning_effort`` off` returning HTTP 400", "url": "https://wpnews.pro/news/running-qwen4-35b-a3b-at-1m-context-on-two-radeon-ai-pro-r9700s", "canonical_source": "https://doug.sh/posts/qwen4-35b-a3b-r9700-benchmarks/", "published_at": "2026-12-05 00:00:00+00:00", "updated_at": "2026-12-05 17:12:56.006435+00:00", "lang": "en", "topics": ["ai-infrastructure", "large-language-models", "ai-chips"], "entities": ["Qwen4-35B-A3B", "AMD Radeon AI PRO R9700", "radiance 2.5.0", "StillDeadcode", "RadixArk", "DFlash2", "AMD"], "also_reported_by": [], "takeaway": "On two 32 GB Radeon AI PRO R9700s, Qwen4-35B-A3B in radiance 2.5.0 prefills at about 11K-13K tok/s up to 233K tokens and reads a 950K-token prompt in about two minutes at roughly 7,900 tok/s, with the DFlash2 drafter at 3 tokens per pass adding 40% output for one client and 9% for 16.", "recommendation": {"advice": "Set the DFlash2 drafter to 3 tokens per pass instead of the file's default 7 and keep it enabled on very long prompts; the author measured 40% more output with one client and 9% with 16, versus 8% lost at 7 with 16 clients.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/running-qwen4-35b-a3b-at-1m-context-on-two-radeon-ai-pro-r9700s", "markdown": "https://wpnews.pro/news/running-qwen4-35b-a3b-at-1m-context-on-two-radeon-ai-pro-r9700s.md", "text": "https://wpnews.pro/news/running-qwen4-35b-a3b-at-1m-context-on-two-radeon-ai-pro-r9700s.txt", "jsonld": "https://wpnews.pro/news/running-qwen4-35b-a3b-at-1m-context-on-two-radeon-ai-pro-r9700s.jsonld"}}