TL;DR
Speculative decoding speeds up large language models by using a cheap "drafter" to guess upcoming tokens and verifying them in one pass, but no single drafter is fastest everywhere. SpecRouter solves this by separating how many tokens a drafter will commit (predicted once by a tiny 0.58M-parameter network) from how much it costs to run (calibrated per GPU and batch size). The result is a router that beats the strongest fixed drafters, outperforms online bandit selectors, and transfers across hardware and batch sizes without ever being retrained.
What Problem Does This Paper Address?
Autoregressive language models generate text one token at a time, which is slow. Speculative decoding accelerates this by having a cheaper mechanism—an action—propose several draft tokens, which the main (target) model verifies in parallel.
There are many ways to draft: copying from the prompt or prefix (e.g., N-gram lookup or suffix-automaton copying like SAM), running a small standalone draft LM, or using a learned tree drafter like EAGLE-3. Each shines in different situations. Copying commits long spans when text repeats, while neural drafters handle novel text but pay a compute cost every time.
Which action is fastest depends on two things that vary for completely different reasons:
- Payoff (committed tokens): depends on the text being generated.
- Cost (time to propose, verify, and maintain cache): depends on the hardware and batch size. For instance, verifying a large draft tree is nearly free at batch size 1, but becomes expensive at batch size 16.
Existing approaches either switch between two fixed drafters using a hand-tuned threshold, or learn drafter choice online via bandits—which requires exploration during serving and cannot easily adapt to new hardware.
Methods
SpecRouter decouples payoff prediction from cost modeling:
- Payoff Predictor: A lightweight 0.58M-parameter MLP reads the target model's existing hidden states (no extra forward pass) plus eight simple prefix statistics (like n-gram match length and position) and predicts how many tokens $\widehat{L}_a$ each action $a$ would commit.
- Exact Offline Supervision: Because deterministic drafters under greedy verification always produce the exact same output regardless of which drafter runs, the authors can compute every action's committed length at every prefix offline—turning routing into pure supervised learning with zero online exploration. Under speculative sampling, the expected payoff follows in closed form from a single teacher-forced target pass.
- Cost Model & Decision Rule: A separate cost model estimates each action's execution time $\widehat{C}_a$ (covering proposal, verification, cache catch-up, and routing overhead) for the current GPU and batch size. At each block, SpecRouter simply picks the action minimizing predicted cost per committed token: $\widehat{C}_a / \max(1, \widehat{L}_a)$.
Datasets
- Primary Evaluation (16 Workloads): The authors evaluate on the 16 workloads and prompt sources from HVD, spanning document editing, code (e.g., RepoBench, SWE-Bench, Magicoder, MBPP), tool use (BFCL), SQL (Spider), multi-hop QA (HotpotQA, MuSiQue, 2WikiMHQA), long-document summarization (InfiniteBench, CNN/DM, GovReport), and chat (Alpaca, MT-Bench). Each workload uses 100 held-out test requests (1,600 total), disjoint from training and validation data.
- Training: The Llama-3.1-8B predictor is trained on 10,000 source-balanced requests.
- Expert Pool: For comparing against HedgeSpec, the authors also evaluate on HedgeSpec's seven-domain dataset and released EAGLE experts.
Key Insights and Ideas
- Comparing costs is the biggest driver of speed: Choosing the action with the longest predicted commitment (ignoring cost) drops speedup by 16%. A cheap, short copy often beats an expensive, slightly longer neural draft.
- Target hidden states matter: Using prefix statistics alone only teaches the router to arbitrate between copying and EAGLE-3. Adding the target model's hidden states unlocks N-gram lookup and the Draft LM (which together commit 16% of tokens) and boosts overall speedup.
- One predictor, many deployments: Because payoff depends on the text and cost depends on the hardware, a single trained payoff predictor transfers unchanged across GPUs (A40, H200) and batch sizes (1, 4, 16). Recalibrating the cost model alone shifts the policy—for example, moving 83% of tokens from EAGLE-3 to SAM copying at batch size 16, where tree verification becomes too expensive.
Key Results
- Beats fixed drafters and tuned hybrids: On greedy decoding at batch size 1, SpecRouter achieves 2.75× speedup on Llama-3.1-8B and 2.95× on Qwen3-8B—30% and 27% faster than fixed EAGLE-3 (2.12× and 2.33×), and ahead of SuffixDecoding-style and HVD-style threshold hybrids. It even beats the per-workload best fixed action chosen in hindsight on 15 of 16 Llama and 13 of 16 Qwen workloads.
- Holds across sampling, thinking mode, and scale: Under sampling, SpecRouter stays 26–28% faster than EAGLE-3. With Qwen3's thinking mode enabled, it adapts to the shift in best drafter and beats the best single drafter by 14%. On larger targets, it beats EAGLE-3 by 25% on Qwen3-32B (2.66× vs. 2.13×) and 37% on Llama-3.3-70B (3.61× vs. 2.64×).
- Outperforms online selectors: On a shared five-action pool, SpecRouter reaches 2.77× versus 1.80× (UCB) and 1.73× (EXP3). On HedgeSpec's own seven-domain expert pool, SpecRouter reaches 4.16× versus HedgeSpec's 3.79×, without using domain labels.
- Batched serving: Across A40 and H200 GPUs at batch sizes 1, 4, and 16, a single SpecRouter checkpoint is the fastest policy in all six settings and meets every p90 latency target (25, 50, and 100 ms) that any fixed policy meets.
Limitations and Future Work
- Offline collection & memory: Collecting dense counterfactual labels for all actions at every training prefix is compute-intensive (~120 A40 GPU-hours for 10,000 Llama requests). At inference, keeping multiple neural drafters resident adds ~3.3 GB of GPU memory.
- Reproducibility requirement: Exact offline labels and cross-deployment transfer rely on proposals and verification being reproducible across backends; changing an action's proposals requires relabeling that action.
- Future directions: Extending the interface to cross-request suffix caches and continuous batching with per-request action selection are natural next steps.
Summary updated