Skip to main content

Qwen4-35B-A3B on 1 x Radeon R9700: 3-bit and 4-bit, up to 500K tokens

By: ElioVP
December 5, 2026
AI performance
Qwen 4 on Radeon R9700: 3-bit, 4-bit and 500K context

After Qwen 3.8 on the R9700, we wanted to get Qwen 4 running on the same card. Qwen4-35B-A3B now runs on a single AMD Radeon AI PRO R9700 with 32 GB of VRAM. We have released both 3-bit and 4-bit weights in one container: vLLM 0.29 on ROCm 10, with the Paiton framework, our own HIP kernels and a drafter we trained further ourselves.

On one card at its 300 W power limit, the 3-bit set reaches 285.7 tok/s for one request and 668.6 tok/s in total across eight. It reads a 23,560-token prompt at 8,940 tok/s and supports a context of up to 499,712 tokens for one request. The 4-bit set is closer to the 16-bit model, with a smaller context window and lower decode speed.

Those speed figures take the better result from two full benchmark passes, one on the last release candidate and one on the final image. They are different workloads: 668.6 tok/s is shared output across eight requests, not the speed of each user or a test of eight 500K conversations. The setup also needs at least 64 GB of system RAM because some model tables stay off the GPU.

In this article

How we measured

We used one R9700 at its 300 W power limit, stock memory clock and PCIe 4.0 x16, with Linux 6.17 and amdgpu 7.1.3. BetterBench 0.6.0 ran its standard profile at temperature 0.7, top-p 0.95 and top-k 20. Every prompt was new to the server, and each run started a fresh server with the release settings.

We ran the full pass twice. Each speed below is the better result from the last release candidate and the final image, not the average of those passes. Thinking was off, the server default. The task scores in the accuracy section used thinking on.

The single-request decode figure combines the median decode speeds of six prompt categories: code, reasoning, prose, JSON, file edits and summaries, weighted 30 / 20 / 15 / 15 / 10 / 10%. The four- and eight-request figures measure total output over the requests in flight.

The published release table reports the final-image pass on its own. For example, it gives 284.9 tok/s for one 3-bit request and 8,797 tok/s for the 23,560-token prompt, compared with 285.7 and 8,940 in the two-pass summary here. The chart data keeps these two summaries separate.

Decode speed

Workload3-bit4-bit
1 request, weighted decode285.7 tok/s230.0 tok/s
4 requests, total output524.5 tok/s475.4 tok/s
8 requests, total output668.6 tok/s618.8 tok/s
Time to first token, short prompt57 ms65 ms

Better of two full passes, thinking off. Single-request weighted decode and multi-request total output are shown separately. Higher is better. The table above includes the corresponding first-token latency.

With 3-bit weights, the drafter proposes five tokens per step for up to four requests, then three tokens per step for five to eight requests. At the higher request count, extra drafts cost more compute than they save. With 4-bit weights it proposes three tokens at every request count; that keeps all eight requests inside the KV cache and gave the highest total output at eight.

Prefill and long prompts

Prefill is the time spent reading a prompt before generating the reply. These are input tokens per second for one request, measured by BetterBench:

Prompt3-bit4-bit
1,528 tokens9,6179,343
5,906 tokens9,3569,138
11,813 tokens9,1299,021
23,560 tokens8,9408,914
47,028 tokens8,9018,747

Prompt tokens per second, higher is better. One R9700 at 300 W, thinking off, better of two full passes. Prompt sizes are actual token counts, not nominal benchmark depth labels.

Prefill changes little from 1.5K to 47K tokens. Thirty of the model's forty layers use linear attention, whose cost per token does not grow with the prompt. The full attention layers read keys and values for at most 2,048 earlier tokens per row.

A 114,004-token prompt reaches its first token after 13.3 seconds on the 3-bit set and 13.6 seconds on 4-bit in the two-pass summary. Generation after a long prompt, again for one request:

Prompt before the reply3-bit4-bit
28,241 tokens212.5 tok/s189.6 tok/s
114,004 tokens225.8 tok/s175.7 tok/s

Context and the KV cache

The default limit is 499,712 tokens for one 3-bit request and 262,144 for one 4-bit request. Context includes the prompt, chat and tool formatting, and the generated reply. A 499,712-token limit therefore does not leave room for a reply after a prompt of that same length.

The ten full attention layers use 8-bit (fp8) KV pages. In our 3-bit capacity test, switching from 16-bit pages increased the available room for a single request from about 321K to 611K tokens before applying the release's context limit. We checked fp8 against 16-bit pages on long documents at 32K and 128K tokens and found no negative log-likelihood difference outside the noise. That is a bounded check, not a guarantee of perfect recall at every context length.

All requests share the cache. Each also needs space for its recurrent state, n-gram convolution and the drafter's window. The available room per request shrinks as more run together:

Requests in flight3-bit, per request4-bit, per request
1499,712 (the limit)262,144 (the limit)
4about 149,328about 93,264
8about 64,872about 36,984

Context capacity, not decode speed or a quality score. Single-request values are the configured limits; four- and eight-request values are approximate shares of available memory. All include input and output tokens.

A request that does not fit waits until others finish. The release's long-prompt test reached its first token after about 65 seconds with a 493,712-token prompt on 3-bit. That is a separate single run near the context limit, not the short-prompt workload behind the headline decode speed.

Accuracy

We compared both weight sets with the bf16 model on 118 chat and agent conversations, covering 169,310 scored tokens. The served model's log-probabilities were compared with a bf16 reference running on an MI355X:

Weight setKL to bf16Same top token as bf16Log-likelihood difference
3-bit0.05990.6%+0.0006, not significant
4-bit0.03592.9%-0.0013, not significant

For scale, the bf16 model differs from itself by a KL of about 0.014 when only the batch layout changes. Lower KL means the probability distributions are closer. The served KL uses the 64 most likely tokens at each position, so it is a lower bound of full-vocabulary KL.

118 conversations and 169,310 scored tokens. Top-64 KL is a lower bound; the bf16 self-comparison gives a reference for numerical variation. The two quantized sets do not produce identical output to bf16.

Prompt log-probabilities do not go through the drafter, so we also ran task tests with it on and off. These tests used thinking on:

Benchmark3-bit, drafter on / off4-bit, drafter on / off
GSM8K (1,319 questions)94.2 / 94.1%93.3 / 94.0%
HumanEval (164 problems)98.8 / 97.0%95.7 / 95.7%
MMLU-Pro (paired subset)84.5 / 84.5%84.2 / 83.8%

Within each weight set, no drafter-on/off difference was statistically significant: every paired 95% interval contains zero and no McNemar p-value is below 0.1. This is a comparison of the drafter settings, not a claim that the quantized models match bf16 on these tasks.

The MMLU-Pro rows cover the questions both arms finished: 1,306 for 3-bit and 1,193 for 4-bit. The drafter-off runs were slower and hit our time limit first, so these are paired subsets, not full MMLU-Pro results.

Fitting the model on a 32 GB card

Qwen4-35B-A3B is a mixture-of-experts model with about three billion parameters active per token. Of its forty layers, thirty use GatedDeltaNet (GDN) linear attention with a recurrent state per request. Every fourth layer uses full attention with the model's own Qwen sparse attention (QSA): an indexer selects up to 2,048 earlier tokens for each new token. Each layer has 256 routed experts, eight active per token, alongside a shared expert.

The per-layer n-gram embedding table (PLE) is too large for the card: 20.5 billion entries, or 41 GB in bf16. We store it in fp8 with a scale per row, about 21.1 GB, in pinned system RAM. For each token, the server gathers sixteen rows of 128 bytes over PCIe. The cost is latency, not bandwidth. The token embedding also stays in system RAM.

3-bit set4-bit set
Routed experts3 bits; down projections of layers 20 to 39 use 4 bits, about 3.29 bits per weight4 bits
Attention, GDN, shared expert and other dense weights8 bits8 bits
Download size41.2 GB44.6 GB
Maximum context for one request499,712 tokens262,144 tokens

The rest of the GPU memory holds the KV cache, recurrent state, captured GPU graphs and their workspace. The download size includes host-resident tables; it is not the amount of VRAM needed.

The drafter

Our small block drafter proposes several tokens from the main model's hidden states. The main model checks them together in one step. We started from a public block drafter for this model and fine-tuned it on our MI355X machine, using the model's own replies to our prompt sets. In our offline check, it gets 6% more accepted tokens per step on agent-style text than the drafter we started with.

Its output head runs in 2 bits, and we cut part of its trunk. Together these changes improved single-request speed by 7.8% in that development test. This is an isolated test, not an extra gain to add to the release numbers above.

The drafter keeps the model's sampling distribution, but a reply can differ token by token from a run without it. Even in greedy decoding, a long reply can diverge because checking drafted tokens adds up numbers in a different order from plain decoding.

Kernels and other work

Native HIP prefill

The GDN and expert prefill paths run in our own HIP kernels. In the development test where we added that work, processing a 23,560-token prompt went from 7,751 to 9,658 tok/s, about 25% faster. It is a different test from the release's two-pass prefill table.

Recurrent state and the output head

The drafter's checking step now reads each request's recurrent state in place, without extra copies. That gave 9% more output at eight requests on the final stack, with the same tokens out. Moving the per-step index copies off the critical path added 7.4% at one request in its own test. These measurements overlap with the released configuration and should not be added together.

The output head, with dimensions 248,320 by 2,048, runs in int8 with one scale per 128 weights, at the same speed as the previous fp8 head.

Compile caches in the image

The image includes compiled kernels and graphs for the default settings. With weights already downloaded, we measured startup at 206 seconds for 3-bit and 201 seconds for 4-bit, with the full KV cache available from the first start.

Changing settings requires compilation first, taking about five to six minutes. That first start also gets a smaller cache; later starts with the same settings reuse the compile cache. These startup times exclude the initial downloads.

Two bugs caught before release

With several prompts in one prefill step, the second prompt read the wrong recurrent-state slot while the drafter was on. Our KL check rose from 0.059 to 0.166 and caught it. A separate stale lookup table in the captured GPU graphs made the n-gram embedding read the wrong previous tokens from the third row onward on short prompts.

After both fixes, prompt log-probabilities with the drafter, without it and in eager mode were bit-equal on prompts of three to three hundred tokens. That is a test of these paths, not a claim that every generated reply will be identical.

Run Qwen 4 on your R9700

You need one 32 GB R9700, Linux with Docker and the amdgpu driver, and 64 GB or more of system RAM. The server keeps about 20 GB of tables in host RAM. Allow about 42 GB of disk for the image, plus 41.2 GB for the 3-bit weights or 44.6 GB for 4-bit, and about 0.3 GB of compile caches per weight set.

git clone https://github.com/Eliovp-BV/paiton-vllm-plugin.git
cd paiton-vllm-plugin
bash models/Qwen4-35B-A3B/run-qwen4-35b.sh                  # 3-bit
# Or start the 4-bit server instead:
bash models/Qwen4-35B-A3B/run-qwen4-35b.sh --weights 4bit

Run one of the two server commands, not both on the same card. The first start downloads the weights and checks each file against its checksum. The OpenAI-compatible API uses port 8000 and model name qwen4:

curl http://localhost:8000/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "qwen4",
    "messages": [{"role": "user", "content": "Write a binary search in Python."}],
    "max_tokens": 512
  }'

The launcher publishes port 8000 on the host. Before allowing other machines to connect, restrict network access and set --api-key as described in the setup guide. The defaults below are the settings we measured; the other flags are opt-in.

OptionWhat it does
--weights 4bitUse 4-bit weights; default is 3-bit
--kv bf16Use 16-bit KV pages; default is fp8, with more context
--max-model-len NSet a shorter context limit per request
--thinking onEnable thinking for requests that do not choose a setting
--gpu 1Use the second R9700 in the machine
--api-key KEYRequire an API key
--dry-runPrint settings and the vLLM command without starting the model server; requires the supported GPU and Docker

To enable thinking for one request, add "chat_template_kwargs": {"enable_thinking": true} to its JSON body. Tool calls use the OpenAI tools field with the release's qwen4 parser.

The measured container is pinned to this digest:

ghcr.io/eliovp/paiton-vllm-plugin:qwen4-35b-a3b-rocm10-vllm029-20261205-r1@sha256:b88fe0129663b84c96869429ef3f0548ed0b70f7b15c569884b4e2be07d45e14

The base Qwen4-35B-A3B model is from the Qwen team. The released quantized weights use Apache 2.0, like the base model; that does not change the separate licensing of the runtime components. The setup uses vLLM, ROCm and Paiton, with BetterBench for the speed measurements.

Known issues

  • This release takes text input only. Image and video input are not supported.
  • Prefix caching is off, so a repeated long prompt is processed again.
  • With thinking off by default, setting reasoning_effort without enable_thinking produces HTTP 400. Send both in chat_template_kwargs, or start with --thinking on.
  • The release notes record one long-prompt pause of 6.5 seconds while the host compacted memory. A long prompt's wait is therefore not guaranteed by the single-run timing above.
  • Concurrent greedy replies can differ from replies generated one at a time because overlapping requests share kernel launches.

What we are working on next

We are working on an opt-in context of up to one million tokens, with older KV data in host memory, first RAM and later disk. It is not in this release.

We also want faster decode with a draft count that adapts to acceptance, faster prefill and more context per user. Session hibernation and exact prefix caching are still planned: parking a conversation in RAM or NVMe, or reusing its unchanged prefix, would save another full read of a long history.

Questions about Qwen 4 on AMD

Can I run Qwen 4.0 35B on an R9700?

This guide covers Qwen4-35B-A3B, the Qwen 4 model discussed here. Both our 3-bit and 4-bit versions run on one Radeon AI PRO R9700 with 32 GB of VRAM, using system RAM for the large embedding tables. You need at least 64 GB of host RAM and the model-specific Paiton launcher above.

Should I choose 3-bit or 4-bit?

Choose 3-bit for the faster decode and larger context window in these tests. The 4-bit version is closer to the bf16 model in our probability comparisons, but it does not guarantee a better answer to every question. Try both on your own work.

Does 500K context mean eight users can each use 500K?

No. The 499,712-token limit is for one 3-bit request, including input and output. Eight active requests share the available memory, with room for about 64,872 tokens each at that request count.

Is this available through regular vLLM?

The published container uses vLLM 0.29 on ROCm 10 with the Paiton plugin and native HIP kernels. These results belong to that configuration; they are not measurements of stock vLLM without Paiton. Existing OpenAI-compatible clients can use its API.

If you run it on your own R9700, we would like to see your numbers. For our other public releases, see Paiton, the Qwen 3.8 work and Inkling 2 Mini on the same card.