Faster ML · October 6, 2026

Speculative decoding of Qwen3.8-27B at 322 tokens per second on one RTX 4090

Qwen3.8-27B decodes at 322 tokens per second on one RTX 4090, serving one user. On the same card and benchmark, vLLM decodes 200 tokens per second and llama.cpp 102. With the official weights left untouched, our engine reaches 245.

The text does not change: every token is the model’s own greedy choice. The weights behind the last number are our own 4-bit build, and they are closer to the full-precision model than the official 4-bit release.

An agent’s time goes mostly to its long prompts. On Artificial Analysis’s agent replay the same engine finishes in 4.2 minutes against 9.0 for llama.cpp, and what decided that was reusing earlier turns.

Decoding speed on one RTX 4090, tokens per second
llama.cpp public 4-bit build
102
Cinference-4090 the engine we started from
178
vLLM community RTX 4090 recipe
200
Ours official weights
245
Ours our weights
322
Spec-Bench: 480 prompts, 256 output tokens each, one request at a time, greedy decoding. Every engine runs a public 4-bit build of the official checkpoint with the DFlash2 drafter, measured in one session with the same client. The last bar swaps in our weights.

Memory bandwidth

With one user, every forward pass reads every weight once. At about 4 bits per weight the model is 13 to 14 GB, and the RTX 4090 reads its memory at close to 1 TB per second. That caps ordinary decoding, one token per pass, near 70 tokens per second. We measured 46 in llama.cpp and 54 in the engine we started from.

Speculative decoding changes the unit of work. A small drafter model proposes several tokens. The target model scores all of them in one pass, which still reads the weights only once, keeps the ones that match its own greedy choices, and adds one token of its own. The drafter can change the speed but never the output.

Speed is then the tokens a round accepts divided by the time a round takes, and a round’s time is mostly the bytes it reads divided by the card’s bandwidth. That leaves three things to work on: more tokens per round, less time in which memory sits idle, and fewer bytes.

Where the speed comes from
20 25 30 35 40 4 4.5 5 5.5 Time per round, ms Tokens per round 100 tok/s 200 tok/s 300 tok/s Cinference-4090: 4.03 tokens per round, 22.6 ms per round, 178 tokens per second Cinference-4090 · 178 + tree of drafts: 5.18 tokens per round, 22.6 ms per round, 230 tokens per second + tree of drafts · 230 + shorter rounds: 5.18 tokens per round, 21.1 ms per round, 245 tokens per second + shorter rounds · 245 + our weights: 5.43 tokens per round, 16.8 ms per round, 322 tokens per second + our weights · 322 vLLM: 4.07 tokens per round, 20.3 ms per round, 200 tokens per second vLLM · 200 llama.cpp: 4.09 tokens per round, 40.0 ms per round, 102 tokens per second llama.cpp · 102
Each point is one configuration on Spec-Bench, labelled with its tokens per second. Speed is tokens per round divided by time per round, so faster is up and to the left; the dashed lines mark constant speed. The line follows our three steps from the engine we started from.

A tree of drafts

The engine we started from drafts a chain of 7 tokens: if the third is wrong, the rest are wasted. We draft a tree of 15 candidates instead, grown from the drafter’s most likely tokens at each position, and the target verifies the whole tree in one pass. Where the chain breaks, a side branch often continues.

The tree accepts 5.2 tokens per round where the chain accepted 4.0. Trees were already in the upstream project’s code; we merged them into the port for this card. Each round now verifies 16 positions instead of 8, and at first that made rounds longer. Retuning the matrix kernels for this GPU, which now stream 930 to 1,000 GB per second, took a profiled round from 25.3 to 22.9 ms, and on the benchmark a round takes what the chain’s did.

A wider tree does not pay here. A tree of 32 accepts about a tenth more tokens, but its activations no longer fit the kernels’ 16-column tiles, and the matrix kernels cost 12 to 39 percent more.

Shorter rounds

A round is almost all weight reading. In that profiled round of 22.9 ms, 20.4 ms goes to streaming weights. The rest goes to hundreds of small kernels, and while they run, memory sits idle.

Three kinds of change took the benchmark round from 22.6 to 21.1 ms, still on the official weights:

  • A cheaper output layer. The output layer scores 248,320 tokens at every position. It is first read through a 3-bit copy that keeps 32 candidates per position, and only those are scored exactly. The output was identical on all 480 prompts.
  • Idle time put to use. While a small kernel runs, a few extra threads in the same launch pull the first megabytes of the next matrix into the GPU’s cache, so the next kernel starts warm. The results are bit-identical, because the extra threads only load data.
  • Cheaper small kernels and state. Attention over the tree was rewritten and takes 7 µs instead of 17. Compiling the engine as one program let the largest kernel use fewer registers, so three copies of it fit on each processor instead of two. The attention cache now stores its values as 8-bit integers, which measured as lossless against an unquantized cache and made attention faster.

That leaves a round that is almost all streaming, and one large lever: fewer bytes.

Fewer bytes

A smaller model that is worse than the official one would not count, so we fixed the bar first. The reference is the full-precision model. We score 46,059 next-token predictions, half English prose and half Python source, on three numbers: the divergence of the output distribution from the reference, how often the top token agrees, and perplexity. A change ships only if every number, on prose and on code, is at least as good as the official 4-bit release.

The official release rounds each weight to the nearest 4-bit or 5-bit value. Choosing the rounding with GPTQ, which corrects each weight’s error with the weights after it, cuts the divergence by more than a third at the same size. We spend that headroom on bytes: every matrix goes to 4 bits, the feed-forward matrices of the early layers go to 3, since a byte saved late in the model costs six times the divergence of one saved early, and the quantization scales are then tuned end to end against the full-precision model’s outputs.

Weights read per round Divergence (KL) Top-token agreement Perplexity
Official 4-bit release 14.37 GB 0.0668 0.9250 3.294
GPTQ, same bits as the release 14.37 GB 0.0421 0.9425 –
Every matrix at 4 bits 12.57 GB 0.0604 0.9328 –
Ours: 3 bits in early layers, tuned scales 11.64 GB 0.0619 0.9250 3.213

The full-precision model’s perplexity on the same text is 3.146. With these weights a round takes 16.8 ms instead of 21.1.

Quality turned out to be a speed variable too. A noisier target agrees less often with the drafter, which was trained on the full-precision model: a naive all-4-bit build read fewer bytes but accepted fewer tokens per round, and lost most of what it had saved. For the same reason we fine-tuned the drafter on text generated by the new target, which was worth another 2.3% in tokens per second.

Small effects

Late in the project most gains were under one percent of round time, and speculative decoding makes effects that small hard to see. A change that is not bit-exact flips a few near-tied tokens; from the first flip on the text differs, and different text is accepted at a different rate. A change we knew to do nothing measured as 0.44% more tokens per round.

Three practices made such effects measurable. The engine can be forced to follow a reference text, so every configuration walks the same 480 outputs. Two configurations alternate on one GPU in the order A B B A B A A B, which cancels the drift of a warming card. And each prompt is compared with itself across runs, which removes the difference between easy and hard prompts. The last change we adopted was measured this way, at 0.16% faster.

Negative results

Idea Why not
Trellis quantization, as in EXL3 Matching our quality needs about 3.75 bits per weight. That is at most 9% fewer bytes, and decoding is slower.
Entropy-coded weights Keeping up with the card needs about 2 trillion codes decoded per second. The GPU decodes 1.5 to 1.65 trillion.
Small kernels on a second stream, alongside the matrix kernels No gain. Both draw on the same memory, and each slows the other by as much as it saves.
A 2-bit screen for the output layer Its candidates contain the model's top token 98.7% of the time, and the output must not change.

An agent workload

Spec-Bench times decoding alone. An agent’s turns are different: each one sends the whole conversation again, often tens of thousands of tokens, and the server has to process whatever part of it is new before it decodes anything. Artificial Analysis’s AA-AgentPerf-Local replays eight recorded agent tasks, 168 turns with a 65,536-token context and sampled output, and times how long a machine takes to finish them. We ran it unmodified.

Time to finish the agent replay, by model and system
RTX 409024 GB VRAM
RTX 509032 GB VRAM
DGX Spark128 GB unified
RTX Spark laptop128 GB unified
Ryzen AI Halo128 GB unified
MacBook Pro M5 Pro64 GB unified
Qwen3.8 27B27B parameters
4.2 min
4.9 min
17.3 min
18.7 min
34.5 min
37.6 min
Qwen3.6 35B A3B36B, 3B active parameters
Does not fitin 24 GB VRAM
2.0 min
7.3 min
7.6 min
11.7 min
11.9 min
Ling 3.0 Flash124B, 5.1B active parameters
Does not fitin 24 GB VRAM
Does not fitin 32 GB VRAM
14.9 min
15.3 min
25.1 min
Does not fitin 64 GB unified
AA-AgentPerf-Local default replay, 168 turns and 172 tool calls; darker is faster. The RTX 4090 runs our engine on the official weights, median of three replays. The other systems run Artificial Analysis's own configurations, retrieved November 2026.

At first our engine took 15.9 minutes, the slowest setup on the card, though it decoded three times as fast as llama.cpp (268 output tokens per second against 90). A server keeps the state of each conversation and resumes the next turn from it; ours kept that state at the end of the prompt. Three of the tasks end every prompt with a message that the next prompt no longer contains, so each of their turns was recomputed from the first token. The fix keeps the state from just before that last message.

Every setup we ran on one RTX 4090
Setup Minutes Output tokens/s First token, s
1 Ours official weights · DFlash2 tree 15 4.2 275 0.48
2 llama.cpp b11236 UD-Q4_K_M · DFlash 7 9.0 90 1.10
3 llama.cpp b11026 Q4_K_M · MTP 2 10.1 78 1.04
Ours our weights · DFlash2 tree 15 4.1 294 0.49
vLLM 0.27.1 W4A16 · MTP 3 does not fit a 65,536-token context in 24 GB
The same replay and settings. Each setup is the median of three replays; output speed and the median time to first token are from that replay. Only setups on the official weights are ranked. Commands and raw data.

Prefill and decoding now take about half the time each. Our weights barely move the total: 31% faster on Spec-Bench, they finish the replay about 1% sooner, since they do not speed up prefill and, under sampling, accept fewer tokens per round.

Limitations

  • One user. The cheaper output layer returns only the top token, so the Spec-Bench numbers are greedy; sampling, as in the agent workload, uses the full output layer.
  • One kind of card. Most kernel decisions are specific to the RTX 4090.
  • Most benchmark prompts are short. On prompts of 11,000 and 32,000 tokens, rounds take 18 to 20 ms and accept fewer tokens, and the gain over the engine we started from falls from 1.8 times to 1.55.
  • Our build keeps extra copies of some weights for decoding, about 4 GB. With the cheaper output layer it starts with a context of 57,344 tokens, not 65,536; with the full one, 65,536 fits.
  • The quality bar covers English prose and Python.
  • The other engines ran their published recipes without further tuning, and we did not score their 4-bit builds with our quality harness.

Code and data

The engine is a series of 53 patches on Cinference, in jram4’s port to this GPU. The code includes the measurement tools, and REPRODUCE.md goes from a fresh clone to each number here, for our engine, for the vLLM and llama.cpp recipes and for the agent replay. The weights are on Hugging Face.

This work builds on NInfer (Neroued), Cinference (satellitedown) and jram4’s port of it, on the DFlash2 drafter (z-lab), on Spec-Bench (Xia et al.), and on the community llama.cpp and vLLM recipes for this model.

An AI coding agent, Claude Code, ran this project on the machine, four days for the decoding work and a week for the agent workload: it designed and ran the experiments, wrote the kernels and kept the research log, while I set the goals, the constraints and the quality bar. Every number here comes from a logged run.