Manuscript Offprint

arXiv:2611.02846

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

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Tianyu Liu1,2, Jun Zhang†‡1, Wenjie Huang*1,3, Yuhao Shen³, Tianqi Xu¹,4, Xinyue Hao¹,5, Hongyaoxing Gu¹,6, Xuyang Liu⁷, Baolin Zhang¹, Yating Zhu¹, Shuang Ge¹, Jun Dai¹, Lei Chen¹, Yue Li¹ and Mingchen Wan¹

¹Qwen Business Unit of Alibaba, ²University of Science and Technology of China, ³Zhejiang University, ⁴Carnegie Mellon University, ⁵University of Edinburgh, ⁶University of Chinese Academy of Sciences, ⁷The Hong Kong Polytechnic University

*Equal contribution. †Corresponding author. §Project lead.

Code Blog

Speculative decoding (SD) accelerates large language model inference by reducing the sequential cost of token-by-token generation. Advanced SD methods reduce proposal cost with parallel drafters that predict entire blocks in one forward pass, but overall speedup still depends on acceptance length. On-policy distillation (OPD) can push well-trained drafters beyond acceptance-length plateaus, yet conventional pipelines collect supervision through sequential draft-and-verify rollouts. Our key insight is that on-policy supervision need not inherit these dependencies: a draft block can be supervised using only its reference prefix and draft-sampled history. We propose SPECOPD, a branch-parallel OPD framework that parallelizes draft sampling and target supervision across independent branches drawn from the evolving drafter policy at reference anchors. We pack these branches into proposal trees to share target-prefix computation, using tree masks for full attention, branch-consistent indexer groups for sparse attention, and indexed state replay for linear attention to preserve each branch's history. We train the drafter with an E2E-TV surrogate that directly targets acceptance length. Our study spans 8B full-attention (GQA), 27B full-linear (GQA-GDN), and 125B sparse-linear (QSA-GDN) targets, three parallel draft architectures (DFlash, DSpark, and DFlash V2), and four task domains (dialogue, coding, mathematics, and agentic). SPECOPD achieves up to 41.45% higher mean acceptance length, 16.09× supervised-token throughput over sequential-rollout OPD under native configurations, and up to 3.56× generation speedup over autoregressive decoding.

Figure

Figure 1 | SPECOPD improves training throughput. Qwen3.8-27B with DFlash V2 on eight high-performance GPUs. (a) Sequential draft-and-verify rollouts versus parallel drafting and target scoring, shown on separate time axes. (b) With tokens denoting predictions contributing to the loss, unprofiled measurements show 4.95× update throughput and 3.25× supervised tokens per update, yielding 16.09× supervised-token throughput.

1. Introduction

Speculative decoding (SD) accelerates autoregressive generation by verifying multiple tokens proposed by a lightweight drafter in parallel [1, 2]. Parallel drafters such as DFlash reduce the cost of producing these proposals by predicting an entire block in one forward pass [3, 23, 15, 25]. The overall speedup also depends on acceptance length, which draft training seeks to improve through better alignment with the target [29, 18]. To this end, a common approach to draft training is supervised fine-tuning (SFT) [61] on fixed responses generated by the target model, following sequence-level knowledge distillation [62]. On-policy distillation (OPD) [28] has improved acceptance length beyond SFT plateaus by shifting training to blocks sampled from the current draft policy while retaining dense token-level target supervision [5].

However, in a typical rollout-and-distill pipeline for SD-tailored OPD, collecting complete trajectories requires sequential draft-and-verify rounds [5]. The drafter proposes a block, the target verifies it, and the accepted prefix determines where the next round begins. This dependency serializes response collection before drafter updates. The measured execution profile in the upper half of Figure 1a shows the alternation between rollout and training, with low GPU utilization during rollout collection. We therefore ask: Must on-policy training inherit the sequential dependencies of draft-and-verify rollouts?

Luckily, these sequential dependencies are not inherent to on-policy supervision. We decouple on-policy supervision from full-response rollouts through a unique twist to standard parallel drafter training [3, 23]: replacing reference-token labels with target supervision on draft-sampled prefixes. We sample anchors from pre-collected responses (regenerated offline by the target or supplied with the raw dataset) and use the current drafter to sample tokens for the masked positions. The target supervises each position using the reference prefix and preceding sampled tokens. Thanks to branch independence across anchors, draft sampling and target supervision can proceed in parallel without sequential full-trajectory collection during training.

To put this parallelism to work, we propose SPECOPD, a branch-parallel OPD framework for pushing well-trained drafters beyond acceptance-length plateaus without sequential full-response rollout collection. First, in proposal tree construction, the reference sequence forms a shared reference trunk. We randomly sample anchors on this trunk, as in standard parallel-drafter training, and attach continuations sampled from the current drafter as draft branches. Second, in branch-parallel scoring, we reuse prefix computation while preserving each branch's history. For full attention (e.g., GQA [31]), we share trunk KV and use tree attention masks to restrict each branch to its reference prefix and own sampled history. For sparse attention (e.g., QSA [8]), branch-consistent compressed indexer groups preserve block selection after divergence. For linear attention (e.g., GDN [7]), masking alone cannot isolate recurrent states; we therefore use indexed state replay to restore anchor states from shared checkpoints and advance separate branch paths in parallel, avoiding repeated full-prefix execution. Finally, in acceptance-length optimization, we directly target acceptance length with the E2E-TV surrogate [6], which aggregates prefix products of draft-target distribution overlap along each sampled branch. The measured execution profile in the lower half of Figure 1a shows the resulting higher GPU utilization.

To summarize, our main contributions are:

(1) Direct, parallel on-policy supervision. We observe that on-policy supervision for a draft block requires only its reference context and draft-sampled history, without completing a verified response. This yields direct on-policy alignment on draft-generated histories, independently across reference anchors.

(2) Novel, efficient SD-tailored OPD. We propose SPECOPD to unify independent branch collection, shared-prefix target scoring, and E2E-TV acceptance-length optimization. Its executor preserves branch histories across full (GQA), sparse (QSA), and linear (GDN) attention layers, enabling parallel supervision with prefix reuse.

(3) Broad, systematic empirical evaluation. We evaluate DFlash, DSpark, and DFlash V2 across 8B, 27B, and 125B targets with full, sparse, and linear attention on dialogue, coding, mathematics, and agentic tasks. SPECOPD improves mean AL by up to 41.45% and achieves 16.09× supervised-token throughput over sequential-rollout OPD (Figure 1b); measured generation speedup reaches 3.56× over AR.

References (66)