# Serving Qwen3.8-27B on a Radeon AI PRO R9700 is not a one-liner

https://akougkas.io/journal/2026/serving-qwen38-27b-on-a-radeon-ai-pro-r9700/

Author: Anthony Kougkas

Published: 2026-09-08

The same GGUF file, on the same card, decodes at 27 tokens per second or at 46. Nothing about the model changed between those two numbers. What changed were a handful of server flags that most “run a local model” guides never mention, and the right values depend on who is on the other end of the socket.

This note is about `Qwen/Qwen3.8-27B` in Unsloth’s IQ4_NL quantization, served by llama.cpp on an AMD Radeon AI PRO R9700 with 32 GB of VRAM. I run it under [PanCode](https://akougkas.io/work/pancode/), and a coding agent is a demanding client. It ships 10k to 100k tokens of files per turn, so prefill matters as much as decode, and it runs several workers at once, so slots and how they share the KV cache matter. A person chatting needs one slot, short prompts, and fast decode. Several of the choices below come out differently for the two, and one that I expected to differ did not.

Everything here was measured on 2026-09-08 unless I say otherwise.

## Prerequisites

- An RDNA4 card with 32 GB. Mine is a Radeon AI PRO R9700 (Navi 48, gfx1201, 32624 MiB usable, 640 GB/s) in a Ryzen 7 5700X3D box with 8 cores, Ubuntu 24.04.4 and the 6.17 OEM kernel. A 24 GB card works with the recipe near the end.
- ROCm 7.2.4 from the legacy `amdgpu-install` line, with amdgpu 30.20.1 DKMS. For the Vulkan comparison, AMDVLK 2025.Q2.1, which is end of life and held in apt.
- llama.cpp tag b10687 (commit c841aee, 2026-08-29), built twice as single-backend binaries: one HIP build with `-DGGML_HIP=ON -DGPU_TARGETS=gfx1201 -DGGML_HIP_NO_VMM=ON`, and one Vulkan build. The server runs in router mode from a preset file, one router process with a worker binary per model.
- The model files from `unsloth/Qwen3.8-27B-GGUF`: `Qwen3.8-27B-IQ4_NL.gguf` (15.21 GiB, 288 IQ4_NL and 113 Q5_K tensors) with the MTP `nextn` layer included as blk.64 (mostly Q4_K, with `nextn.eh_proj` in Q8_0), and `mmproj-F16.gguf` (0.9 GiB) for vision. The quality alternate is UD-Q6_K at 20.46 GiB.
- Sampling from the official model card’s thinking mode: temperature 1.0, top-p 0.95, top-k 20, min-p 0, presence penalty 0, repeat penalty 1.0. Every measurement here uses those values, including the production preset, which keeps them and only turns thinking off by default. The card’s non-thinking values (temperature 0.7, top-p 0.8, presence penalty 1.5) are an alternative I did not run.
- For the laptop section: a Strix Halo machine (Ryzen AI Max+ PRO 395, Radeon 8060S, gfx1151, 128 GB unified memory) on Windows 11 with Lemonade 11.9.0, which bundles a ROCm llama-server (TheRock 7.14 runtime, b10711) and a Vulkan one (b10723).

## What the model actually is

The GGUF metadata explains most of what follows. Qwen3.8-27B has 64 layers with `full_attention_interval = 4`: 16 full-attention layers and 48 Gated DeltaNet layers, and the attention layers have 4 KV heads with a 256 head dimension. Only the attention layers keep a KV cache, so a full 131k context costs about 7.2 GiB at f16, roughly 55 KB per token, 3.6 GiB at q8_0 (measured as the f16 minus q8_0 allocation delta), and 1.9 GiB at q4_0. Those are loaded allocations, not estimates. That cheapness is what makes four slots at 131k possible on one card.

The GGUF also carries the model’s own multi-token prediction head, the `nextn` layer, which llama.cpp can use as a speculative drafter with `--spec-type draft-mtp`. It is the single biggest lever in this note.

I cap the context at 131072 on purpose. llama.cpp issue 27756 reports this hybrid emitting an instant end-of-sequence beyond roughly 130k positions on both CUDA and CPU, so a larger window is a window the model cannot use.

## The bandwidth wall

Start with `llama-bench` on the HIP build, one stream, flash attention on, q8_0 KV, a 2048-token prompt and 512 generated tokens:

```
llama-bench -m /path/to/Qwen3.8-27B-IQ4_NL.gguf \
  -ngl 99 -fa 1 -ctk q8_0 -ctv q8_0 -p 2048 -n 512
```

Prefill is pp2048 and decode is tg512, both in tokens per second. Five Unsloth quantizations of the same model:

| quant | GiB | prefill t/s | decode t/s |
| --- | --- | --- | --- |
| IQ4_NL | 15.21 | 1287 | 29.8 |
| UD-Q4_K_XL | 16.34 | 1151 | 26.7 |
| UD-Q5_K_M | 18.40 | 946 | 24.5 |
| UD-Q5_K_XL | 19.43 | 904 | 23.9 |
| UD-Q6_K | 20.46 | 821 | 23.2 |

Decode scales approximately inversely with file size. IQ4_NL is 15.21 GiB, which is 16.33 GB; multiply by 29.8 tokens per second and you get about 487 GB/s of effective bandwidth, about 76% of the card’s 640 GB/s. Single-stream decode on a dense model reads the whole file once per token, and no kernel setting moves that number.

I measured the settings people recommend against the IQ4_NL baseline and every one landed within about 3%: llama.cpp b10850 instead of b10687 (1275 prefill, 30.5 decode), `GGML_CUDA_FORCE_MMQ=1` (1259), `GGML_CUDA_FORCE_CUBLAS=1` (1262), `ROCBLAS_USE_HIPBLASLT=1` (1246), a micro-batch of 1024 (1291) or 2048 (1270). The hybrid “dead band” reported for this architecture did not show up: tg128 was 29.99 and tg512 was 29.81. At 16k of depth the card still prefills at 755 and decodes at 26.6.

ROCm 10 came out on 2026-08-26, the first major version built on TheRock. I measured it on 2026-09-08 through Lemonade’s prebuilt ROCm 10.1 bundle: 1213 prefill and 30.1 decode, so prefill 6% lower and decode within 1% of ROCm 7.2.4. For llama.cpp on gfx1201, the ROCm version is not a lever.

## Pick the backend for the workload

The same IQ4_NL file through the HIP and Vulkan builds:

| backend | prefill t/s | decode t/s |
| --- | --- | --- |
| HIP (ROCm 7.2.4) | 1287 | 29.8 |
| Vulkan (AMDVLK 2025.Q2.1) | 239 | 32.9 |

In the bench harness Vulkan decodes 10% faster and prefills 5.4 times slower on this dense model. For a coding agent that hands over tens of thousands of tokens of source before asking a question, the prefill gap is the whole latency budget, and HIP wins outright. The obvious reading of the decode column is that Vulkan should still be the chat backend, where prompts are short and decode is the whole experience. I believed that until I measured it through a server.

The chat profile is one slot, a 600-token prompt, 32k context, q8_0 KV, the same IQ4_NL file, through the same standalone `llama-server`:

| backend, drafter | decode t/s | accept | prefill t/s |
| --- | --- | --- | --- |
| Vulkan, none | 23.8 / 23.4 |   | 205 |
| Vulkan, MTP draft 2 | 20.9 / 28.0 | 61% | 74 |
| HIP, MTP draft 2 | 54.3 / 47.5 | 77% | 710 |

The 10% raw-decode edge does not survive a real server. Vulkan without speculation lands at 23.8, below its own bench number, and adding MTP on the AMDVLK path is a net loss: batched draft verification is slow there, so acceptance of 61% buys nothing and prefill falls to 74 tokens per second. HIP with MTP decodes at about twice Vulkan’s best in the same profile. On this dense model, HIP plus MTP wins for chat as well as for agents, by roughly two to one, and the decision is not a workload question at all.

Vulkan stays a mixture-of-experts choice on this card. On Ornith-35B-A3B, AMDVLK decodes at twice HIP’s rate (168 versus 83 tokens per second), which is why my router runs dense models on the HIP worker and MoE models on the Vulkan worker.

## The drafter

The bandwidth wall bounds how many tokens come out of one read of the weights. Speculative decoding gets more than one: a cheap drafter proposes a few tokens and the big model verifies them in a single batched pass. Qwen3.8-27B ships its own drafter in the MTP head, so the questions are how deep to draft and whether a separate drafter does better.

These runs go through a real `llama-server`: a 131k unified KV pool shared by four slots, a 12k-token prompt, 512 generated tokens, and the thinking-mode sampler at temperature 1.0. Where two decode numbers appear, they are two measurements of the same configuration.

| config | VRAM MiB | decode t/s | accept | prefill t/s |
| --- | --- | --- | --- | --- |
| no speculation | 21896 | 27.1 |   | 1031 |
| MTP draft 2 (chosen) | 24054 | 46.2 / 43.0 | 66% | 979 |
| MTP draft 3 | 24651 | 41.9 / 46.0 | 47% | 972 |
| MTP draft 4 (old preset) | 25249 | 40.0 / 37.6 | 41% | 971 |
| DFlash2 Q8_0, n 7 | 28755 | 33.4 / 29.2 | 31% | 739 |
| DFlash2 Q8_0, n 5 | 27557 | 36.8 / 36.3 | 37% | 810 |
| DFlash2 Q4_K_M, n 5 | 26686 | 43.7 / 39.6 | 44% | 880 |
| UD-Q6_K, MTP draft 2 | 29133 | 38.2 / 33.0 | 77% | 682 |

The MTP head is free and it is the biggest win available. It ships inside the GGUF, its draft context costs 2.1 GiB of VRAM, and it takes single-stream decode from 27 to 46 tokens per second.

Tune the draft depth with the sampler you will actually run. Two weeks earlier I had swept this at temperature 0 and settled on draft 4 at 87% acceptance. Under the real thinking-mode sampler, draft 4 accepts 41% and draft 2 wins.

DFlash2 (a block-diffusion drafter from incoai, supported in b10687) is slower than MTP at every setting on this stack, costs 15 to 28% of prefill, and takes 5 to 7 GiB of VRAM out of the KV budget. The published 3.43 times speedup was measured on CUDA with GSM8K prompts. On a long-context summarize-then-code task with sampling, acceptance is 31 to 44%.

Under four concurrent streams, speculation buys almost nothing. “Four-way cached” means the four 12k prompts were prefilled first and then decoded together; the numbers are aggregate throughput:

| config | 4-way cached t/s |
| --- | --- |
| no speculation | 47.5 |
| MTP draft 2 | 53.2 |
| MTP draft 3 | 53.6 |
| UD-Q6_K, MTP draft 2 | 39.7 |

The GPU is already saturated by the batch. Speculation buys latency when the device is idle and costs compute when it is not, so it helps the one worker waiting on a reply and does little for four running at once.

Firing four uncached 12k prompts at once collapses each stream to 5 to 19 tokens per second while prefill chunks interleave with decode. That is continuous batching working as designed, and in an agent loop the prompt cache hides it because most of each turn’s prompt is the previous turn’s.

## KV cache type

With IQ4_NL, MTP draft 2, 131k of unified context and four slots, the KV cache type changes memory and nothing else:

| KV type | VRAM MiB | decode t/s | 4-way t/s | headroom MiB |
| --- | --- | --- | --- | --- |
| q4_0 | 22326 | 43.3 / 45.0 | 54.1 | 10107 |
| q8_0 | 24054 | 46.2 / 43.0 | 53.2 | 8377 |
| f16 | 27668 | 44.9 / 45.1 | 56.4 | 4758 |

All three are within noise on speed. The KV type is purely a trade of memory for quality on this card, so the rule is simple: spend headroom on f16 KV before anything else, and quantize the cache only when the alternative is dropping context or slots. My default preset carries f16 KV on IQ4_NL, which leaves 4758 MiB of headroom, about 4.6 GiB. UD-Q6_K runs q8_0 KV instead: f16 at 131k does load, but with 41 MiB to spare (32543 MiB resident), and even at 96k it leaves only 1993 MiB. Neither is a margin I want under a compute graph, so the Q6_K preset takes the q8_0 cache.

## The preset I run

This is the `[qwen3.8-27b-dense]` block from the router’s preset file on the machine that serves PanCode:

```
[qwen3.8-27b-dense]
model = .../Qwen3.8-27B-IQ4_NL.gguf
mmproj = .../mmproj-F16.gguf
ctx-size = 131072
kv-unified = true
parallel = 4
cache-type-k = f16
cache-type-v = f16
flash-attn = true
batch-size = 2048
ubatch-size = 512
spec-type = draft-mtp
spec-draft-n-max = 2
n-gpu-layers-draft = 99
temperature = 1.0
top-p = 0.95
top-k = 20
min-p = 0
presence-penalty = 0
repeat-penalty = 1.0
jinja = true
reasoning = off
reasoning-effort = high
chat-template-kwargs = {"enable_thinking": false, "preserve_thinking": true}
ctx-checkpoints = 64
checkpoint-min-step = 1024
sleep-idle-seconds = 300
```

Unified KV makes the 131k context one pool shared by the four slots, so any single request may use all of it and slots do not multiply the allocation. The checkpoint pair saves the recurrent state of the DeltaNet layers at intervals, which is what lets prompt-cache reuse work on a hybrid at all. `sleep-idle-seconds` unloads the worker after five idle minutes so the card is free for whatever else the router serves.

Through the production router with this preset (f16 KV, thinking off), a cold 12k prompt decodes at 47.5 tokens per second single-stream with 67% draft acceptance and 892 tokens per second of prefill. Four cached streams give 47.7 tokens per second aggregate, 20 to 22.5 per stream. Those two numbers measure different things. Per-stream is the decode rate one stream sees while all four generate. The aggregate divides every generated token by the wall time of the whole four-request batch, including the prompt work the cache did not cover, which is why 47.7 aggregate coexists with 20 to 22.5 per stream. The server sits at 27526 MiB resident with 5098 MiB of headroom, and its log confirms `n_slots = 4, n_ctx_slot = 131072, kv_unified = true`. An earlier run of the same recipe with q8_0 KV gave 44.0 single-stream at 61.5% acceptance, 966 prefill, 51.7 aggregate, and 24157 MiB resident, which is the q8_0 row of the KV table seen through the router rather than the bench harness.

One caution about that comparison. The preset keeps the thinking-mode sampler values (temperature 1.0, top-p 0.95, top-k 20) and only turns thinking off by default, so the production runs and the sweeps above share a sampler. What differs is whether the model emits reasoning before its answer, and acceptance moves with the text being drafted, so the two sets of numbers are close but not the same experiment. The model card’s non-thinking sampler is an alternative, not what runs here.

Thinking is off in the preset and turned on per request. I checked: by default `reasoning_content` comes back empty, and the same question with `chat_template_kwargs` set to `{"enable_thinking": true, "reasoning_effort": "low"}` returns about 110 to 120 characters of reasoning. When a request enables thinking without naming an effort, `reasoning-effort = high` in the preset is the server default. In an OpenAI-compatible body, `chat_template_kwargs` accepts `enable_thinking` (true or false), `reasoning_effort` (low, medium, high, or xhigh; on this model high is an alias of xhigh), and `preserve_thinking` (true or false).

Vision goes through the same endpoint: send an `image_url` content part and the projector loaded next to the model handles it. I verified it on both presets with a generated 128 px PNG of a red circle. The IQ4_NL model described one round shape; the Q6_K model described one red circle.

The preset file carries a second section, `[qwen3.8-27b-dense-q6]`, for UD-Q6_K with the same recipe and q8_0 KV. It sits at 29199 MiB resident with 3.4 GiB of headroom and decodes at 33 to 38 tokens per second single-stream, with 77% draft acceptance and 682 tokens per second of prefill. That is the quality option: about 10 tokens per second slower and a 20 to 30% slower prefill for the larger weights.

## Fitting it on 24 GB

If your card has 24 GB rather than 32, the same recipe fits with a few deliberate cuts. The resident components measured on the R9700:

| component | MiB |
| --- | --- |
| IQ4_NL weights | 15575 |
| mmproj-F16 | 885 |
| MTP draft context | ~2160 |
| compute buffers, recurrent state | ~1800 |
| KV at 131k, f16 | ~7200 |
| KV at 131k, q8_0 | ~3600 |
| KV at 131k, q4_0 | ~1900 |

A 24 GB card has 24576 MiB. Leave 1500 for fragmentation and the compute graph and about 23000 is usable. Weights, projector, MTP, and buffers come to 20420, which leaves 2580 for the KV cache: 131k does not fit at f16 or q8_0, and q4_0 at 1900 fits with almost nothing to spare.

The drop order that keeps the agent use case intact:

1. KV f16 to q8_0. Saves 3.6 GiB at 131k and costs nothing in speed.
2. Context 131k to 64k. Halves the KV again.
3. The projector, if you do not need vision. 0.9 GiB.
4. MTP last. It is worth 19 tokens per second of decode and nothing else in the list is.

The concrete 24 GB recipe for an agent: IQ4_NL, MTP draft 2, q8_0 KV, 64k unified context, 2 slots, projector optional. Expect about 21.5 GiB resident and the same 44 tokens per second single-stream, provided the bandwidth matches. An RX 9070 XT is 640 GB/s like the R9700; a 7900 XTX is 960 GB/s and will decode faster.

For chat only on 24 GB: the HIP build, 1 slot, 32k context, MTP draft 2, q8_0 KV. That is the chat profile measured above, and it decodes at 47.5 to 54.3 tokens per second on the R9700. Do not reach for Vulkan on a dense model here; the chat table shows why.

Do not go below IQ4_NL for speed. UD-IQ4_XS (13.27 GiB) gains about 6% decode for a quality drop that is not worth it.

## Strix Halo laptops

The other machine this model has to run on is a Strix Halo laptop: a Ryzen AI Max+ PRO 395 with the Radeon 8060S (gfx1151) and 128 GB of unified memory, on Windows 11 with Lemonade 11.9.0. Unified memory changes the question. Context is not the constraint there, since 131k of KV is a rounding error in 128 GB. Bandwidth is the constraint, at about 256 GB/s, so the MTP head matters even more than on the desktop card.

The profile: `unsloth/Qwen3.8-27B-GGUF` in UD-Q4_K_XL with the projector, 131k context, one slot, 12k-token prompts, thinking off, the same sampler. Lemonade offers two llama.cpp backends, ROCm (TheRock 7.14 runtime, llama-server b10711) and Vulkan (b10723), and I measured both through its server on 2026-09-08.

| backend, drafter | decode t/s | accept | prefill t/s |
| --- | --- | --- | --- |
| Vulkan, none | 10.1 |   | 53 |
| Vulkan, MTP draft 2 | 14 to 18 | 72% | 118 |
| ROCm, none | 9.9 |   | 169 |
| ROCm, MTP draft 2 | 12 to 14 | 54 to 78% | 205 to 230 |
| ROCm, MTP draft 4 | 10.2 | 38% |   |
| ROCm, MTP draft 6 | 7.7 | 24% |   |

The ROCm rows needed a fix before they existed. At the default micro-batch of 512, and again at 384, the ROCm llama-server crashed on every prompt past about 3k tokens. Lemonade’s watchdog reset the process and returned HTTP 500 to the client. Short prompts never triggered it, so the deployed configuration had looked healthy for as long as nobody sent it a real agent turn. With `-b 512 -ub 256` the ROCm backend works, and those are the numbers in the table. Two slots made the second MTP stream misbehave, so the laptop runs one.

The conclusion splits by workload in a way the R9700 did not. ROCm wins agent turns because its prefill is about two to three times Vulkan’s: a 12k prompt plus 256 generated tokens takes about 80 seconds on ROCm and about 120 on Vulkan. Vulkan wins short chat on decode alone. Draft depth follows the same rule as the desktop: 2 is the right number under this sampler, and 4 or 6 lose acceptance faster than they gain tokens.

The saved Lemonade options are now ROCm, 131072 context, MTP draft 2, one slot, and the micro-batch fix:

```
lemonade load Qwen3.8-27B-GGUF --llamacpp rocm --no-merge-args \
  --ctx-size 131072 \
  --llamacpp-args "--spec-type draft-mtp --spec-draft-n-max 2 --parallel 1 -b 512 -ub 256" \
  --save-options
```

One more thing worth knowing about a laptop that stays on. An instance that had been resident for days produced a string of slashes at 5 tokens per second once. Unloading and reloading the model cleared it. A health check that only reads status would have reported that server as fine; the check has to generate something and look at it.

## What was not a lever

To save you the afternoon: the ROCm version (7.2.4 against 10.1), the llama.cpp build (b10687 against b10850), GEMM backend selection and hipBLASLt, and the KV cache type made no difference to speed on this model and this card. Larger micro-batches did nothing for prefill, and an earlier greedy sweep showed they hurt MTP acceptance. Vulkan looked like a lever for chat in the bench harness and was not one in a server. What is left is the size of the model file, the drafter, and the HIP backend under it. Everything else is memory layout.

## Limitations

- One desktop card, one laptop, one model family, one week of data. The bandwidth arithmetic should hold on other RDNA4 parts; the specific numbers will not.
- Every number is a snapshot of llama.cpp b10687 on 2026-09-08. Speculative decoding and the hybrid cache code are moving quickly.
- AMDVLK 2025.Q2.1 is end of life, so the Vulkan numbers reflect a driver that will not improve. RADV or a newer AMDVLK may close the batched-verification gap; I have not measured them.
- The four-way aggregate numbers are for cached prompts. Cold concurrent prefill behaves very differently, as described above.
- Throughput is not coding quality. I have not ranked these model or KV quantizations on task quality, and the KV rule above is a configuration preference, not a measured quality score.
- The paired decode numbers are two measurements, not confidence intervals. Prompt depth, sampling, cache reuse, and concurrent arrivals all move the result.
- The 24 GB recipe is a budget derived from components measured on a 32 GB card, not a run on a 24 GB card.
- The laptop numbers are for Lemonade 11.9.0 on Windows 11 with one slot. The ROCm micro-batch crash and its workaround are specific to TheRock 7.14 and llama-server b10711 on gfx1151 and may not survive the next Lemonade release.

## Where this fits

A harness is only as good as the runtime under it. The premise of [PanCode](https://akougkas.io/work/pancode/) is that the model is not the system. The sealed evidence, the bounded context window, and the sandbox around its commands only matter if tokens arrive fast enough for an agent to finish a turn. On this card, speculative decoding is the difference between 27 and 46 tokens per second from the same file, and prefill and slots are what decide whether an agent’s turn finishes at all. Those are the numbers a chat guide never shows you, and they are the ones the harness lives on.
