Pidoku

Decoding Research

Module 24 Lesson 24.e 1h Difficulty 4/5

Prerequisites 12.n, 12.o, 13.n, 13.o, 24.a


Before you start: words you need#

WordPlain meaning
Speculative decodingA cheap drafter guesses several next tokens; the big model checks them all in one pass and keeps the ones it agrees with. The output is unchanged (12.n).
Acceptance rateThe share of drafted tokens the big model keeps.
VerificationThe big model’s pass that checks the draft. At high load it is no longer free.
MTP (multi-token prediction)Extra heads trained into the model that predict tokens further ahead. They double as a built-in drafter (13.o).
Parallel drafterA drafter that proposes a whole block of tokens in one forward pass, instead of one pass per token.
Diffusion language model (dLLM)A model that starts from a block of masked or noisy tokens and refines all of them together over several steps, instead of writing one token at a time.
Test-time computeSpending more inference work per question (longer reasoning, several attempts, search) to get better answers.
Structured decodingForcing output to follow a grammar such as a JSON schema by masking forbidden tokens (18.e).

1. What is it?#

Decoding research has two goals:

  1. Speed. Decode is serial and memory-bound: one token per pass, each pass reads all the weights (12.c). Research tries to produce more than one token per pass.
  2. Quality per unit of compute. Which tokens to pick (sampling), how to force a format (structured decoding), and how much extra thinking a question deserves (test-time compute).
TopicStatus, November 2026
Speculative decoding (EAGLE-3, model-native MTP, n-gram)ESTABLISHED
Parallel drafters (P-EAGLE, DFlash, DSpark)ESTABLISHED in vLLM since mid-2026; still new
Verification that adapts to loadEMERGING
Diffusion LLMs as the main modelEMERGING: in vLLM and commercial APIs, small share of traffic
Fast structured decoding (XGrammar, llguidance)ESTABLISHED
Sampling (top-p, min-p, temperature)ESTABLISHED; little new
Serving-aware test-time compute (early stopping, parallel reasoning schedulers)EMERGING

Facts checked on 12 November 2026.


2. Why does it matter?#

Reasoning models and agents produce thousands of output tokens per task (1.e). When a workload goes from “500 tokens in, 200 out” to “500 in, 10,000 out”, decode becomes almost all of the time, and every technique that produces more tokens per pass is worth far more. That is why 2026 saw more practical decoding progress than the three years before it.


3. Simple analogy#

A senior editor (the big model) checks a junior writer’s draft (the drafter).

  • Classic speculation: the junior writes one word at a time, then the editor checks the sentence.
  • Parallel drafting: the junior writes a whole sentence in one go.
  • Adaptive verification: on a busy day, the editor checks only the first few words the junior is confident about, because the editor’s time is now scarce.
  • A diffusion model: the writer sketches a whole paragraph roughly, then improves every word at once over a few passes.

4. Tiny example: one user, Kimi K3#

vLLM’s numbers for Kimi K3 (2.8T parameters, MoE) on GB300 NVL72 at batch 1: about 111 tokens per second per user with tensor parallelism over 8 GPUs, rising to about 331 with the DSpark drafter proposing 7 tokens. That is about 3x for one user, from the team that built it. Section 6 shows why the same drafter at batch 256 could make things slower unless verification adapts.


5. Technical explanation#

Speculative decoding: what changed in 2026#

Settled since 2023: the algorithm keeps the output distribution exactly (Leviathan et al., Chen et al.); it trades spare compute for fewer weight reads; its benefit falls as batch size grows, because verification stops being free.

What 2026 added:

  • Draft heads became standard parts of models. DeepSeek, GLM, Qwen and Nemotron ship MTP heads; EAGLE-3 and EAGLE 3.1 heads are trained for most popular open models.
  • Parallel drafters. An autoregressive drafter needs one pass per drafted token, so long drafts get expensive. Parallel drafters propose a block in one pass, so the drafter can be bigger:
    • P-EAGLE maps the target model’s hidden state to several future positions at once (reported 1.10–1.36x over EAGLE-3 on gpt-oss and Qwen3-Coder).
    • DFlash uses a small block-diffusion model as the drafter (reported over 6x lossless speedup in the paper, up to 2.5x more than EAGLE-3; ICML 2026).
    • DSpark builds on DFlash, adds a small autoregressive correction head and a confidence head that scores draft tokens before verification.
  • Adaptive verification. At high load, verifying tokens that will be rejected wastes real compute. DSpark’s confidence head (August 2026) and then an online estimator for drafters with no such head (October 2026) predict acceptance per position and verify only the number of tokens that maximises accepted tokens per unit of cost. vLLM reports gains at concurrency 64 across datasets.

This is the first real attack on the “batch problem” this lesson used to call unsolved. It does not make speculation free at high batch; it makes it stop hurting, and keeps some gain longer.

Diffusion LLMs#

A dLLM writes a block of tokens in parallel and refines it over several steps.

  • DiffusionGemma (Google, 26B, built on Gemma 4) became the first dLLM natively in vLLM in June 2026. It writes 256-token blocks left to right; each block is refined until predictions stop changing. vLLM serves it by reusing its speculative-decoding path: denoising steps “reject” the whole canvas, and a commit emits 256 tokens. Committed blocks have ordinary causal KV, so prefix caching still works. Reported: 1,288 tokens per second at batch 1 on one H200 with FP8, about 6x an autoregressive baseline and 3x one with MTP. Only the low-batch, low-latency case was measured.
  • Mercury 2 (Inception, February 2026) is a commercial diffusion reasoning model; Inception reports about 1,000 tokens per second on Blackwell; a later press report cites a third-party test at a median of about 324. Treat both as unconfirmed for your workload.
  • Gemini Diffusion (shown May 2025) was still described as experimental in 2026 coverage.
  • Research: papers through November 2026 attack dLLM-specific costs: approximate KV reuse across denoising steps, sparse attention per step (Step-dLLM), CPU–GPU cache cooperation for block diffusion (HERALD) and serving schedulers (Sangam, dLLM-Serve).

Why they matter even if you never serve one: block diffusion is already inside autoregressive serving, as the DFlash and DSpark drafters.

Structured decoding: settled#

Grammar masks once cost milliseconds per token. Compressed automata (SGLang), jump-forward decoding (emit forced characters without running the model) and fast mask engines (XGrammar, llguidance) brought that to tens of microseconds. Still open: masking changes the model’s distribution, and huge or content-dependent grammars are slow.

Sampling: settled#

Top-p, temperature and min-p cover the practical space (12.o). Research interest moved to sampling for reasoning: whether temperature helps or hurts chains of thought, and multi-sample voting with early exits.

Test-time compute: the workload shift#

Spending more inference per question (longer chains, best-of-N, voting, tree search) improves answers, and it changes serving:

  • Decode dominates, and KV grows with every reasoning token.
  • Parallel reasoning shares a prefix. N samples from one prompt share the prompt’s KV (12.l), so voting is cheap in memory, expensive in decode.
  • Early stopping is the serving lever. Methods that stop when enough parallel chains agree (short-m@k), or that cut losing branches in tree search (adaptive parallel MCTS, 2026), cut tail latency without hurting accuracy much in the papers. Schedulers that know a request is one branch of a search are EMERGING (24.h).
  • No single strategy wins. A December 2025 study comparing strategies found the best depends on difficulty, model and budget, which makes this a scheduling problem as much as a modelling one.

6. Under the hood: speculation versus batch size#

A toy model. The target model’s step costs one unit until the batch holds more than 256 tokens (the point where compute, not weight reads, sets the time), then grows linearly. Each drafted token is accepted with probability 0.7. A parallel drafter costs 10% of a step.

Go
// specbatch.go — why speculative decoding fades at high batch, and why
// choosing the draft length per load ("adaptive verification") helps.
package main

import (
	"fmt"
	"math"
)

const (
	alpha = 0.7   // chance each drafted token is accepted
	ridge = 256.0 // tokens per step at which compute time equals weight-read time
	draft = 0.10  // one parallel-drafter pass costs 10% of a plain decode step
)

// stepTime of the target model, in units of one memory-bound decode step.
func stepTime(tokens float64) float64 { return math.Max(1, tokens/ridge) }

// speedup over plain decoding for batch b and draft length k.
func speedup(b, k int) float64 {
	if k == 0 {
		return 1
	}
	accepted := (1 - math.Pow(alpha, float64(k+1))) / (1 - alpha) // tokens per verify step
	cost := stepTime(float64(b*(k+1))) + draft
	return accepted / (cost / stepTime(float64(b)))
}

func main() {
	fmt.Println("batch   fixed k=6   best k   speedup at best k")
	for _, b := range []int{1, 8, 32, 64, 128, 256} {
		bestK, best := 0, 1.0
		for k := 1; k <= 8; k++ {
			if s := speedup(b, k); s > best {
				bestK, best = k, s
			}
		}
		fmt.Printf("%5d   %8.2fx   %6d   %8.2fx\n", b, speedup(b, 6), bestK, best)
	}
}

Output:

batch   fixed k=6   best k   speedup at best k
    1       2.78x        8       2.91x
    8       2.78x        8       2.91x
   32       2.78x        7       2.86x
   64       1.65x        3       2.30x
  128       0.85x        1       1.55x
  256       0.43x        0       1.00x

How to read it:

  • Up to batch 32, verifying 7 tokens per sequence still fits under the “free compute” line, so speculation is close to its maximum.
  • With a fixed draft length, batch 128 is slower than no speculation (0.85x), and batch 256 more so.
  • Picking the draft length for the current load keeps 1.55x at batch 128 and never goes below 1x. That is what adaptive verification does in a real engine, per position and per step, using estimated acceptance instead of a fixed alpha.

7. Performance implications#

  • Per-user speed gains 2–3x from good drafters at low load; parallel drafters and model-native heads push this up without extra serving complexity.
  • Throughput at high load gains little from speculation, and loses without adaptive verification.
  • Diffusion LLMs win single-stream speed; their behaviour at high batch is not yet well measured.
  • Reasoning traffic makes decode-side optimisations (speculation, FP8/FP4 KV, sparse attention) worth more than prefill-side ones.

8. Production implications#

  • Use the model’s own MTP heads or a published EAGLE-3 / parallel drafter before training your own.
  • Enable load-aware verification where the engine offers it, or at least turn speculation down at high concurrency; measure goodput, not tokens per second per user alone.
  • Drafters must be retrained when the base model changes. Budget for it (13.o).
  • Put a cap on reasoning tokens per request tier, and price it; long chains occupy KV for minutes.
  • Treat dLLMs as a separate model class with its own benchmarks; do not assume your autoregressive capacity numbers transfer.

9. Common mistakes#

  1. Quoting batch-1 speculative speedups for a busy production server.
  2. Leaving a fixed long draft length on at high concurrency.
  3. Comparing a dLLM’s single-stream speed with an autoregressive server’s total throughput.
  4. Believing vendor tokens-per-second for diffusion models without an independent test.
  5. Ignoring that masking changes the output distribution in structured decoding.
  6. Treating test-time compute as “just more tokens” rather than a scheduling problem.

10. Hands-on exercise#

  1. Run specbatch.go. Set alpha to 0.5 and to 0.85. How does the best draft length at batch 64 change?
  2. Change ridge to 600 (a GPU with much more compute per byte, like Rubin). At what batch does fixed k=6 drop below 1x now?
  3. In vLLM, serve a model with and without its MTP heads at concurrency 1, 16 and 64. Plot goodput at a fixed per-user speed target.
  4. Measure the output-length distribution of a reasoning model and a non-reasoning model on the same 100 questions. How does the prefill/decode time split change?
  5. Apply 24.a’s questions to the DiffusionGemma blog numbers: what would you need to know before moving production traffic?

11. Interview questions#

  1. Why does speculative decoding lose its benefit at high batch, and what does adaptive verification do about it?
  2. What is a parallel drafter, and why can it be larger than an autoregressive one?
  3. How does vLLM serve a diffusion LLM with mostly unchanged machinery?
  4. Why do diffusion models break exact KV caching, and where does caching still work?
  5. How does test-time compute change what an inference engineer optimises?
  6. What is jump-forward decoding?

12. Further reading#

Checked on 12 November 2026.

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in