Speculative decoding accelerates large language model (LLM) generation using a lightweight draft. Existing methods evaluate complete recipes under different training configurations, leaving component effects, interactions, and composition benefits unclear. Therefore, we present LEGOSpec, a composable framework for speculative draft design and training. LEGOSpec decomposes draft models into Context, Backbone, Proposal, and Objective components that share a unified training infrastructure. Using LEGOSpec, we systematically vary components and evaluate selected combinations under matched training conditions to isolate their effects and interactions. These experiments reveal three findings: (1) Different workloads favor different backbones, depending on context length and memory budget, with within-block dependency modeling particularly important for long contexts. (2) Proposal design must balance acceptance and latency. (3) The training objective should match token distributions locally and optimize acceptance length across the block. These findings guide workload-aware configurations and DFlux, a balanced general-purpose draft combining a convolution-equipped SWA--GQA hybrid backbone, Residual Corrector, and hierarchical supervision. Across Qwen and Gemma models, DFlux improves acceptance length over the strongest baseline by up to 13.7% on regular benchmarks and 34.7% on long-context workloads. To support efficient training, LEGOSpec integrates metadata-aware scheduling and asynchronous execution, increasing training throughput by up to 79% and accelerating offline supervision preparation by up to 3.11× over SpecForge.
Figures & tables
Fig. 1: (a) Alternatives in context, backbone, proposal, and objective. (b) In DFlash, changing the optimizer or increasing the training-set size from 80K to 400K can match or exceed the gains from adding a Markov head, while changing the data source can reduce acceptance.
Context
80K
400K
1M
Regular
Long
Regular
Long
Regular
Long
DFlash
4.472
2.450
4.902
2.493
5.072
2.512
DFlare
4.391
1.623
4.829
2.496
5.082
2.428
TABLE I: Context fusion with different training-set sizes.
Fig. 2: Controlled component study. (a)–(b) Draft components and matched evaluation. (c) Within-block attention mass from 2K to 32K context. (d) Convolution effects across attention windows. (e)–(f) Token probabilities and negative logit gradients. (g) Proposal acceptance and speedup. (h) Proposal latency versus draft length.
Group
Context
Backbone
Proposal
Objective
Regular
Long
Cache (MiB)
Ref.
DFlash
5× GQA
RNN
Mix
4.472
2.450
1280
A
DFlare
—
—
—
4.391
1.623
—
B
—
5× GQA +Conv
—
—
4.489
2.950
1280
—
5× MHA
—
—
4.459
2.391
5120
—
5× SWA
—
—
4.422
3.023
10.00
—
5× GDN
—
—
4.226
2.589
10.18
TABLE II: Component-wise acceptance at T=1 . Cache memory is computed at a context length of 64K tokens.
Fig. 3: (a) Acceptance of different backbones with matched convolution, RNN proposal, and Mix loss. (b) Maximum context length under each memory budget, including weights and runtime overhead.
Fig. 4: Our finding-guided general-purpose draft combines a hybrid backbone with Residual Corrector and Hierarchical supervision.
Fig. 5: LEGOSpec pipeline (top) and metadata-aware scheduling (bottom).
Short-context workloads
LongBench-v2 domains
Long coding
Model
Method
Alpaca
MT-Bench
GSM8K
MATH-500
MBPP
LCB
MD-QA
L-ICL
SD-QA
SWE
Qwen3-4B
DFlash
3.23
3.75
5.63
5.32
4.77
3.97
2.14
2.52
2.50
1.58
DFlash2
3.25
3.88
5.87
5.64
4.83
3.89
3.12
3.45
3.17
2.96
DSpark
3.57
3.89
6.04
5.61
5.12
4.30
2.42
2.75
2.67
2.24
DLite
3.56
3.88
6.12
5.98
5.14
4.04
2.74
3.11
2.98
3.03
DFlux
4.03
4.39
6.47
6.35
5.74
4.95
3.60
3.81
3.63
4.08
TABLE III: Mean acceptance length τ at T=1 on short- and long-context workloads, averaged over five random seeds.
Fig. 6: Mean acceptance length τ at T=1 under identical training data and shared training hyperparameters on Qwen3-4B and Qwen3.5-9B.
Model
Backbone
Proposal
Objective
Regular
Long
Q3-4B
GQA
RNN
Mix
4.472
2.450
Hybrid
RNN
Mix
4.480
3.051
Hybrid
Selector
CE
4.392
2.927
Hybrid
R-Corrector
Mix
4.535
3.045
Hybrid
R-Corrector
D-PAL
4.599
3.109
Hybrid
R-Corrector
Hierarchical
4.618
3.123
TABLE IV: Component ablation with DFlash context.
Task
Method
Batch size (TPS / Speedup)
Avg. τ
1
8
32
64
Qwen3.6-35B-A3B
Alpaca
AR
131/1.00 ×
1033/1.00 ×
3740/1.00 ×
6113/1.00 ×
—
DFlash2
298/2.27 ×
2001/1.94 ×
5817/1.56 ×
7820/1.28 ×
3.37
DSpark
303/2.30 ×
2005/1.94 ×
5137/1.37 ×
7193/1.18 ×
3.26
DFlux
353/2.69 ×
2336/2.26 ×
7125/1.91 ×
9712/1.59 ×
3.85
TABLE V: Throughput and acceptance with SGLang backbend.
Fig. 7: Framework efficiency. (a)–(b) Batch latency and peak memory under cumulative optimizations. (c) Offline supervision preparation time.
Speculative decoding accelerates LLM inference by drafting multiple tokens and verifying them in parallel. Block-parallel drafters such as DFlash further improve drafting efficiency by predicting an entire block in one pass, but their position-wise predictions lack explicit intra-block causal conditioning. Recent methods such as Domino and DSpark attempt to introduce such causality into block-parallel drafting, but they require training the draft model from scratch, which limits their flexibility and increases training cost. We propose DeLS-Spec, a decoupled long-short context speculative decoding method. DeLS-Spec treats the fixed DFlash model as a long-context expert and introduces a lightweight local head as a short-context expert. The local head can be trained independently with a standard next-token prediction objective, without joint training with the target model or the DFlash backbone, leading to extremely low training cost. At inference time, DeLS-Spec combines long-context and short-context logits, and the local head is not tied to a specific DFlash checkpoint, making the method more modular and flexible. Experiments on Qwen3 models show that DeLS-Spec consistently improves speedup and average acceptance length over DFlash across math, code, and dialogue benchmarks.
Hong-Kai Zheng, Piji Li
College of Artificial Intelligence, Nanjing University of Aeronautics and Astronautics, China · MIIT Key Laboratory of Pattern Analysis and Machine Intelligence, Nanjing, China · The Key Laboratory of Brain-Machine Intelligence Technology, Ministry of Education, Nanjing, China
Large language models incur high inference latency due to sequential autoregressive decoding. Speculative decoding alleviates this bottleneck by using a lightweight draft model to propose multiple tokens for batched verification. However, its adoption has been limited by the lack of high-quality draft models and scalable training infrastructure. We introduce SpecForge, an open-source, production-oriented framework for training speculative decoding models with full support for EAGLE-3. SpecForge incorporates target-draft decoupling, hybrid parallelism, optimized training kernels, and integration with production-grade inference engines, enabling up to 9.9x faster EAGLE-3 training for Qwen3-235B-A22B. In addition, we release SpecBundle, a suite of production-grade EAGLE-3 draft models trained with SpecForge for mainstream open-source LLMs. Through a systematic study of speculative decoding training recipes, SpecBundle addresses the scarcity of high-quality drafts in the community, and our draft models achieve up to 4.48x end-to-end inference speedup on SGLang, establishing SpecForge as a practical foundation for real-world speculative decoding deployment.
Shenggui Li, Chao Wang, Yikai Zhu +14
Nanyang Technological University · SpecForge Team · Meituan +2
Speculative decoding accelerates large language model (LLM) inference by using a lightweight draft model to generate multiple candidate tokens that are verified by the target model in a single forward pass. Its speedup is largely determined by the acceptance length, yet existing draft-model training methods mainly optimize cross-entropy or Kullback-Leibler (KL) divergence as proxies. These objectives encourage distribution matching but do not directly optimize acceptance length, and the acceptance mechanism also differs between greedy and sampling-based decoding. In this work, we propose acceptance-length-aware training losses that directly optimize the expected number of accepted tokens within a speculative window. For greedy verification, we derive an expected accepted length (EAL) loss that explicitly maximizes expected acceptance length. For sampling-based decoding, we introduce a window total variation (WTV) loss that optimizes the overlap between temperature-scaled draft and target distributions while accounting for sequential acceptance dependencies. Both objectives can be further combined with a group-relative reinforcement learning stage (GRPO) using simulated acceptance length as the reward. Experiments across different target and draft models, tasks, and decoding settings show that our losses consistently improve acceptance length over KL-based training. WTV provides particularly strong gains under sampling-based decoding, while EAL better matches greedy verification. These results show that directly optimizing the acceptance objective, with losses tailored to the decoding mode, is more effective than conventional distribution-matching objectives.
Tianhua Xia, Mugilan Ganesan, Yifei Feng +3
New York University · University of Waterloo · Independent Researcher