SpecOPD: Branch-Parallel On-Policy Distillation for Speculative Decoding
Tianyu Liu, Jun Zhang, Wenjie Huang, Yuhao Shen, Tianqi Xu, Xinyue Hao, Hongyaoxing Gu, Xuyang Liu, Baolin Zhang, Yating Zhu, Shuang Ge, Jun Dai, Lei Chen, Yue Li, Mingchen Wan
cs.AI
2026-11-02
SpecOPD samples draft branches at reference anchors and lifts 8B DFlash mean acceptance length from 2.649 to 3.747, at 16.09× sequential OPD's supervised-token throughput.
Speculative decoding has a small drafter propose several tokens and a large target verify them together. An accepted prefix is not regenerated one token at a time. Parallel drafters such as DFlash already emit a whole block in one forward pass, so the proposal itself is cheap. What still limits speedup is acceptance length: how many tokens survive a verification round.
Supervised fine-tuning on fixed target answers pushes acceptance length into a plateau. On-policy distillation samples from the current drafter and still supervises every token with the target distribution, which can move past that plateau. Draft-OPD keeps collecting those samples the way serving works. Draft a block, verify it, and let the accepted prefix pick the next start. Collection is a chain, and the GPUs wait before the update. Mean recorded activity in that sequential window is 26.37%.
Supervision for one draft block needs the reference prefix and the tokens already sampled on that branch. The full answer does not have to be verified first.
The reference sequence is a shared trunk: the prompt plus a prepared answer. The answer is either rewritten offline by the target or taken from the dataset. Anchors are drawn at random on the answer, and the current drafter samples a continuation at each anchor in parallel. Branches do not wait on each other's verification. Inside a branch, each token conditions on earlier samples. On-policy here means the continuation is redrawn from the current drafter, while the outer context stays at the reference anchor.
The trunk is prefilled once. Grouped-query attention (GQA) uses a tree mask, so a query sees only its ancestors and itself, and rotary positions come from the semantic index. The readout uses the predecessor hidden state, so the token being scored never enters the query. Sparse attention (QSA) reuses finished four-token indexer groups, rebuilds groups after the anchor along each branch, and keeps an incomplete boundary group in a causal tail that skips top-k. Linear attention (GDN) folds history into a recurrent state, and a mask cannot separate branches. An FP32 checkpoint is stored every 64 tokens. Each branch replays from the nearest checkpoint to its anchor and then advances its own state. Checkpoints stay read-only. Hybrid targets share this tree.
The loss is Bebop's E2E-TV. At a fixed history, the single-step acceptance probability under rejection sampling equals the overlap of the draft and target distributions, one minus their total variation. Prefix products along a branch make an early mismatch shrink every later term. Branches are resampled at every update. Gradients flow through draft probabilities and the products. Sampled tokens and the target distribution stay fixed. When a later proposal depends on the previous sample, the product is only a surrogate for acceptance length. In the appendix counterexample, exact joint acceptance is 0.1 and the expected product on sampled histories is 0.18.
The targets are from Qwen: Qwen3-8B with GQA and drafters DFlash and DSpark, Qwen3.8-27B with GQA plus GDN and DFlash V2, and Qwen3.8-Flash-Next-125B with QSA plus GDN and DFlash V2. The 125B main-table drafter starts from in-house pretraining with LK loss and D-PACE, not from the public weights. Benchmarks are MT-Bench, HumanEval, MATH-500, and SWE and Terminal as replayed recorded prefixes. Each round proposes seven draft tokens. Acceptance length includes the bonus token, the extra token the target emits after a verified prefix. The five benchmarks have equal weight.
Mean acceptance length:
| Setup | Temp. | Original | SpecOPD |
| 8B DFlash | T=0 | 2.649 | 3.747 |
| 8B DFlash | T=1 | 2.441 | 3.331 |
| 8B DSpark | T=0 | 3.674 | 4.439 |
| 8B DSpark | T=1 | 3.419 | 4.191 |
| 27B DFlash V2 | T=0 | 5.103 | 5.242 |
| 27B DFlash V2 | T=1 | 4.717 | 4.881 |
| 125B DFlash V2 | T=0 | 3.941 | 4.122 |
| 125B DFlash V2 | T=1 | 3.621 | 3.802 |
8B DFlash at T=0 gains 41.45%. Terminal moves from 1.620 to 2.940, reported as 81.51%. At T=1 the five-benchmark mean moves from 2.441 to 3.331. Hybrid targets gain less. At T=1, 27B moves from 4.717 to 4.881 (3.48%) and 125B from 3.621 to 3.802 (reported as 5.01%). Agentic tasks on 27B barely move: at T=1, Terminal falls from 4.895 to 4.845, down 1.02%, and SWE rises 0.40%.
Training throughput is compared with sequential-rollout Draft-OPD on 27B with DFlash V2, eight GPUs, excluding offline reference preparation.
| Metric | Draft-OPD | SpecOPD | Ratio |
| Updates/s | 0.077 | 0.381 | 4.95× |
| Supervised tokens/update | 22.94k | 74.58k | 3.25× |
| Supervised tokens/s | 1.77k | 28.42k | 16.09× |
Recorded activity rises from 26.37% to 77.23%. That is the fraction of time covered by kernels, not SM occupancy.
Serving on 27B uses SGLang with BF16, tensor parallel 1, FA3, and CUDA Graphs. Peak speedup versus autoregressive decoding is 3.56×. Geometric means across the five tasks are 2.97×, 2.23×, and 1.35× at concurrency 1, 8, and 32. Original DFlash V2 already reaches 2.89×, 2.19×, and 1.34× on the same protocol. SpecOPD adds 2.83%, 2.20%, and 1.21% geometric-mean throughput. At concurrency 32, SWE is 4.46% slower than the original drafter.
With optimizer steps and reference-sequence batches matched, and GPU count not matched, SpecOPD at 8k steps has a three-task mean of 4.7422. Off-policy E2E-TV sits at 4.0983, below the 4.6177 initialization, a 15.71% gap. At 12k steps the gain over off-policy cross-entropy is 6.96% (4.7822 versus 4.4708). The best checkpoint raises prefix survival at all seven draft positions, by 4.33 points at position seven, while off-policy cross-entropy drops 2.57 points there. Training loss falls in all three runs. Acceptance under off-policy cross-entropy gets shorter as training continues.
A separate continuation from public DFlash V2 against an FP8 target shows peak task-level gains of 7.72% at block size 4 and 15.57% at block size 8.
The 16.09× supervised-token throughput is the operational change. Parallel branches remove the verify-then-continue chain and put more positions into the loss at each step. Acceptance length depends on how short the drafter started. 8B moves from 2.649 to 3.747, so a short drafter still has room. On 27B, geometric-mean throughput versus the original DFlash V2 rises by about two points. The 3.56× figure is speculative decoding against autoregressive decoding, not the distillation delta.
From concurrency 1 to 32 the geometric mean falls from 2.97× to 1.35×. A high-concurrency service should look at that drop, and at SWE getting 4.46% slower, before retraining a drafter for two points of throughput.
On conditional proposals, E2E-TV is not an unbiased estimate of serving acceptance length, and the gradient omits the score-function term from sampling. Serving acceptance is measured. There is no curve showing how the surrogate tracks acceptance across steps.
The 15.71% comparison does not match GPU count. SpecOPD uses 32 GPUs (12 draft ranks and 20 target workers). Off-policy training uses 16 (6 plus 10). The gradient paths differ too. Sampling from the current policy can bring back acceptance that off-policy training loses. The runs do not show that the full 15.71% remains at equal budget.
SWE and Terminal only replay recorded prefixes. There are no live tools and no task-success scores. Membership in official SWE-bench Verified and Terminal-Bench 2.0 is unconfirmed. 64 Terminal source trajectories overlap the training data. The in-house 125B drafter saw no agentic data in pretraining, and the limited agentic gains are tied to that gap. Throughput excludes reference preparation and does not measure time to a matched acceptance length. Reference sources, retained subsets, and exact checkpoint ids are still undocumented.
The 41.45% gain is on a weaker public 8B drafter. At 27B and 125B the same recipe adds about 3% to 5% mean acceptance length, and longer acceptance is not faster on every task once concurrency is high.