NeurIPS 2026

Test-Time Speculation

The University of Texas at Austin
Overview

Speculative decoding accelerates LLM inference by using a fast draft model to generate tokens and a more accurate target model to verify them. Its performance depends on the acceptance length, or number of draft tokens accepted by the target. Our studies show that the acceptance length of even state-of-the-art speculators, like DFlash, EAGLE-3, and PARD, degrades with generation length, reaching values close to 1 (i.e., no speedup) within a few thousand output tokens, making speculators ineffective for long-response tasks. Acceptance lengths decline because most speculators are trained offline on short sequences, but are forced to match the target on much longer outputs at inference, well beyond their training distribution.

To address this issue, we propose Test-Time Speculation (TTS), an online distillation approach that continuously adapts the speculator at test time. TTS leverages the key insight that the token verification step already invokes the target model for each draft token, providing the training signal needed to adapt the draft at no additional cost. Treating the draft as the student and the target as the teacher, TTS adjusts the draft over several speculation rounds, with each update improving the draft's accuracy as generation proceeds.

A two-minute overview

Acceptance length degrades with generation length

The speedup from speculative decoding depends on the number of draft tokens the target model accepts per round, called the acceptance length. An acceptance length of one means that only a single token is accepted per round, yielding no speedup.

Our studies show that the acceptance length of state-of-the-art speculators (EAGLE-3, DFlash, and PARD) degrades steadily with generation length. For example, on LiveCodeBench with Qwen3-8B, the acceptance length of EAGLE-3 drops to 1.1 after 20K output tokens, effectively eliminating the speedup.

Acceptance length with generation length

The figure below shows the acceptance length as a function of output length for various speculator and target model pairs. A value close to 1 indicates no speedup with speculative decoding.

Speculator
Target

Experimental setup
  • Serving stack: vLLM 0.19.2rc1.dev208 (commit 1e9f19ca3) with a small scheduler patch that logs the drafted and accepted tokens of every speculation round. PyTorch 2.11, NVIDIA H200 GPUs.
  • Decoding: greedy (temperature 0), 16 speculative tokens per round, outputs capped at 36,864 tokens (16,384 for the EAGLE-3 run on Qwen3-30B-A3B). Thinking is enabled for Qwen targets and reasoning effort is high for GPT-OSS targets.
  • Speculators: public checkpoints. The checkpoint name is shown under the plot.
  • Acceptance length: one plus the mean number of accepted draft tokens per round, averaged over 2K-token windows of output position. Windows that only a handful of responses reach are left out.

The trend holds across the speculators and target models above, from 4B to 122B parameters.

Why acceptance length degrades

Speculators are typically trained on instruction-following datasets such as ShareGPT and UltraChat, which comprise sequences that are typically shorter than 2K tokens. In contrast, reasoning models produce tens of thousands of tokens before arriving at the final answer. Consequently, the speculator is forced to match the target at generation lengths well beyond its training distribution during inference.

Response length: training data versus reasoning outputs

Tokens on a log scale. Each dot is one response from Qwen3-8B with thinking enabled.

Training data measured as
Speculator training dataReasoning benchmark outputs

Generation was capped at 36,864 tokens, so the longest outputs pile up at that limit.

Experimental setup
  • Training data: ShareGPT and UltraChat, tokenized with the Qwen3 tokenizer on a random sample of 20K conversations each.
  • Benchmark outputs: generated by Qwen3-8B with thinking enabled and greedy decoding (temperature 0), capped at 36,864 tokens. Speculative decoding is lossless, so these lengths do not depend on the speculator.

We measure the resulting divergence directly. As the output grows, the entropy of the target decreases, i.e., the target becomes more confident about the next token. At the same time, the cross-entropy of the draft on the target's top-1 token increases, i.e., the draft becomes less able to predict it. This holds both for tokens that already appear in the context and for unseen tokens.

Target entropy and draft cross-entropy over output length
Llama3.1-8B (target) with EAGLE-3 (draft). (a) Target entropy falls with output length. (b) The draft's cross-entropy on the target's top-1 token rises sharply. (c) The gap persists for both repeated and unseen tokens.

This motivates adapting the speculator at test time.

Our Proposal: Test-Time Speculation

We propose Test-Time Speculation (TTS), an online distillation approach that adapts the speculator to match the target's distribution at inference time. Our core insight is that the standard speculative decoding workflow already has all the ingredients for on-policy online distillation. In each speculation round, the token verification step invokes the target model on each token in the draft canvas. Therefore, we naturally have access to both the speculator's and the target's probabilities for each token. This provides the supervision needed to adapt the speculator at no additional cost.

TTS leverages this signal by treating the target as the teacher, the speculator as the student, and each generated-and-verified canvas as a distillation sample. After each verification, the speculator takes one gradient step before generating the next canvas. In practice, the update need not be applied after every round and can instead be applied once every \(\mathcal{S}\) rounds, where \(\mathcal{S}\) is the update stride.

Canvas of Cdraft tokens Target distributions The training signal Updated speculator Drafts the next canvas Repeats every round Student · Speculator 1. Draft Proposes a canvas of Ctokens, as in ordinary speculative decoding. Teacher · Target 2. Verify Scores the canvas in one forward pass and accepts a prefix. Student learns from teacher 3. Update Takes one gradient step toward the target's distributions on the canvas.
1

Draft

The current draft \(q_t\) proposes a canvas of \(C\) tokens, as in ordinary speculative decoding.

2

Verify

The target \(p\) scores the whole canvas in one forward pass and accepts a prefix by rejection sampling. The output distribution is exactly the target's.

3

Update

The draft takes one gradient step toward the target's distributions on that canvas, with a regularizer that keeps it close to its previous state.

Each update takes one optimization step on the loss below, which contains two terms. The first term is a distillation loss that pulls the speculator toward the target's distribution on the canvas. The second term is a regularizer that prevents the speculator from drifting too far from its current state.

\[ L_t(q) \;=\; \underbrace{\sum_{k=1}^{C} w_k\, \mathrm{KL}\big(p(\cdot \mid x_{1:t+k-1}) \,\big\|\, q(\cdot \mid x_{1:t+k-1})\big)}_{\text{distillation}} \;+\; \lambda \underbrace{\sum_{k=1}^{C} w_k\, \mathrm{KL}\big(q_t(\cdot \mid x_{1:t+k-1}) \,\big\|\, q(\cdot \mid x_{1:t+k-1})\big)}_{\text{regularization}} \]

where \(p\) is the target, \(q_t\) is the current speculator, \(q\) is the updated speculator, \(C\) is the canvas length, and \(\lambda\) sets the strength of the regularizer. The weights \(w_k\) decrease with position \(k\), as a rejected token invalidates all subsequent canvas tokens.

Inference engine optimizations for throughput

Adapting the speculator requires an additional backward pass and optimizer step. Thus, a higher acceptance length does not by itself guarantee higher end-to-end throughput. We address this with two optimizations, both implemented in SGLang v0.5.12, a production inference engine.

Strided, asynchronous updates

TTS updates the draft once every \(\mathcal{S}\) rounds and offloads the update to a dedicated CUDA stream that runs in parallel with the next \(\mathcal{S}-1\) speculate-verify rounds, keeping it off the critical path.

Per-request LoRA for batching

In batched serving, an update driven by one request would corrupt the draft for every other request. TTS freezes the shared speculator and trains a rank-16 LoRA adapter per request, which reduces the overhead of adapting a private speculator from about 2,445 MB to 28.6 MB per request on each GPU for Qwen3.5-122B-A10B. This enables a memory saving of about 86×.

Execution timeline of strided, asynchronous TTS updates
Every \(\mathcal{S}\) rounds, a gradient update is dispatched to a side stream and overlaps with the following rounds on the main stream.

Results

72%
maximum improvement in acceptance length
41%
average improvement in acceptance length
2.4×
maximum throughput improvement over DFlash in batched serving
10
target models, from 4B to 229B parameters

We evaluate TTS with the DFlash, EAGLE-3, and PARD speculators on target models from the Qwen-3, Qwen-3.5, DeepSeek-R1, GPT-OSS, MiniMax, and Llama3.1 families.

Acceptance length of three speculators and the improvement from TTS
LiveCodeBench on Qwen3-8B. (a) All three speculators decay toward an acceptance length of 1. (b) TTS adapts the draft in real time and consistently improves acceptance length.

Improvements scale with output length

Each update improves the draft's accuracy on the current response, so the improvement over the baseline increases as generation proceeds.

TTS versus DFlash on AIME 2024 and LiveCodeBench
Acceptance length of TTS versus DFlash for (a) AIME 2024 and (b) LiveCodeBench on Qwen3-8B. The improvement (%) increases sharply with output length as TTS refines the drafter.

Multi-turn agentic workloads

We evaluate on multi-turn agentic tasks from OpenThoughts, orchestrated by the Terminus-2 agent protocol with MiniMax-M2.5 as the target. The acceptance length of DFlash falls from 3.1 to 1.8 over the session, whereas TTS sustains it between 3.3 and 3.4, improving over DFlash by 86% at turn 15.

Acceptance length across agentic turns with MiniMax-M2.5
Acceptance length (AL) of TTS versus DFlash on multi-turn agentic tasks from OpenThoughts with MiniMax-M2.5 as the target. (a) The AL of DFlash degrades as the session progresses, whereas TTS sustains it across turns. (b) The improvement (%) of TTS over DFlash grows with turns, reaching 86% at turn 15, as TTS keeps adapting the draft throughout the session.

Throughput under batched serving

The table below reports throughput (tokens/sec) on Qwen3.5-122B-A10B relative to the DFlash speculator, with per-request LoRA adapters and \(\mathcal{S}=10\). As the baseline acceptance lengths are lower on this large target, TTS has more headroom and improves throughput by up to 2.4×. For a single request, \(\mathcal{S}=5\) improves throughput over DFlash by 1.54× on average and up to 1.71×.

BenchmarkApproachBatch Size
8163264
AIME 2024DFlash241.2313.5423.1384.9
TTS428.61.78×551.71.76×930.92.20×585.11.52×
GPQA DiamondDFlash192.0257.1428.2289.7
TTS381.81.99×543.92.12×728.71.70×521.61.80×
TheoremQADFlash233.8289.1439.9313.0
TTS511.92.19×661.32.29×987.92.25×663.52.12×
OlympiadBench-MathDFlash193.9267.7392.9196.8
TTS444.82.29×575.82.15×908.42.31×466.92.37×

TTS reduces the draft–target divergence

With TTS, the cross-entropy of the speculator on the target's top-1 token no longer increases with output length, as TTS keeps adapting the speculator to the target throughout generation.

Cross-entropy of EAGLE-3 with and without TTS
Cross-entropy of EAGLE-3 on the Llama3.1-8B target's top-1 token. At longer output lengths, EAGLE-3 diverges from the target; TTS reduces this divergence by adapting the draft in real time.

BibTeX

@inproceedings{kumar2026test,
  title     = {Test-Time Speculation},
  author    = {Kumar, Avinash and Sanghavi, Sujay and Das, Poulami},
  booktitle = {Advances in Neural Information Processing Systems},
  year      = {2026}
}