← all posts
September 16, 2026·Ronald Adonyo· 6 min read

A stale compile cache ate our speculative decoder

Decode throughput quietly fell 4x with identical weights, image and flags. The drafter was replaying CUDA graphs compiled for a different feature set; one moved cache directory recovered 134.3 from 34.0 t/s.

vllmspeculative-decodingrocmr9700Debugging
A hand loom with tangled cloth in the yard of a small house at dusk, above an open drawer of faded pattern cards and one fresh card on the ground; a chimpanzee lifts a faded card, a pangolin walks away toward the gate and a crested crane at the right looks at the drawer.
Was called
a 3.95× loss that nothing logged
Was
a stale compile cache

Bench, 16 September 2026. One speculative-decoding endpoint, 34.0 against 134.3 t/s.

A serving endpoint ran at 34.0 t/s BetterBench weighted decode when the same configuration should deliver 134.3 t/s, a 3.95× loss, and nothing logged it. Weights, image digest and launch flags were unchanged and the output stayed correct. The only record was a set of speculative-decoding metrics counters that nobody was reading. The cause was a stale compile cache that supplied captured CUDA graphs to a speculative drafter. Moving the cache directory aside and restarting with everything else unchanged fixed it.

Transcript

A serving endpoint fell to 34.0 tokens per second when the same configuration should deliver 134.3. Weights, image and flags were unchanged, the output stayed correct, and nothing logged it.

Speculative decoding has a small drafter propose tokens, and the target model verifies every one. So a drafter that is always wrong still gives identical output, only slower. The only evidence was in counters nobody was reading. Acceptance length fell from 3.766 to 1.079, and 1.0 means speculation gained nothing.

The cause: the drafter replays captured CUDA graphs, recorded GPU work, one per shape, kept in a compile cache. On 2026-09-06 the launcher moved to a new image, model paths and draft arm, but the cache directory kept its name. At the next restart, the drafter loaded graphs compiled for the old feature set. They loaded without complaint, and their drafts almost never matched.

The fix: move the cache directory aside and restart, with everything else unchanged. Weighted decode went from 34.0 to 134.3 tokens per second: 3.95 times. The restart took 600 seconds, on the cold-start floor, so a fresh compile really happened, and quality did not fall.

A cache directory name is not a cache key. Keys must include every graph-changing variable, and acceptance length belongs on the serving dashboard. The full write-up is at boracode.ai.

The post in under two minutes: the silent slowdown, the stale cache behind it, and the fix. Narrated in Ronald's cloned voice.

The bench

Reproduction needs the hardware spelled out. The board is an interim X99 board in a large chassis, and an entry-level CPU under four server GPUs is a confound that applies to every host-path number below.

board        MACHINIST X99-D8 MAX, BIOS 5.11 (interim, non-production)
cpu          2x Intel Xeon E5-2620 v4 (8C/16T each, 2.10 GHz base)
memory       396 GB DDR4 (configured speed unverified this session)
gpus         4x AMD Radeon AI PRO R9700 32 GB (gfx1201)
kernel       7.1.5-p2p (local patches)
stack        radiance 0.9.3 / vllm 0.27.1 / torch 2.11.0+rocm7.14
             triton 3.6.0 / aiter 0.1.17 / transformers 5.14.1 / ROCm 7.14.0

The serve runs TP=2 on one socket-local pair. Cross-socket HIP IPC fails on this platform (hip_err=17), so every accelerated all-reduce in a TP group that spans sockets is staged through host shared memory. A socket-local pair avoids that.

GPU0  05:00.0   Gen3 x16   numa 0   <- in the TP pair
GPU1  09:00.0   Gen3  x8   numa 0   <- in the TP pair; x8 is PERMANENT
                                     (IIO bifurcated, other 8 lanes = ConnectX)
GPU2  86:00.0   Gen3 x16   numa 1
GPU3  89:00.0   Gen3 x16   numa 1
(All links verified via pp_dpm_pcie; no BadTLP accumulation this boot.)

Symptom: speculative decoding failed silently

Speculative decoding is lossless. The target model verifies every drafted token, so a drafter that is wrong on every token still produces byte-identical output, only slower. No error is raised, nothing is logged, and the flags still report the feature as on. The only evidence is three Prometheus counters: drafts issued, tokens drafted and tokens accepted.

quantity                    2026-09-09    2026-09-16 (broken)
acceptance length             3.766          1.079
draft-token acceptance       39.82 %         2.70 %
draft tokens per step         6.946          2.960
position-0 acceptance            -            6.70 %

An acceptance length of 1.0 means speculation gained nothing: the verify step emitted its own token and rejected every draft. The serve kept answering correctly at a quarter of the speed for four days.

Three hypotheses that failed

The first suspect was a mispaired drafter checkpoint. A week-old record measured acceptance 3.766 with the identical target, drafter and backend paths, which ruled it out. The second was "the MXFP4 fast path is disabled", an allowlist check that excludes this GPU, supported by a grep of the running environment. That was also wrong: the grep was piped through head -10 and truncated immediately above the two lines that enable it. A bounded search that stops before the answer looks the same as a negative result. The third hypothesis, two drafters double-counting, failed on the counters' own arithmetic (Δdrafts 170 + Δaccepted 27 ≈ Δgeneration 200), which describes one drafter accepting almost nothing.

One version claim also had to be retracted. An environment variable said radiance 0.6.2, and for half a night the working theory was version skew against a 0.9.3 upstream. The image's own component banner said 0.9.3 throughout. The environment variable was only a claim, and the running artifact was the measurement.

The mechanism

A DFlash-style drafter replays one captured CUDA graph per shape. vLLM's compile caches key on the resolved configuration: model, image digest, tensor parallelism, speculative config and feature toggles. On 2026-09-06 the launcher was re-pinned to a new image, new model paths and a new draft arm, but the cache directory name stayed the same. When the serve restarted on 09-13, it loaded graphs that were valid byte for byte but had been compiled for the previous feature set. A wrong cache hit is worse than a miss: the stale graph loads without complaint and yields plausible but wrong output. In a drafter that means drafts that almost never match the target. Verification rejects them, output stays lossless, and throughput drops to a quarter.

stale cachefresh compiledrafterold graph7 draftedwrong tokensverifyreject 6.7%1 tokenacceptance 1.08drafterfresh graph7 draftedon-distributionverifyaccept 47%~3.3 tokensacceptance 3.32same weights · same image · same flags

The fix

The launch was otherwise unchanged: same catalog entry, launcher, environment and cards. The cache directory was moved aside and the launcher re-run. The old directory was kept, since it is both the evidence and the rollback.

mv <model-dir>/cache/qwen38-27b-mxfp4-radiance-093{,.stale-$(date +%Y%m%dT%H%M%S)}
bash <serve-script-dir>/qwen38-27b-mxfp4-r9700-serve.sh

A cold start on this stack measured 594 s, with a warm floor of 320 s. The restart became healthy at 600 s, on the cold floor, which indicates a fresh compile actually took place. This check matters because an invalidation that still hits a warm cache does nothing, and looks like a working fix until the counters show otherwise.

Settings

image          sha256:bebc00145d7d… (radiance 0.9.3 stack, pinned by launcher)
target         <model-dir>/radiance/Qwen3.8-27B-MXFP4-mtpfp8 (19.4 GB safetensors)
drafter        <model-dir>/radiance/Qwen3.8-27B-DFlash2-FP8, SPEC=7, dflash2-fp8 arm
topology       TP=2 socket-local pair (05:00.0 + 09:00.0, numa 0)
context        max_model_len 262144, max_num_seqs 8, gpu_memory_utilization 0.97
speculation    rerank 80, verify_head 1, fast_draft 1, draft depth 7
env (subset)   RADIANCE_MXFP4=1 RADIANCE_MXFP4_W4A8=1 RADIANCE_USE_R4D=1
               RADIANCE_USE_R4D_AR=1 RADIANCE_PRESHUFFLE=1 RADIANCE_FUSE_RMS_QUANT=1
measured with  BetterBench 0.4.0 (corpus 1.0, schema 2) + a /metrics delta probe

Speed

Two instruments measured the same box before and after. The probe takes a /metrics delta across a quiet window (4 reps per arm). BetterBench ran 20 passes per category at temp 0.7 with a cold prefix cache and 3 warmup passes, so the figures are warm floors and not first-run pairs.

betterbench run --passes 20 --warmup 3 \
  --endpoint http://127.0.0.1:8000/v1 --model qwen3.8-27b-mxfp4 --decode
                              broken      fixed
acceptance (greedy)             1.079      3.315
acceptance (sampled @0.7)       1.041      3.018
draft tokens per step            2.96       7.00
weighted decode median         34.0 t/s   134.3 t/s     (3.95x)
update p99                      39.9 ms    48.4 ms
TTFT p50                          112 ms     92 ms

137 of 160 runs hit max_tokens in both runs alike (a thinking model at this depth), so the comparison is like for like. Update p99 rose slightly because tokens now arrive about four at a time instead of one; the gap between updates is the same wall-clock interval carrying 4× the payload.

Quality

Speculative verification preserves the output distribution by construction, and that held here. Completions were correct throughout the broken period, which is why the regression went unnoticed for four days. BetterBench answer rates on the fixed run were prose 95% and reasoning 91%, with json and code in band with the earlier baseline. Quality did not fall as throughput rose.

BetterBench report

BetterBench's own charted report for the fixed run follows, as rendered on the bench. The per-category rows give TTFT, prefill split, update-gap percentiles, tokens per update, and per-category decode medians with interquartile ranges.

BetterBench report summary for the fixed run: weighted combined decode 134.3 t/s, update p99 48.4 ms, TTFT p50 92 ms
Fixed run — summary header and weighted line
BetterBench per-category table: eight categories, 20 passes each, decode medians from 81.2 (prose) to 193.5 t/s (file_edit)
Fixed run — per-category table

Per-category results

categoryTTFT p50update p99tok/updatedecode t/s±IQR
code86.6 ms49.2 ms4.45143.855.1
file_edit109.7 ms46.8 ms5.43193.579.4
json93.1 ms49.6 ms4.27151.636.5
math85.4 ms48.1 ms5.11191.576.1
summarization100.9 ms48.0 ms4.66175.457.1
chat96.6 ms49.2 ms2.83104.847.2
reasoning87.6 ms47.6 ms2.9696.546.3
prose88.7 ms48.1 ms2.5581.235.4

Tokens per update shows the speculative behavior per category. Structured output (file_edit 5.43, math 5.11) accepts deep drafts, while prose (2.55) and chat (2.83) do not. For that reason the weighted mix, and not a favorable single category, is the headline number.

What remains of the gap

The public R9700 result that prompted this work, 276–285 t/s decode, also comes from a two-card setup. On the like-for-like weighted-combined metric, their build documents 174.9 t/s against 134.3 t/s here, a residual of 1.30x. The comparison build is five-plus releases ahead (a versioned overlay on the same base), and its performance ledger lists where the difference lies: a decode launch-gap stack worth +14%, dynamic verify width (+11–13% at concurrency), fragment-order weights and nontemporal decode loads (−5.4% per step), an int2 verify head (+2.9%), and KV-cache group sizing (+20% resident tokens). Each item is gated separately in that ledger, and together they are about the size of the remaining gap. Whether they account for all of it has not been tested here.

Concurrency scaling (added after the run)

A concurrency sweep on the same fixed serve (10 passes, 48 requests per level, cold prefix cache) shows how the pair scales under load rather than one stream at a time.

concurrencyaggregate t/sTTFT p50per-req decode t/s
1115.595 ms134.4
2194.1122 ms118.3
4279.4143 ms89.5
8359.8726 ms69.9
16391.07.4 s72.8

The pair saturates around 391 t/s aggregate. The TTFT jump past concurrency 4 matches the max_num_seqs: 8 admission ceiling. Requests queue at capacity while the model itself does not slow down. Two inferences follow, neither measured here: all four cards run as two pairs should carry roughly double both numbers (~780 t/s ceiling, 16 admission slots), and per-request decode falls with batching (134 to 70 t/s) because the fixed verify cost is amortized differently across the batch. The single-stream 134.3 and the c8 359.8 answer different questions and are both correct. The sequential-phase Combined of this run measured 132.6 against the main run's 134.3, two independent invocations agreeing within 1.3%.

Prefill by prompt depth

The prompt-processing arm used 10 passes per depth, a tiny decode and a cold prefix cache. Throughput is prompt tokens ÷ TTFT.

prompt tokensTTFT p50PP t/s (median)
1.5 k464 ms3260
5.9 k1.70 s3480
11.8 k3.32 s3556
23.5 k6.71 s3511
47.1 k13.87 s3391

Prefill throughput stays flat within 8% from 1.5k to 47k tokens, so the chunked pipeline (8192-token chunks) does not fall off with depth on this stack. Against the public result's 5809 t/s prefill the residual here is ~1.6x. That is consistent with the prefill-specific gains in their ledger (fp8 attention legs, epilogue width) stacking on the ~1.3x decode-side difference, though the decomposition was not measured here.

Why the serve uses two cards

Four R9700s sit in this chassis and the serve uses two. The cards split two per socket, and cross-socket peer DMA does not exist on this platform, so cross-socket HIP IPC fails (hip_err=17) and every accelerated all-reduce in a four-card TP group is staged through host shared memory. On this bench, with the same binary and only the grouping changed, TP4 across sockets gave 360.1 t/s aggregate at concurrency 8. That is worse than one socket-local TP2 pair at 448.3, because the collective takes 0.22 ms of a step and host staging makes it the slowest part. Two socket-local TP2 replicas side by side use all four cards and measured 607.6 t/s aggregate. A proper benchmark of that layout, with two replicas, per-pair caches and interleaved arms, is the follow-up this fix unblocks.

Platform caveats

Three caveats apply to numbers from this bench. First, the PCIe root complexes: 09:00.0 trains x8 permanently (its IIO is bifurcated, and the other eight lanes carry a 25 GbE ConnectX). The two socket-local pairs therefore differ in host-to-device bandwidth, 20.5 GB/s for the {05, 09} pair this serve runs on against 27.2 GB/s for{86, 89}, and a latency-sensitive replica would be better placed on the second pair. Second, this board is an interim MACHINIST X99-D8 MAX. On a previous boot, two of the four links had silently negotiated down (6,655 BadTLPs on one root, Gen1 on another) with static AER, and everything measured that day ran on degraded hardware that showed no symptom. The loose cables were re-seated, the machine rebooted and the links verified, and the same check is worth running on any similar host:

for c in /sys/class/drm/card*/device; do
  cat "$c/uevent" | grep PCI_SLOT_NAME
  cat "$c/pp_dpm_pcie"   # the starred row is the ACTIVE state
done

lspci's LnkSta reports the wrong link state on this Broadwell-EP platform, showing Gen5 x16 for a card on a Gen3 bus. Third, the CPUs are entry-level for four server GPUs: a dual E5-2620 v4 feeds a 19 GB target and its drafter across a PCIe 3.0 host fabric, and any benchmark that touches the host path inherits that ceiling. A faster platform would likely move the prefill column, but it would not have hidden a stale cache.

Takeaways

Cache keys must include every graph-changing variable, and a cache directory name is not a cache key. The launcher changed image, model paths and draft arm on 09-06 and kept the directory name, and the 09-13 restart produced a silent quarter-speed serve. vLLM's spec-decode counters already expose this class of fault, but only if something reads them. Acceptance length belongs on the serving dashboard, and "lossless but slow" should be read as a working verifier sitting behind a broken drafter.

A wide horizon at dusk: layered hills in muted plum and ochre above a lake that holds the last light, a family of crested cranes at the water's edge, an acacia in silhouette and a single bright star above the ridge.