Native Draft Architectures for Speculative Decoding in the Coding Era
Su & Huang in Inference & systems
On Qwen3-8B, can a 98.6M drafter beat DFlash on code edits?
Native Draft Architectures for Speculative Decoding in the Coding Era
Why code opens an unusual speculation window
An LLM emits one token per forward pass. Coding agents repeatedly write and revise long programs, so that serial decoding adds latency turn after turn.
A small drafter proposes a candidate token tree; the frozen target verifies it in parallel, accepting matching greedy continuations without changing target output.
Code reuses syntax and identifiers across long spans, with occasional branching points.
The drafter reads plain text, then builds a tree

Panel (a) shows the prefix encoder feeding shared memory and a boundary state to the shared parallel decoder; its candidate tree goes to target verification. Panels (b,c) detail GSC and Null-Key Attention.
The draft branches without serial rollout
- 1
Propose the horizon
Stage 0 uses shared prefix memory to predict the next K draft tokens together.
- 2
Score path probability
A causal pass scores the greedy draft and multiplies token probabilities to estimate each prefix's reach probability.
- 3
Complete branches in parallel
Choose high-probability alternatives, mask each suffix after its branch, predict suffixes together, then expand one more level; decoder depth stays constant as K grows.
GSC tracks local state; attention can skip the prefix
- 1
Grouped State Channel
GSC carries groupwise state across tokens; RMS normalization holds state near unit RMS while gated residual outputs remain free in scale.
- 2
Null-Key Attention
A learned zero-value null key can absorb attention when a token has no useful prefix match; matching copied spans instead draw heads toward their prefix positions.
- 3
Position-zero sink nearly vanishes
On Qwen3-8B Stage-0 queries for tokens with no prefix match, mean position-zero attention fell from 0.4148 without the null key to 0.0002 with it.
Accepted length rises with context reuse

Panel (a) relates accepted length to context reuse; coding samples cluster toward higher reuse while general QA samples cluster at lower reuse. Panel (b) compares drafting latency over horizon K and normalized step time across targets.
On CanItEdit, Spancast accepts more tokens per step
Qwen3-8B/CanItEdit; mean τ = accepted tokens/step. Greedy, batch 1 on one H100. Inter-token latency: DFlash 0.83, Spancast 1.01 ms/token.
Branching improves the full speculative step
Stage 0 alone averages 4.45 accepted tokens/step and inter-token latency (ITL) of 4.34 ms/token across 17 targets; tests are greedy, batch 1, on one H100.
Full Spancast (B=16) adds causal scoring and two-level branches: 7.80 tokens/step and 2.64 ms/token in the matched-parameter ablation.
One plain-text drafter beats target-agnostic baselines on 17 models
Zero-shot mean τ (accepted tokens/step); four targets from 17 models/15 families. Greedy, batch 1 on one H100.
What the study does not yet establish
Longer contexts
The drafter trains on 2,048-token windows; acceptance degrades beyond that under rotary-position extrapolation.
Low-reuse tasks
On low-reuse, high-entropy tasks such as QA and LiveCode, target-coupled drafters can accept more by using target hidden states.
Serving regime
Tests use greedy decoding, batch size 1, on one H100; stochastic sampling and batched serving remain untested.
Why it matters
- Repeated code gives a small drafter room to propose longer spans, while target verification preserves the greedy output.
- A single plain-text drafter can serve multiple tested target families without target-specific hidden features or retraining.
- The open question is whether gains persist beyond 2,048-token windows, with stochastic sampling, and in batched serving.
1 upvotes on Hugging Face 11 slides, 3 min
1 day ago