ArXiv: 2402.11131
🎯 Pitch
A single model can match or beat two-model speculative decoding by fusing drafting directly into the target—achieving up to 3.1× speedups without an auxiliary draft model, and using ~10,000× fewer extra parameters than Medusa-style architectures. The trick is entirely eliminating the autoregressive drafting cost; when speculation and verification happen in parallel within one forward pass, the single-model approach surpasses standard draft–target setups.
1. Executive Summary
This paper introduces Speculative Streaming, a single-model speculative decoding method that fuses token drafting directly into the target model by replacing the fine-tuning objective from next-token prediction to future n-gram prediction, eliminating the auxiliary draft model that standard speculative decoding requires. Evaluated across diverse downstream tasks—Summarization (Dialogsum), Structured Queries (sql-create-context), and Meaning Representation (E2E-NLG)—on OPT (1.3B, 6.7B), Phi-1.3b, and OpenLlama-7b models, Speculative Streaming achieves 1.8–3.1× wall-time speedups without degrading generation quality, matching or exceeding Medusa-style architectures while using ~10,000× fewer extra parameters (e.g., ~4.1 × 10⁴ parameters vs. 4.3 × 10⁸ for Medusa on OPT-1.3b). The method also surpasses standard draft-target speculative decoding in wall-time latency by parallelizing speculation and verification within a single forward pass—removing autoregressive drafting overhead—establishing that single-model speculation is competitive with two-model approaches only when drafting cost is eliminated through architectural fusion.
2. Context and Motivation
The Core Problem: The Autoregressive Inference Bottleneck
Large language models have become the dominant paradigm for text generation, but their inference is fundamentally bottlenecked by memory bandwidth rather than computation. When generating text autoregressively—one token at a time, each new token depending on all previous tokens—the model must load its full weight matrix and key-value cache from memory for every single generated token. As Pope et al. (2023) established, this makes large transformer inference memory-bound: the GPU's compute units sit idle waiting for data to arrive from memory, with arithmetic intensity (FLOPs per byte transferred) far below what modern accelerators can sustain.
This is not a minor inefficiency—it is the central obstacle to deploying LLMs in user-facing applications. Consider a chatbot that needs to respond in under 200ms to feel responsive to a user. If each token generation requires loading gigabytes of weights from memory at bandwidths of ~2 TB/s (typical HBM on an A100), generating even 50 tokens can push well past acceptable latency thresholds. The problem grows worse as models scale: larger models mean more weights to load per token, widening the gap between memory bandwidth and what would be needed for real-time generation. The autoregressive pattern also prevents batching across tokens within a single sequence, since each token depends on the previous one—unlike prefill, where many prompt tokens can be processed in parallel.
The paper frames this explicitly in Section 1:
"scaling up these models, besides making each call more compute-intensive, also makes their autoregressive generation memory bound (Pope et al., 2023), preventing them from making effective use of available compute. This poses a significant challenge to the deployment of large autoregressive transformers, particularly for user-facing applications with tight latency requirements."
The practical consequence is that GPUs are underutilized during generation—the paper shows in Figure 3 that standard autoregressive decoding achieves low kernel utilization compared to what the hardware can deliver. This is compute capacity that is physically present but cannot be used because the workload pattern (one token at a time, memory-bound) prevents it from being accessed.
The Promise and Limitations of Speculative Decoding
Speculative decoding, introduced independently by Leviathan et al. (2023) and Chen et al. (2023), addresses this bottleneck through a conceptually elegant idea: use a smaller, faster "draft" model to propose multiple future tokens, then verify all of them in parallel with the large "target" model in a single forward pass. The target model processes the proposed tokens simultaneously (not sequentially), so the memory bandwidth cost of loading model weights is amortized across multiple verified tokens. If the draft model is accurate, most proposed tokens are accepted, and the net tokens-per-forward-pass increases substantially—yielding 2–3× wall-time speedups with a well-tuned draft model.
The mechanism works as follows:
- The draft model runs autoregressively to generate candidate tokens (e.g., 4–8 tokens).
- The target model takes these tokens as a batch, processes them in one forward pass, and outputs probability distributions for each position.
- A verification step compares the draft's predictions against the target's distributions. Tokens are accepted until a mismatch is detected; the target then generates one additional correction token.
- The process repeats: draft model generates new candidates from the corrected position, target verifies them.
This breaks the memory-bound pattern because the target model's forward pass now processes tokens simultaneously rather than one at a time, increasing arithmetic intensity.
However, this two-model paradigm introduces substantial practical friction, which the paper identifies across multiple dimensions:
System complexity and deployment overhead. Hosting two separate models during inference doubles the memory footprint for model weights and requires orchestrating a sequential handoff—draft generates, target verifies, draft generates again, and so on. As shown in Figure 1(a) and the kernel utilization timeline in Figure 10, speculation and verification run in serial, not parallel: the target model idles while the draft generates, and the draft model idles while the target verifies. This serial dependency means that even if the target model's verification step is fast (because it processes multiple tokens at once), the overall pipeline still includes an autoregressive drafting phase that is inherently memory-bound and low-utilization.
Training and alignment burden. Off-the-shelf draft models rarely work well without task-specific tuning. As the paper notes:
"directly using an off-the-shelf draft model often leads to sub-optimal performance in many downstream applications. The speculated tokens frequently fail the verification of the target model when draft and target models are misaligned."
This means that for each downstream task—SQL generation, summarization, meaning representation—both the draft and target models must be fine-tuned. The draft model must learn to predict tokens that the target model would accept, not just tokens that are generally plausible. This is a non-trivial alignment problem: the draft and target models have different architectures, different training distributions, and potentially different tokenization, making consistent acceptance rates difficult to achieve without careful joint optimization (as explored in Zhou et al., 2023's DistillSpec).
Resource inefficiency for resource-constrained devices. On mobile phones, edge devices, or even consumer GPUs, loading two models into memory simultaneously may simply be infeasible. The paper explicitly calls this out:
"It is also not resource-efficient, requiring to host two models in memory during token prediction. This increased footprint is especially unsatisfactory for resource-constrained devices."
This matters because on-device inference is precisely where latency and memory constraints are tightest. A technique that accelerates large-model inference but requires doubling the memory footprint is least applicable where it is most needed.
Draft model selection is application-dependent. The paper's analysis in Equation 6 and Figure 4 formalizes a subtle but important point: the effectiveness of draft-target speculative decoding depends on the latency ratio between target and draft models () and the acceptance rate (determining , tokens advanced per verification step). Achieving high speedups requires both a small draft model (for high latency ratio) and a well-aligned draft model (for high acceptance rate)—two properties that are often in tension. As draft models get smaller (reducing ), their predictions become less accurate (reducing ), and the net benefit can vanish. Finding the sweet spot requires "significant engineering efforts" per the paper, and this sweet spot varies by application.
The Rise of Single-Model Speculation and Its Own Limitations
Recognizing the draft model burden, recent work explored doing speculative decoding without a separate model. The most prominent approach is Medusa (Cai et al., 2023), which adds multiple prediction heads to the final layer of the target model. Each Medusa head is a separate linear layer (or small residual block) that predicts a token at a specific future position: head predicts , head predicts , and so on. During inference, all heads generate predictions from the same hidden state in parallel, creating a draft that is verified by the base model's original output head (for ) acting as verifier.
Medusa eliminates the separate draft model—a major simplification. However, it introduces a different burden: each Medusa head adds approximately parameters, where is the hidden dimension and is the vocabulary size. For a model like OPT-1.3b with hidden size 2048 and vocabulary 50272, each head contributes roughly parameters. With 4 heads (matching 4 speculative positions), this is approximately additional parameters—roughly one-third of the original model's parameter count.
This parameter overhead is problematic for several reasons:
- Memory footprint: On resource-constrained devices, adding hundreds of millions of parameters to an already-large model may exceed available memory.
- Memory-bound nature of decoding: Since autoregressive generation is memory-bound, increasing the total parameter count directly increases the amount of data that must be loaded from memory for each forward pass—potentially offsetting the latency gains from speculating more tokens.
- Linear scaling with speculation window: If a downstream task benefits from a larger speculation window (higher ), the parameter cost scales linearly—each additional future position requires another full-sized head.
The paper also notes a subtler architectural limitation: Medusa heads generate tokens independently from a shared hidden state, without an attention mechanism linking the predictions:
"Medusa heads generate each token independently from the shared hidden state of the last layer, and dependency between speculative tokens predicted by medusa heads, and next token predicted by the base model at time step may not be well captured since there no attention mechanism involved."
This means that Medusa cannot model dependencies between speculated tokens—each head makes its prediction in isolation, unaware of what other heads are predicting. In contrast, the original two-model speculative decoding does capture such dependencies because the draft model generates tokens autoregressively, conditioning each new token on previously generated ones.
Where Lookahead Decoding and Other Alternatives Fall Short
Lookahead decoding (Fu et al., 2023) represents yet another single-model approach. It uses Jacobi decoding—repeatedly re-predicting future tokens from partially generated sequences—combined with an n-gram history cache to identify matching patterns. This requires no additional parameters or training, which is appealing. However, its effectiveness depends on the existence of repeated n-gram patterns in the generated text, and it cannot learn to improve speculation quality on specific downstream tasks. The paper positions Speculative Streaming as achieving n-gram prediction through learned mechanisms (stream embeddings that are fine-tuned), enabling task-specific adaptation that lookahead decoding cannot achieve.
Other SD variants (Sun et al., 2023b's SpecTr; Miao et al., 2023's SpecInfer; Spector & Re, 2023's staged SD) improve acceptance rates through batched or tree-structured speculation, but all fundamentally retain the two-model paradigm and its associated deployment complexity. They optimize how drafts are generated and verified, not whether a separate draft model is needed.
How Speculative Streaming Positions Itself
The paper's central design goal is to achieve the speedups of speculative decoding without any of its deployment burdens and without Medusa's parameter overhead. The innovation is architectural: rather than adding prediction heads to the output layer (Medusa) or running a separate model (standard SD), Speculative Streaming modifies the attention mechanism of the target model itself to include additional "speculative streams" that generate future-token predictions as a byproduct of the normal forward pass.
This is accomplished through two key design decisions that directly address the limitations of prior work:
-
Multi-stream attention (MSA) in the top layers of the target model, which computes additional self-attention queries for speculative streams that attend to the main stream's key-value cache without requiring separate KV storage. This captures token dependencies (unlike Medusa's independent heads) while adding negligible caching overhead.
-
Parallel speculation and verification: In each forward pass, the model simultaneously verifies the previous speculative draft (via the main stream) and generates a new draft (via speculative streams), eliminating the idle time between draft generation and verification that plagues standard SD. As Figure 10 shows, this keeps kernel utilization consistently higher than the draft-target approach.
The training objective shift from next-token prediction to joint n-gram prediction (Equation 5) embeds the notion of future-token planning directly into the fine-tuning process, so that the model learns to produce coherent multi-token drafts as part of its normal operation. The parameter cost for this capability is essentially just the stream identifier embeddings and a small early-exit adapter for tree pruning—totaling parameters (e.g., for the 1.3B models, or roughly total with the pruning adapter), which is ~10,000× fewer than Medusa's additional parameters.
The paper thus positions Speculative Streaming at the intersection of two trends: the efficiency of single-model speculation (no separate draft model to train, align, and host) and the quality of attention-based token dependency modeling (unlike head-based independent prediction). By unifying speculation and verification into a single fused forward pass, it targets the deployment scenarios—resource-constrained devices, multi-application settings where training separate draft models per task is infeasible, and latency-sensitive user-facing applications—where existing speculative decoding approaches are least practical.
3. Technical Approach
3.1 Reader Orientation
What is being built: Speculative Streaming is a modified decoder-only language model that, in a single forward pass, simultaneously verifies a previously proposed multi-token draft and generates a new tree of candidate future tokens for verification in the next pass. The core problem it solves is the memory-bandwidth bottleneck of autoregressive generation: standard models waste available compute because loading weights for one token at a time cannot saturate GPU arithmetic units. The "shape" of the solution is to fuse additional "speculative streams" of self-attention into the top layers of the target model itself—streams that attend to the main stream's key-value cache, require no additional KV storage, and produce future-token predictions as a side effect of the normal forward pass, thereby replacing the separate draft model with roughly 10,000× fewer extra parameters than Medusa-style approaches.
3.2 Big-Picture Architecture (Diagram in Words)
The system has five major components that interact in a cyclic pipeline during generation:
-
Base Decoder-Only LM with LoRA Adapters — a pre-trained transformer (OPT, Phi, OpenLlama) fine-tuned on the downstream task. It generates the "main stream" of hidden states that produce the verified next token. It is modified by replacing the self-attention in its top layers with multi-stream attention.
-
Multi-Stream Attention (MSA) Layers — the top transformer layers compute not just one self-attention query (the main stream) but queries: one main query and speculative queries. Each speculative stream produces a hidden state that predicts the token at position , i.e., steps ahead of the current main-stream token. These streams attend to the main stream's key-value cache (no separate KV storage) and to each other in causal order, capturing dependencies between speculated tokens.
-
Stream Initialization Module — at layer , hidden states from the main stream are transformed (via identity or a low-rank linear map) into initial hidden states for the speculative streams, which are then offset by learned "stream identifier embeddings" that encode the relative position . This means speculative streams only pass through the top layers, reducing their computational cost.
-
Parallel Tree Draft Manager — at each forward pass, the speculative streams from the previous pass produced logits . Top- tokens are sampled from each, forming a tree where tokens from stream are parents of tokens from stream . This tree is flattened and batched for verification. A tree-pruning layer (early-exit adapter) removes low-probability branches before the MSA layers, controlling batch size growth. After verification, the longest accepted path is determined, and new speculative tokens are sampled from the streams at the accepted position's main-stream hidden state.
-
Training Objective (Joint N-Gram Prediction) — the model is fine-tuned end-to-end on a loss that includes cross-entropy for the next token (main stream) and for future tokens (speculative streams), each weighted by coefficients and . This trains the model to plan ahead: the speculative streams learn to predict tokens that the main stream would produce at future positions.
Information flow during generation (Figure 2 and Figure 7):
- Prompt processing: The prompt is processed through standard multi-head attention (MHA) layers to produce main-stream hidden states for the last prompt token.
- Stream insertion: At layer , speculative streams are initialized from the main stream's hidden state via .
- MSA processing: The batch (main stream + speculative streams for all tree nodes) passes through the top MSA layers. The main stream produces logits for verification; speculative streams produce logits for future tokens.
- Tree pruning: Between layers and the MSA layers, an early-exit adapter predicts transition probabilities for each parent-child edge in the tree; edges below a threshold are pruned.
- Verification: The target model's main-stream logits are compared against the drafted tokens. The longest prefix that matches (using either hard or soft matching) is accepted. The target generates one correction token at the rejection point.
- Re-sampling: The accepted main-stream token becomes the new root. Speculative streams attached to this root generate a new tree of candidate tokens for the next forward pass.
- Repeat from step 3 with the new tree draft as the batch input. The KV cache of main-stream tokens is retained; speculative stream hidden states are recomputed each pass (since there is no speculative KV cache).
3.3 Roadmap for the Deep Dive
- First, the training objective shift (Equation 5)—from next-token prediction to joint n-gram prediction—because this is the foundational change that teaches the model to plan ahead, and everything downstream depends on the quality of the learned future-token distributions.
- Second, the Multi-Stream Attention mechanism (Equations 1–2)—the architectural modification that creates additional self-attention streams within the top layers, allowing future-token prediction as a byproduct of the forward pass.
- Third, the stream initialization scheme (Equation 3)—how speculative streams are created from the main stream's hidden states at a mid-network insertion point, including the role of stream identifier embeddings and the efficiency rationale for mid-layer insertion.
- Fourth, the parallel speculation and verification loop (Equation 4, Figures 7–8)—the tree-draft construction, attention masking, batching, and the verification procedure that simultaneously checks the previous draft and produces the next one in a single forward pass.
- Fifth, the tree-pruning mechanism—the early-exit adapter that estimates transition probabilities and prunes low-probability branches to prevent exponential batch-size growth without requiring a proxy model.
- Finally, the cost analysis and comparison framework (Equation 6, Figure 4)—the formal model for comparing wall-time latency between draft-target SD and Speculative Streaming, which explains when each approach is preferable.
3.4 Detailed, Sentence-Based Technical Breakdown
This is primarily a systems and architecture paper whose core idea is that speculative decoding can be performed within a single model by adding multiple self-attention streams to the top layers, trained via a joint n-gram prediction objective, and run in a parallel speculation-verification loop that eliminates idle drafting time. The key technical innovation is not a new algorithm for verification or acceptance, but rather a parameter-efficient architectural fusion of the draft model's role into the target model's attention mechanism.
The Joint N-Gram Prediction Training Objective
The paper begins with a modification to the fine-tuning objective. Standard fine-tuning of decoder-only LMs minimizes the negative log-likelihood of the next token given the context and previous target tokens:
where is the target token at position , are all target tokens before position , is the input context, and represents all model parameters (including LoRA adapters).
Speculative Streaming replaces this single-term objective with a weighted sum of prediction losses, one for the immediate next token and one for each of future tokens:
where is the number of future positions to predict (the speculation window), is the weight for the immediate next-token loss, is the weight for the loss predicting the token steps ahead, and the inner sum for each runs from to (because at the end of a sequence, there are fewer than remaining tokens to predict).
What it computes: For each training sequence, the model computes separate cross-entropy losses at each position . The first term penalises errors in predicting (the next token, as in standard fine-tuning). The second term, for each from 1 to , penalises errors in predicting —the token that should appear positions after —based on the same context and input . The total loss is a weighted combination, with the paper setting and for all , meaning the speculative losses receive one-tenth the weight of the main prediction loss. The sum over averages these losses across all positions in the sequence, so the model learns to predict future tokens from every prefix.
Why this form: The objective directly incentivises the model to develop representations that anticipate future tokens—what the paper calls "a notion of future token planning." Without the speculative terms, the model only learns to maximise ; there is no training signal encouraging it to maintain information useful for predicting , etc. By adding these auxiliary losses, the speculative streams (which are initialised from mid-layer hidden states—see Equation 3) are trained to extract forward-looking features. The weight prevents the auxiliary losses from dominating training and degrading the primary next-token quality, while still providing sufficient gradient to the stream-specific parameters (stream identifier embeddings and the stream initialization transform ). An alternative would be to train the speculative streams separately after fixing the main model, but joint end-to-end training ensures that the main stream's representations are compatible with—and even helpful for—the speculative predictions, naturally aligning speculation and verification.
The paper reports that training times for this objective are "comparable to (Cai et al., 2023) style approach for ," where is the number of top layers modified with MSA. This is because the additional forward-pass computation for speculative streams is small relative to the base model, and the loss computation for the extra terms adds negligible overhead compared to the self-attention computations.
Multi-Stream Attention: The Architectural Modification
The core architectural change is replacing the standard multi-head self-attention in the top transformer layers with Multi-Stream Attention (MSA). In standard attention, each position produces one query vector, one key vector, and one value vector. In MSA, each position produces one main-stream query and speculative-stream queries, while the key and value projections remain shared across all streams.
Main-stream attention (Equation 1):
where denotes the hidden state of the main stream at layer and time step , denotes all main-stream hidden states from time steps through at layer , and is the standard multi-head attention operation (Vaswani et al., 2017) that computes and wraps it with residual connections and feed-forward layers.
What it computes: This is identical to standard decoder self-attention: the main stream at position queries all previous main-stream positions (including itself, due to causal masking being applied to keys), attends to them, and produces an updated hidden state . This is the mechanism that produces the verified next-token prediction.
Speculative-stream attention (Equation 2):
where is the hidden state of speculative stream at layer and time step , is all main-stream hidden states up to , are all speculative-stream hidden states at time with indices , and denotes concatenation along the sequence dimension.
What it computes: Speculative stream at position produces a query from its own hidden state , while the keys and values come from two sources concatenated together: (a) all main-stream hidden states from positions through , and (b) all speculative-stream hidden states at the same time but with indices up to (i.e., streams and the current stream itself). This means that speculative stream can attend to the entire main-stream history (providing rich contextual features) and to earlier speculative streams at the same position (capturing inter-token dependencies, such as knowing what was predicted for ). The crucial design property is that speculative streams are not attending across different time steps: the concatenation on the key/value side is on the main-stream time dimension but only on the stream-index dimension at the current time step. This avoids creating a separate KV cache for each speculative stream—they reuse the main stream's KV cache and the speculative stream's own hidden states from the same position.
Why this form: The design achieves three goals simultaneously:
- No additional KV caching overhead: Unlike standard attention where each new query position requires adding its KV projections to the cache, speculative streams do not persist their KV projections across time steps. They only attend to the main stream's cache (which already exists) and to other speculative streams at the current time step (which are computed on-the-fly and discarded after the forward pass). This is critical for memory-constrained devices: the memory footprint for KV cache grows only with the sequence length of main-stream tokens, not with the number of speculative streams or tree branches.
- Capturing token dependencies: Because speculative stream attends to streams , it can learn dependencies between consecutive future tokens. For example, stream 2 (predicting ) can see what stream 1 (predicting ) is thinking about, enabling coherent multi-token drafts. Medusa lacks this because each head predicts independently from the same hidden state.
- Computational efficiency via mid-layer insertion: Since speculative streams are only present in the top layers (they are inserted at layer ), they avoid the computational cost of passing through the bottom layers. The paper states this "decreases the speculative FLOPs contribution by ."
The number of MSA layers, , is a hyperparameter traded off against generation quality and computational cost. As shown in Figure 6, increasing improves downstream metrics (more MSA layers allow better future-token prediction), but also increases training time and FLOPs. The paper finds that of 2–8 layers offers a good balance, with specific choices of being 1/6 for Structured Queries (more emphasis on efficiency) and 1/2 for Summarization and Meaning Representation (more emphasis on quality).
Stream Initialization: From Main Stream to Speculative Streams
Speculative streams are not present from the start of the network. They are created at a specific insertion point, layer , using the main stream's hidden state at that layer as the starting point. The initialization formula (Equation 3) is:
where is the initial hidden state of speculative stream at time step and layer (the insertion layer), is the main stream's hidden state at the same time step and layer, is a linear transformation of rank that maps the main-stream hidden state to the speculative-stream hidden space, and is a learned stream identifier embedding specific to stream and the insertion layer.
What it computes: For each token position and each speculative stream , the system takes the main stream's hidden state at layer , optionally transforms it through a low-rank linear map , and adds a per-stream learned embedding . The result is the initial hidden state for that speculative stream, which then passes through the remaining MSA layers to produce the final speculative logits. The main stream continues through all layers independently (through MHA for layers onward, but effectively computing alongside speculative streams in MSA layers).
Why this form:
-
Mid-layer insertion reduces computation: By starting speculative streams at layer rather than at the embedding layer, they bypass the bottom layers. The paper explains that this "decreases the speculative FLOPs contribution by " and "helps with peak power consumption on the device." This is important because the overall forward pass becomes more compute-intensive as batch size grows (due to tree drafting), so any FLOPs savings keep the model closer to the memory-bound regime where the additional computation is effectively "free" in wall-time.
-
Mid-layer hidden states contain high-level features: The paper cites Pal et al. (2023) to argue that itself carries "high-level contextual features to aid with the prediction of future n-grams." By initialization from these middle-layer features rather than from raw token embeddings, the speculative streams start with a rich representation that already encodes syntactic and semantic context, making it easier to learn to predict tokens steps ahead.
-
Stream identifier embeddings encode relative position: The embedding serves two purposes: (a) it distinguishes the stream's computation from the main stream (so the model can learn stream-specific behaviours), and (b) it embeds a "sense of relative position" indicating how far ahead ( positions) the stream is predicting. This is critical because without positional information, each speculative stream would compute identical functions of the same input hidden state and produce identical predictions.
-
The transform is empirically optional: The paper reports that "simply using identity transformation achieves similar performance with much less parameter overhead" compared to a trained low-rank linear map. For all experiments in Section 4, is the identity function, meaning speculative streams start as exact copies of the main-stream hidden state, offset only by the learned stream identifier embedding. This reduces the additional parameter count to essentially (the stream identifier embeddings) plus the tree-pruning adapter parameters.
The paper also explores an alternative stream design using value projection rotation (Equation 7 in Appendix B):
where is the main stream's value projection at time and layer , is the stream index, and is a rotation angle ( where is the sum of maximum sequence length and number of streams). This approach differentiates streams by rotating their value projections in proportion to their distance from the main stream, requiring zero additional parameters. However, Figure 9(a) shows that downstream metrics are lower for value rotation than for dedicated stream embeddings at the same , though the gap narrows as increases—at , value rotation actually outperforms stream embeddings at . The paper does not use value rotation in the main experiments, but identifies it as a parameter-free alternative worth further study.
Parallel Speculation and Verification: The Generation Loop
This is the inference-time procedure that achieves the wall-time speedup. Its defining property is that speculation and verification happen in the same forward pass, unlike standard speculative decoding where the draft model runs first, then the target model verifies, sequentially.
Tree draft construction. Rather than generating a single linear sequence of speculated tokens, Speculative Streaming constructs a tree of tokens, enabling the verification step to accept the longest matching path among multiple candidates. The procedure (described in Section 3.2.2 and detailed in Appendix A.1, Figures 7–8):
- From the logits produced by speculative streams at the accepted position , sample the top- tokens from each stream (for greedy decoding, ; for top- sampling, ).
- Treat the tokens sampled from stream as parents of tokens sampled from stream . The tokens from stream 1 are children of the main stream's correction token (the root).
- This produces a tree of depth where each node at level has children. The total tree size before pruning is tokens.
- Flatten the tree along the sequence-length dimension and construct an additive attention mask (Equation 4) such that each node attends only to its ancestors (the path from the root to that node):
where is the -th token sampled from stream , is the -th token sampled from stream , and is the additive attention mask value. A value of permits attention; masks it out after softmax.
What it computes: For any pair of tokens in the flattened tree, this mask allows attention if and only if the first token's stream index () is exactly one more than the second token's stream index ()—meaning the second token is the immediate parent of the first in the speculative tree. Combined with the additive mask incorporating causal masking from earlier time steps, the attention pattern ensures that each node can see all its ancestors back to the root (the main stream's correction token) and no other branches. This enables batching the entire tree as a single sequence for parallel processing.
Why this form: The tree structure increases the probability of accepting multiple tokens per forward pass compared to a linear draft. If one branch contains an implausible token, only that branch is rejected during verification—other branches at the same depth can still be accepted. The additive mask with is the standard technique for implementing tree attention in transformers (used in SpecInfer, Miao et al., 2023), and it reuses the same attention implementation as standard causal masking. The mask is constant for a fixed and , so it can be pre-computed and reused across all forward passes, adding no runtime overhead.
Batching with speculative streams. The flattened tree draft is not processed alone. For each node in the tree, speculative streams must be attached to generate the next tree draft, because the speculative streams need to produce logits for future tokens from the accepted position. This means the total batch size for the MSA layers is:
where accounts for one main stream plus speculative streams per node, and the second factor is the tree size including the root. This is the batch dimension along which the transformer processes tokens in parallel.
The verification step. After the forward pass through the MSA layers, the main stream at each tree node produces a probability distribution over the vocabulary. The verification algorithm:
- Starting from the root (the previous step's correction token), traverse the tree depth-first.
- At each node, compare the drafted token against the main stream's predicted distribution at that position using the rejection sampling scheme from Leviathan et al. (2023): for hard matching (used in the paper), accept the token if the target model's most likely token (greedy) matches the draft token; for soft matching, accept with probability based on the ratio of target to draft probabilities.
- Continue along a branch until a rejection occurs. The longest accepted path (of length , where ) determines how many tokens are advanced in this step.
- At the rejection point, the target model's main-stream logits are used to sample one correction token.
- The total tokens advanced in this forward pass is (accepted drafted tokens plus the correction).
Parallel new draft generation. Simultaneously, the speculative streams at the accepted position (the new root) produce logits , from which a new tree draft is sampled (following the same top- procedure) for verification in the next forward pass. This is the parallelisation: the forward pass that verifies draft also produces draft .
The and hyperparameters. is the speculation window (number of future positions predicted) and is the branching factor (tokens sampled per position for tree construction). As shown in Figure 5, wall-time speedup initially increases with because more candidates mean higher acceptance rates, but eventually decreases as the batch size growth pushes the forward pass into the compute-bound regime where latency grows faster than token advancement. The paper sweeps and , finding that tree pruning is essential for making practical.
Parallel Tree Pruning: Controlling Batch Size Without a Proxy Model
The naive tree construction described above creates a tree of size , which grows exponentially in (or polynomially if is fixed and grows, but still very fast). The corresponding batch size times this becomes prohibitively large, transitioning the model from memory-bound (where additional computation is essentially free) to compute-bound (where each additional token adds proportional latency).
The paper introduces a tree-pruning layer that removes low-probability branches before they enter the MSA layers, reducing the effective tree size without requiring a separate proxy model.
Mechanism: The pruning layer uses an early-exit technique: at some layer (set to in experiments, just before the stream insertion layer), the main stream's hidden state for each tree node is passed through a low-rank linear transformation of rank (keeping parameter overhead minimal):
where is the original language modeling head (the final output projection, reused without modification), and is a vector of "early-exit logits" over the vocabulary.
What it computes: For each edge in the tree (a parent token at position and a child token at position ), the transition probability is approximated as , i.e., the probability assigned to token by the early-exit logits at the parent's position. If this probability falls below a set threshold, the entire subtree rooted at is pruned. The pruning is done "lazily" on the KV cache: already-computed KV entries for pruned nodes in layers are not immediately removed, but are garbage-collected after the generation step to keep pruning latency overhead minimal.
Why this form:
- No proxy model: The early-exit adapter shares the base model's hidden states and language modeling head, so it requires only the low-rank transformation (rank 8, costing roughly parameters—e.g., for OPT-1.3b) and no additional model.
- Reasonable pruning accuracy: At layer , the hidden states have passed through most of the network and contain substantial contextual information, making the approximated transition probabilities credible enough to filter out noisy branches while retaining promising ones. The trade-off: inserting the pruning layer earlier reduces latency more but risks pruning potentially valuable tokens; inserting it later retains more good tokens but adds latency. The paper empirically sets it just before stream insertion.
- Training: The pruning adapter can be trained jointly with the main and speculative streams (on the next-token prediction loss) or post-hoc after stream training. This keeps training simple and aligned with the same objective.
The effect is shown in Figure 5: without pruning, speedup peaks at then declines sharply as increases to and beyond. With pruning, speedup remains high for , demonstrating that pruning successfully removes the exponential batch-size growth overhead while preserving the acceptance-rate benefits of more candidates.
Post-pruning batch size: The pruned tree size is smaller, and only the surviving nodes are batched with speculative streams for the MSA layers. The paper does not provide a formula for the expected pruned size (it depends on the threshold and the data distribution), but Figure 5's speedup trends show that it is substantially smaller than the unpruned tree for .
Cost Analysis: When Speculative Streaming Beats Draft-Target SD
Section 4.1.2 provides a formal model for comparing wall-time latency between standard draft-target speculative decoding and Speculative Streaming. The key insight is that draft-target SD has parallelism inefficiency (idle time during sequential draft generation and verification), while Speculative Streaming has forward-pass overhead (the MSA forward pass is slightly more expensive than a standard forward pass).
The comparison equation (Equation 6):
where is the wall-time latency of one forward pass through the draft model, is the latency through the target model in draft-target SD, is the latency through the Speculative Streaming model (including MSA overhead), is the speculation window (assumed equal for both), is the average number of tokens advanced per target-model forward pass in draft-target SD (which depends on the draft model's acceptance rate), and is the average number of tokens advanced per forward pass in Speculative Streaming.
What it computes: The left side is the average wall-time cost per token advanced for draft-target SD: each verification pass costs (running the draft model autoregressively times to produce the candidate sequence) plus (running the target model once to verify), and this advances tokens on average. The right side is the same quantity for Speculative Streaming: each forward pass costs and advances tokens. Setting them equal gives the break-even condition: if the left side is larger, Speculative Streaming is faster; if the right side is larger, draft-target SD is faster.
Why this form and what it reveals:
-
The draft-target approach has a term: Even if the draft model is fast ( small), it must run times sequentially. This serial overhead is absent from Speculative Streaming, which produces its draft in parallel with verification within a single forward pass. This is the fundamental advantage: sequential fast operations versus one slightly slower parallel operation.
-
The latency ratio is critical: If this ratio is large (target model much slower than draft), the draft-target approach gains because the target verification cost dominates and the draft cost becomes negligible. But as the paper notes, finding a draft model that is simultaneously fast enough (large ratio) and accurate enough (high ) is "challenging" and requires "significant engineering efforts."
-
Speculative Streaming is favoured when : Using the paper's assumption (the MSA forward pass is only slightly more expensive than a standard forward pass, since MSA is applied only in the top layers and the additional computation is memory-bandwidth-limited), the break-even simplifies to , meaning draft-target needs to advance the same number of tokens per target-model call as Speculative Streaming. In practice, the paper finds for the break-even (Figure 4), meaning draft-target SD must be 1.4× more token-efficient per target call to overcome its drafting overhead.
-
Figure 4 generalises this to varying latency ratios: When is large (e.g., 100×, as with a very small draft model), draft-target SD achieves higher theoretical speedups if it can maintain high (acceptance rates). But the paper argues that in multi-application settings where only adapters are fine-tuned—not full models—achieving both a large latency ratio and high is very difficult, favouring Speculative Streaming.
-
The analysis ignores cache adjustment and prompt processing overhead: These add latency in both approaches but differently, and the paper acknowledges this as a limitation. However, the framework provides "valuable intuition to guide the choice between draft-target vs Speculative Streaming approaches."
Practical takeaways from Table 2: For OPT-1.3b and OPT-6.7b across three tasks, Speculative Streaming achieves lower wall-time latencies (in ms) than two-model SD using OPT-125m as draft. The number of target-model calls is higher for Speculative Streaming (e.g., 7.79 vs. 6.59 for OPT-1.3b on SQL), but the draft calls are zero versus 22–42 auto-regressive draft calls. The net result is 30–50% lower wall-time latency, because eliminating the memory-bound auto-regressive drafting phase saves more time than the extra MSA forward passes cost.
Summary of Key Design Choices and Justifications
- Joint n-gram training objective rather than post-hoc head training: embeds future-token alignment into the base model's representations, avoiding the distribution-shift problem that occurs when speculative heads are trained separately from the main model.
- Multi-stream attention in top layers only rather than throughout the network: balances prediction quality (more layers improve future-token prediction, Figure 6) against compute overhead (fewer layers reduce FLOPs and training time).
- Mid-layer stream insertion from main-stream hidden states rather than from the embedding layer: reduces speculative FLOPs by , uses rich mid-network features for initialisation, and avoids the need for a separate embedding of speculated tokens.
- Identity transformation for rather than a trained linear map: achieves similar performance with zero additional parameters, keeping the method parameter-efficient (only stream embeddings plus the pruning adapter).
- Tree-structured speculation with pruning rather than linear drafting: increases acceptance rates through multiple candidate paths, while pruning prevents exponential batch-size blowup without requiring a separate proxy model.
- Parallel speculation and verification rather than sequential: eliminates idle time between draft generation and verification, increasing kernel utilisation (Figure 3) and reducing wall-time latency (Table 2) compared to two-model SD.
- Shared KV cache for main and speculative streams rather than separate caches: keeps memory footprint growth limited to main-stream sequence length, making the method viable for resource-constrained devices.
- Hard matching for verification rather than soft matching: the paper uses hard matching (greedy token equivalence), but notes that relaxing to soft matching "may yield higher speedups" (Cai et al., 2023)—this is left as an extension.
4. Key Insights and Innovations
Innovation 1: Speculation as an Attention Mechanism, Not a Prediction Head
The paper's most fundamental conceptual move is rethinking where speculative capability lives in a model. Prior single-model approaches—most prominently Medusa (Cai et al., 2023)—treat speculation as an output-layer phenomenon: add extra prediction heads to the final hidden state, each responsible for one future position. This is architecturally simple but conceptually impoverished. The final hidden state is a single vector; asking it to simultaneously predict , , , and through independent linear projections forces each head to extract future-relevant information in isolation, without any interaction between heads about what the others are predicting. The paper's Section 4.1.2 analysis captures this precisely: Medusa heads "may not be well captured since there no attention mechanism involved" to model dependencies between speculated tokens.
Speculative Streaming relocates speculation from the output layer to the attention mechanism itself. Multi-stream attention (MSA) adds parallel self-attention queries that attend to the main stream's key-value cache and to each other in causal order—stream can attend to streams at the same position. This is not a superficial engineering difference; it fundamentally changes what the model can represent. A Medusa head computing has no access to what was predicted for . An MSA speculative stream at position sees the hidden states of streams at and , meaning it can learn to produce coherent multi-token phrases rather than independent isolated guesses. The qualitative examples in Appendix D (Figures 11–12) show this coherence in practice: accepted sequences like "parameter-efficient-speculative" and "was a character and he" demonstrate the model producing syntactically and semantically coherent multi-token prefixes, not just plausible individual tokens.
This reframing has implications beyond raw acceptance rates. It suggests that for tasks requiring structured multi-token reasoning—SQL generation with specific syntax patterns, meaning representations with fixed templates, summarisation with common phrasal patterns—the attention-based approach should systematically outperform head-based approaches at the same parameter count because it captures dependencies that independent heads structurally cannot. The paper's evidence for this is indirect (Table 1 shows better or equal speedups with far fewer parameters, but not a parameter-matched comparison of attention-vs-head architectures), but the conceptual argument is strong: attention is the mechanism transformers use to model dependencies, and speculative coherence should benefit from that same mechanism.
Compared to standard two-model speculative decoding, this reframing is equally significant. In the draft-target paradigm, the draft model is a separate autoregressive decoder that models dependencies between speculated tokens naturally (because it generates sequentially). The insight here is that you don't need a separate model to get that dependency modeling—you just need the right attention pattern within the target model. By fusing the draft model's autoregressive dependency structure into the target via multi-stream causal attention, Speculative Streaming achieves what previously required two separate models while using 10,000× fewer extra parameters than Medusa and zero additional models than the target.
Innovation 2: Parallelising the Speculation-Verification Cycle as a First-Class Design Objective
Standard speculative decoding has a structural inefficiency that is easy to overlook: speculation and verification are temporally serialised. The draft model generates tokens autoregressively (memory-bound, low GPU utilisation). Then the target model verifies them in one forward pass (higher utilisation). Then the draft model generates again, idling while waiting for the target. Then the target verifies again, idling while waiting for the draft. This creates a sawtooth utilisation pattern visible in the paper's Figure 10 kernel timeline: bursts of high utilisation during verification separated by valleys of low utilisation during drafting.
Prior work accepted this as inherent to speculative decoding. The draft and target are separate models with separate forward passes; of course they run sequentially. Medusa eliminated the separate model but not the serial dependency: its heads generate a draft, the base model's original head verifies it, and then heads generate again—still two logical phases, even if they happen within one forward pass (the heads and the verification head process the same hidden state, so they are temporally aligned, but the draft being verified is from the previous step's heads).
Speculative Streaming makes parallel speculation and verification a first-class design objective: each forward pass simultaneously verifies the previous draft (via the main stream) and generates a new draft (via speculative streams at the accepted position). This is not a small optimisation; it is an architectural constraint that shapes the entire design. The speculative streams must produce predictions from the current forward pass's hidden states (not cached states), which requires that the streams be inserted mid-network and compute alongside the main stream. The tree draft must be batched with its own speculative streams so that the next draft is already being computed during the verification forward pass. The KV cache design (no speculative-stream KV storage) is partially motivated by this parallelism: if speculative streams persisted KV across time steps, the batch would need to maintain separate caches for each stream at each tree node, exploding memory usage.
The impact on wall-time latency is significant and non-obvious. Table 2 shows that Speculative Streaming makes more target-model calls than draft-target SD (e.g., 7.79 vs 6.59 for OPT-1.3b on SQL), meaning the draft-target approach is more token-efficient in terms of acceptances-per-verification. Yet Speculative Streaming achieves lower wall-time latency because eliminating the serial drafting phase saves more time than the extra verification passes cost. This inverts the standard intuition: the draft-target approach was thought to be efficient because it amortises one expensive target forward pass over many drafted tokens, but the paper shows that the drafting time itself—the cheap but sequential autoregressive passes through the draft model—can dominate the latency budget.
This insight generalises beyond the specific implementation. It suggests that for any speculative decoding method, the metric to optimise is not acceptance rate or tokens-per-target-call in isolation, but wall-time latency per token advanced, and that parallelising speculation with verification can be more impactful than improving the absolute quality of the draft. The paper's analysis in Equation 6 and Figure 4 formalises this: as the target-to-draft latency ratio decreases (e.g., when both models run on the same memory-constrained device), the drafting overhead becomes proportionally larger, and parallelisation becomes more valuable. This has direct implications for on-device deployment, where the "cheap" draft model isn't actually cheap in wall-clock time because it's bottlenecked by the same memory bandwidth as the target.
Innovation 3: Parameter Efficiency as a First-Order Architectural Concern for Speculative Decoding
The paper's parameter-efficiency result—~10,000× fewer extra parameters than Medusa—is not just a quantitative improvement. It represents a qualitative shift in what kind of speculation is feasible for different deployment scenarios. Medusa adds parameters proportional to per head; this is essentially a full-size matrix multiplication for each future position. For a model like OpenLlama-7b with hidden size 4096 and vocabulary 32000, four Medusa heads add roughly parameters—a significant fraction of the original model's 7B parameters.
Why does this matter beyond the raw number? Because autoregressive decoding is memory-bound, and adding parameters directly increases the memory traffic per forward pass. Even if those parameters are only in the output layer (not in the main transformer body), they must be loaded from memory, their matrix multiplication must be computed, and their results must be written back. In a memory-bound regime, added parameters are not free: they consume memory bandwidth that could otherwise have been spent loading the main model's weights. This creates a paradoxical situation where adding speculative heads to increase throughput can actually reduce per-token latency because the additional memory traffic offsets the parallelism gains.
Speculative Streaming's parameter cost— stream identifier embeddings plus a rank-8 pruning adapter ()—makes the approach viable in memory-constrained scenarios where Medusa simply cannot fit. For a 1.3B model deployed on a mobile device with limited DRAM, adding 400M+ parameters for 4× speculation might be impossible; adding 40K parameters (a 10,000× reduction) is essentially free. The paper explicitly targets resource-constrained devices in Section 1 and the abstract, but the parameter-efficiency argument has a deeper implication: it means speculation can be deployed at scale across many fine-tuned application adapters without per-application parameter bloat. If each of 100 downstream tasks requires its own Medusa heads, the storage cost for all those heads becomes prohibitive. With Speculative Streaming, the extra parameters are negligible per task, making it practical to maintain many task-specific speculative models.
This also reframes the relationship between the speculation window and parameter count. In Medusa, scales the parameter cost linearly (each future position needs its own head). In Speculative Streaming, scales the parameter cost only as (the stream embeddings), which is negligible relative to the model size. This means the method can potentially scale to larger speculation windows without hitting a parameter-count brick wall—though the paper does not explore values beyond 4 in detail, leaving this as an implicit capability rather than a demonstrated result.
The innovation here is not the specific parameter count (which is an empirical result of the specific architecture), but the design philosophy: treat parameter efficiency as a first-order constraint in speculative decoding architecture, not an afterthought. Prior work focused on maximising acceptance rates and speedups; Medusa succeeded at that but failed on parameter efficiency. Speculative Streaming shows that both can be achieved simultaneously by embedding speculation into the attention mechanism rather than bolting it onto the output layer.
Innovation 4: Diagnosing the Drafting Overhead as the Hidden Bottleneck in Two-Model SD
The paper makes a specific diagnostic contribution that reframes how to evaluate speculative decoding methods. The standard evaluation metric in the speculative decoding literature is speedup relative to baseline autoregressive decoding, typically measured as wall-time reduction or call-reduction ratio. This metric conflates two very different sources of inefficiency: (a) the target model's underutilisation due to memory-bound single-token generation, and (b) the draft model's overhead due to autoregressive sequential generation.
Speculative Streaming's comparison with draft-target SD (Table 2) teases these apart. In every configuration tested, Speculative Streaming makes more target-model calls than draft-target SD (e.g., 7.79 vs 6.59 for OPT-1.3b on SQL, 13.41 vs 11.65 for DialogSum, 9.80 vs 8.86 for E2E-NLG). This means the draft-target approach is more effective at reducing the target model's invocation count—it verifies more tokens per expensive target forward pass. Yet Speculative Streaming achieves lower wall-time latency across all configurations because it eliminates the drafting overhead entirely (0 draft calls vs 22–43 draft calls).
This is a diagnostic finding with broad implications: the draft model's autoregressive generation, not the target model's verification, is the dominant latency source in two-model SD when the draft model is not negligibly small. The paper's analysis in Equation 6 formalises this: unless the target-to-draft latency ratio is very large (meaning the draft model is much faster than the target), the serial term dominates the per-advancement cost. This explains why previous work on improving draft-model accuracy (DistillSpec, Zhou et al., 2023) or verification efficiency (SpecInfer, SpecTr) may have diminishing returns—they optimise the wrong term in the latency equation.
The concrete implication is that the choice between single-model and two-model speculative decoding should be governed by the achievable target-to-draft latency ratio on the deployment hardware. On a server-grade GPU where a tiny draft model (e.g., 125M parameters) runs extremely fast relative to a large target (e.g., 70B), the term is negligible, and two-model SD will likely win. On a mobile device where even a "small" draft model is memory-bandwidth-limited and runs at similar per-token latency to the target, the serial overhead dominates, and single-model speculation (Speculative Streaming or Medusa) will be faster. The paper's Figure 4 provides the formal tool for making this determination, mapping latency ratios and acceptance ratios to predicted speedup tradeoffs.
This diagnostic contribution is methodological, not just empirical. It provides a framework for the next paper on speculative decoding to evaluate its method: don't just report speedup, report the breakdown of target calls, draft calls, and per-call latency so that the source of gains (or losses) is transparent.
5. Experimental Analysis
Evaluation Methodology
-
Dataset. The paper evaluates on three downstream tasks representing distinct capabilities vital to on-device AI assistants: Dialogsum (Chen et al., 2021) for Text Summarization, sql-create-context (built from WikiSQL, Zhong et al., 2017, and SPIDER, Yu et al., 2018) for Structured Queries, and E2E-NLG (Dušek et al., 2020) for Meaning Representation. All experiments use test-set splits, though the paper does not report the exact number of test examples per dataset.
-
Base model(s). Four pre-trained open-source models of varying scales are tested: OPT-1.3b, OPT-6.7b (Zhang et al., 2022), Phi-1.3b (Li et al., 2023), and OpenLlama-7b (Touvron et al., 2023). The choice spans a 5× range in parameter count, testing whether the method's benefits hold across scales. For the draft-target speculative decoding baseline, OPT-125m (the smallest available OPT configuration) is used as the draft model for OPT-1.3b and OPT-6.7b targets, maintaining the 10–100× size ratio that the literature considers optimal.
-
Metrics. Three categories are reported for each configuration: (a) Wall-time speedup (× over baseline autoregressive decoding), measured on a single Nvidia A100-80G GPU with batch size 1, float16 precision, and greedy decoding (); (b) Call Reduction Ratio (CR Ratio) — an accelerator-agnostic metric representing the factor by which target-model forward-pass calls are reduced compared to autoregressive decoding, serving as a roof-line for achievable speedup on any hardware; (c) Generation quality per task: Exact Match accuracy for SqlContext, and Rouge-1 / Rouge-LSum for Dialogsum and E2E-NLG. The paper also reports number of extra parameters relative to the fine-tuned base model. For the draft-target comparisons in Table 2, wall-time latency per sample (in milliseconds) and counts of target-model calls and draft-model calls per sample are reported.
-
Baselines. Three baselines are compared against Speculative Streaming (SS):
- Baseline: Standard autoregressive decoding with LoRA-fine-tuned base models (no speculation), serving as the 1.00× speedup reference point.
- Medusa (Cai et al., 2023): The primary single-model baseline. Medusa heads (4 heads, matching the 4-stream configuration in SS) are added to LoRA-fine-tuned base models and trained following the recipe from Cai et al. (2023), with residual blocks per head set to 1. Medusa uses the same base models and LoRA adapter rank (32) as SS.
- Two-model speculative decoding (Leviathan et al., 2023; Chen et al., 2023): Applied only to OPT models (which provide a family of sizes). OPT-125m serves as the draft model, with only its LoRA adapters fine-tuned per task (full-model fine-tuning of the draft is rejected as "not practical in on-device settings"). OPT-1.3b and OPT-6.7b are the target models.
All fine-tuning uses LoRA adapters of rank 32, trained for 5 epochs with the AdamQ optimizer, learning rate , linear scheduler, and BFloat16 precision. For the joint n-gram training objective in SS, loss weights are for the main next-token prediction and for each speculative stream .
-
Generation budget / compute accounting. The paper does not use a fixed FLOPs or sample-count budget for fair comparison in the main speedup experiments. Instead, speedups are measured as multiplicative wall-time improvements over the baseline autoregressive decoding on identical hardware. The rationale is that in deployment, the relevant metric is end-to-end latency, not abstract compute units. For the analysis comparing draft-target SD to SS, Equation 6 provides a formal cost model equating per-token-advanced wall-time latency, incorporating forward-pass costs for draft (), target (), and SS (), and average tokens advanced per pass ( for draft-target, for SS). The speculation window is set to 4 for most comparisons, and the top- sampling parameter for tree drafting is swept to find the best configuration per method. The ratio (fraction of top layers using MSA) is set to 1/6 for Structured Queries and 1/2 for Summarization and Meaning Representation, chosen to keep generation metrics on-par with the baseline.
-
Cross-validation / statistical protocol. The paper does not report a cross-validation or statistical significance protocol. Results are reported as point estimates on the test split of each dataset. This is a limitation: for the 500-question MATH benchmark used in similar papers, 500 samples provide reasonable statistical power; for Dialogsum (~500 test dialogues) and E2E-NLG (~630 test instances in the original challenge set), similar reasoning applies, but the paper provides no confidence intervals or standard errors for the speedup or quality numbers. The choice of best-performing configuration across and sweeps is done by reporting the maximum observed result, which introduces a selection bias (the reported speedup may be an overestimate of expected performance on an unseen test set).
Main Quantitative Results
Speedup and Quality vs. Medusa and Baseline (Table 1)
Table 1 presents the headline comparison across three tasks, three model scales, and three methods (Baseline, Medusa, Speculative Streaming). The paper reports best results for SS and Medusa over different and values.
Across-task speedup range: Speculative Streaming achieves wall-time speedups of 1.83–3.14× over the autoregressive baseline, with corresponding call reduction ratios of 2.34–4.13×. The highest speedup (3.14×) occurs on OpenLlama-7b for the SqlContext task; the lowest (1.83×) on Phi-1.3b for Dialogsum.
Comparison with Medusa — speedup: In 7 out of 9 model–task configurations, Speculative Streaming matches or exceeds Medusa's wall-time speedup. The exceptions are OpenLlama-7b on SqlContext (SS: 3.14× vs. Medusa: 3.20× — Medusa slightly ahead) and Phi-1.3b on Dialogsum (SS: 1.83× vs. Medusa: 1.89× — Medusa slightly ahead). In the remaining 7 configurations, SS speedups exceed Medusa's by margins ranging from 0.04× (OPT-1.3b on Dialogsum: 1.94× vs. 1.56×) to 0.32× (OPT-1.3b on SqlContext: 2.39× vs. 2.07×).
Comparison with Medusa — call reduction ratio: SS achieves higher CR ratios than Medusa in 8 out of 9 configurations. In the one exception (OpenLlama-7b on SqlContext: SS 4.13× vs. Medusa 4.10×), the difference is negligible. The largest CR ratio advantage is on OPT-1.3b for SqlContext (SS: 3.57× vs. Medusa: 2.79×), a 28% relative improvement. This is significant because CR ratio reflects token acceptance independent of hardware: SS's tree-structured speculative attention (with token dependency modeling) produces drafts that are accepted at higher rates than Medusa's independent head predictions.
Parameter overhead: The contrast is stark and consistent. Across all models, Medusa adds 4.28 × 10⁸ to 5.91 × 10⁸ extra parameters, while SS adds 4.096 × 10⁴ to 8.19 × 10⁴. For OPT-1.3b, this is 4.28 × 10⁸ vs. 4.096 × 10⁴ — a ~10,450× reduction. The paper's abstract claim of "~10000× fewer extra parameters" is thus supported, with the exact factor varying by model size (the ratio is approximately 10,450× for OPT-1.3b, 10,640× for Phi-1.3b, and 7,215× for OpenLlama-7b — the gap narrowing for larger models because SS's extra parameters scale with hidden size while Medusa's scale with ).
Generation quality: In 8 of 9 comparisons (3 tasks × 3 models), SS achieves quality metrics equal to or better than the autoregressive baseline. For SqlContext on OPT-1.3b, SS achieves 87.40% EM vs. 84.98% baseline — a +2.42 point gain. For OpenLlama-7b on SqlContext, SS achieves 91.70% vs. 89.88% baseline. The one regression is E2E-NLG on OpenLlama-7b, where SS drops to 68.66/49.56 on Rouge-1/RougeLSum vs. 69.50/50.30 for the baseline — a small but detectable quality reduction. The paper attributes this to the trade-off in choosing : the 1/2 ratio used for this task prioritises speculation quality, and a larger ratio might have recovered the baseline metric.
Medusa, by construction, preserves baseline quality exactly on all but one configuration because its Medusa heads are auxiliary and do not affect the main model's next-token predictions during verification. The one exception is OpenLlama-7b on SqlContext, where Medusa's 90.11% slightly exceeds the baseline's 89.88% — likely due to floating-point differences in the modified forward pass.
Key insight from Table 1: SS's combination of speedups without quality degradation and with minuscule parameter overhead validates the central design claim: multi-stream attention can match or exceed the speedup of Medusa's prediction-head approach while using dramatically fewer parameters. The 28% CR ratio advantage on SqlContext further suggests that attention-based token dependency modeling (SS) yields more acceptable drafts than independent head predictions (Medusa) for structured-output tasks.
Wall-Time Latency vs. Draft-Target Speculative Decoding (Table 2)
Table 2 isolates the comparison with standard two-model speculative decoding, using OPT-125m as draft and OPT-1.3b/OPT-6.7b as targets. Three tasks are tested (SqlContext, Dialogsum, E2E-NLG) with .
Headline result: Speculative Streaming achieves lower wall-time latency (ms per sample) than two-model SD across all six target–task configurations, despite making more target-model forward-pass calls.
For OPT-1.3b:
- SqlContext: SS 133.48 ms vs. two-model SD 269.24 ms — SS is 2.02× faster
- Dialogsum: SS 248.26 ms vs. two-model SD 493.59 ms — SS is 1.99× faster
- E2E-NLG: SS 164.23 ms vs. two-model SD 345.72 ms — SS is 2.10× faster
For OPT-6.7b:
- SqlContext: SS 157.04 ms vs. two-model SD 301.10 ms — SS is 1.92× faster
- Dialogsum: SS 442.83 ms vs. two-model SD 555.99 ms — SS is 1.26× faster
- E2E-NLG: SS 243.62 ms vs. two-model SD 412.02 ms — SS is 1.69× faster
The paradox of more target calls but lower latency: Two-model SD makes fewer target-model calls in every configuration (e.g., 6.59 vs. 7.79 for OPT-1.3b on SqlContext; 12.15 vs. 14.39 for OPT-6.7b on Dialogsum). This means the acceptance rate per verification pass is higher in two-model SD — the draft model produces drafts that advance more tokens per target forward pass ( in the paper's notation). However, two-model SD requires 22–43 autoregressive draft-model calls per sample (the "Draft Calls" column), while SS requires zero draft calls. The draft calls dominate the latency budget because they are memory-bound and sequential: the draft model must generate tokens one at a time, each requiring its weights to be loaded from memory at low arithmetic intensity.
This result directly supports the paper's diagnostic claim in Section 4.1.2: the serial drafting overhead () can outweigh the reduction in target-model calls, especially when is not extremely large (OPT-125m is 10× smaller than OPT-1.3b by parameters, but hardware latencies do not scale linearly with parameter count due to memory-bandwidth effects and kernel launch overheads).
Quality comparison: SS achieves quality metrics that are comparable to or slightly better than two-model SD. For SqlContext on OPT-1.3b, SS achieves 87.40% vs. 84.98% for two-model SD (both using LoRA-fine-tuned base models, but SS's joint n-gram training appears to improve the base model's next-token prediction as a side effect). For Dialogsum on OPT-6.7b, SS scores 44.30/36.30 vs. two-model SD's 44.40/36.60 — a negligible difference. The paper does not explain why SS sometimes improves quality over the baseline while two-model SD does not, but a plausible hypothesis is that the n-gram training objective acts as a regulariser that improves the main model's representations (analogous to multi-task learning benefits).
Implication of the latency gap narrowing for larger targets: For OPT-6.7b, the SS advantage is smaller (1.26–1.92×) than for OPT-1.3b (1.99–2.10×). This trend aligns with the paper's Figure 4 analysis: as grows relative to , the term becomes a smaller fraction of total latency, and the two-model SD's advantage in (more tokens per target call) begins to compensate. The paper does not report results for target models larger than 6.7B, leaving open the question of at what scale the two-model advantage in would overcome the drafting overhead entirely.
Effect of Tree Draft Size and Pruning on Speedup (Figure 5)
Figure 5 isolates the trade-off between branching factor (tokens sampled per speculative stream position) and wall-time speedup, with and without tree pruning. The experiment uses (as stated in Section 4.2), and the base model is unspecified (context from the ablation section suggests OPT-1.3b on the Meaning Representation task, matching Figure 9b's setup; however, this is not explicit).
Without pruning: Speedup increases from (baseline, one token per position, linear draft) to a peak at , then declines sharply for . The paper explains: the un-pruned tree draft size grows as , meaning produces a tree of size tokens (vs. for ). The batch size for MSA layers becomes times the tree size, so the forward pass transitions from memory-bound to compute-bound, and the per-pass latency increase outweighs the acceptance-rate gains from having more candidate branches.
With pruning: Speedup continues to increase for and remains high (though declining slightly) for and . The pruning layer removes branches where the early-exit-predicted transition probability between parent and child tokens falls below a threshold, reducing the effective tree size while retaining paths where the child token is a plausible continuation of the parent. The paper does not report the pruning threshold value or the average fraction of tree nodes pruned.
Interpretation: This ablation demonstrates that naive tree drafting (without pruning) is self-defeating for , and that the pruning adapter is necessary for realising the benefits of wider speculation. The result also implicitly validates the pruning adapter's design: using an early-exit linear transformation of rank 8 (totaling ~16K parameters for OPT-1.3b) is sufficient to distinguish between plausible and implausible token continuations. The finding is practically significant because it means that higher acceptance rates (via larger ) can translate to higher speedups if and only if batch-size growth is controlled — a lesson applicable to any tree-based speculative decoding method.
Effect of Number of MSA Layers on Generation Quality (Figure 6)
Figure 6 shows how generation quality changes with (the number of top layers converted from MHA to MSA), tested on OPT-1.3b for Structured Queries (Exact Match accuracy) and Summarization (Rouge-LSum).
For Summarization, Rouge-LSum improves monotonically as increases from 0 (no MSA layers, equivalent to baseline fine-tuning) to 16 (out of OPT-1.3b's 24 total layers). The gain is most rapid from 0 to 4 layers, with diminishing returns beyond 8 layers. For Structured Queries, EM accuracy follows a similar monotonic trend but the paper's plot shows a flatter curve, suggesting this task is less sensitive to MSA depth.
The paper's interpretation (Section 4.2): "Typically incorporating MSA in the top 2–8 layers offers a good trade-off between metric, FLOPs increase and training time." This motivates the choices of (12 layers for OPT-1.3b's 24-layer model? The paper does not specify for each model, making this ratio ambiguous) for Summarization and Meaning Representation, where quality preservation is paramount, and for Structured Queries, where the strong syntactic patterns in SQL make future-token prediction easier with fewer MSA layers.
Ablation detail not quantified in the text: The paper does not report training-time or FLOPs differences across values, only stating qualitatively that they "vary." This is a gap — a table showing FLOPs-per-forward-pass and training-hours vs. would help practitioners choose for their own models.
Top-k Sampling Speedup Analysis (Figure 9b)
The main results use greedy decoding (). Figure 9b extends the analysis to top- sampling at for the Meaning Representation task with OPT-1.3b.
Comparison with Medusa: Across for the generation sampling strategy (not to be confused with the tree-branching ), Speculative Streaming maintains its lead over Medusa in both wall-time speedup and call reduction ratio. As the generation sampling increases, both methods lose speedup — the paper attributes this to "stochastic rejection of tokens": under non-greedy sampling, the verification process rejects more drafted tokens because the target model's sampled token is less likely to match the draft model's sampled token exactly, even when their distributions are similar.
SS advantage narrows but persists: At , SS achieves approximately 1.9× speedup vs. Medusa's ~1.7×. At , both drop further but SS remains ahead. The CR ratio advantage is more persistent than the wall-time speedup advantage, suggesting that SS's drafts are systematically more acceptable than Medusa's under non-greedy sampling, but that the MSA forward-pass overhead partially offsets this gain in wall-time.
This is an important robustness check because many production deployments use non-zero temperature or top- sampling for output diversity. The paper does not test temperature values other than 0 and 1, or top- (nucleus) sampling, which is the more common production choice.
Value Rotation Ablation (Figure 9a)
Figure 9a compares the stream identifier embedding approach (the main method) against value projection rotation (Equation 7) for differentiating speculative streams, tested on Dialog Summarization with Phi-1.3b.
Finding 1: At any fixed , stream embeddings outperform value rotation. For example, at , stream embeddings achieve a higher Rouge-LSum score (the exact numbers are not quoted, but the trend is clear from the figure).
Finding 2: Increasing improves quality for both methods, but the gap narrows. At , value rotation with 16 MSA layers outperforms stream embeddings at . This is a non-obvious result: it suggests that the benefit of stream-specific position information (via embeddings) can be partially recovered by deeper processing, and that value rotation — which adds zero parameters — becomes competitive when the MSA depth is sufficient.
Practical implication: For extremely parameter-constrained scenarios (where even stream embeddings are undesirable), value rotation with larger offers a viable fallback at the cost of more MSA layers and their associated FLOPs. The paper does not pursue this further in the main experiments, noting the downstream metric for value rotation "tends to be lower" for the values used.
Critical Assessment
Claim: Speculative Streaming achieves 1.8–3.1× speedups without sacrificing quality.
Supported with qualifications. Table 1 demonstrates speedups in the claimed range across all nine model–task configurations (1.83–3.14×). Generation quality is preserved or improved in 8 of 9 cases; the one regression (E2E-NLG on OpenLlama-7b) is small but present. The qualification concerns selection bias: the paper reports "best results … over different and values," meaning the speedup numbers represent the maximum observed across a sweep, not the expected performance of a fixed configuration on new data. Without a held-out tuning set or cross-validation, there is a risk that the reported speedups overestimate real-world performance. A fairer evaluation would fix and based on a validation split and report test-set speedup for that configuration.
Additionally, wall-time speedup is hardware-dependent. All experiments use a single A100-80G. The speedup numbers may differ on mobile devices (the paper's stated target), where memory bandwidth is lower and the memory-bound vs. compute-bound transition occurs at different batch sizes. The paper does not report any mobile or edge-device measurements, which weakens the claim that SS is "well-suited for resource-constrained devices."
Claim: Speculative Streaming matches or exceeds Medusa's speedups while using ~10,000× fewer parameters.
Strongly supported for the tested configurations. The parameter count comparison is unambiguous: SS adds to parameters vs. Medusa's to . The speedup comparison is favourable in 7 of 9 configurations and within 2% in the remaining two. However, several caveats apply:
-
The comparison is at fixed . Medusa's parameter cost scales linearly with the number of heads; SS's scales only as (stream embeddings). If a task required or for acceptable speedup, Medusa's parameter overhead would grow proportionally while SS's would remain negligible. Conversely, if Medusa could achieve competitive speedup with (halving its parameter count), the 10,000× multiple would shrink to 5,000×. The paper does not explore the Pareto frontier of parameter-count vs. speedup for either method, so the 10,000× figure is specific to .
-
Medusa's reported numbers represent one configuration. The paper uses "residual blocks per head set to 1." Medusa's original paper (Cai et al., 2023) explored variants with 0–4 residual blocks and tree attention; it is possible that a different Medusa configuration would achieve higher speedups (though at even higher parameter cost). The comparison is between the paper's implementation of Medusa and the paper's implementation of SS, not necessarily the best-possible Medusa configuration.
-
The speedup comparison does not control for engineering effort. The paper notes that "Medusa heads are trained following the recipe described in (Cai et al., 2023)" and SS is trained with the recipe in Section 3.2.4. The training hyperparameters (learning rate, epochs, scheduler) appear identical, which is fair. But the paper does not report whether it tuned Medusa hyperparameters separately to maximize its performance, or whether Medusa could benefit from the same tree-pruning technique that SS uses. This creates an asymmetry where SS's components (tree drafting, pruning) are optimized while Medusa's configuration is taken as-is from prior work.
Claim: Speculative Streaming achieves lower wall-time latency than draft-target SD by eliminating serial drafting overhead.
Supported for the specific draft-target pairing tested (OPT-125m as draft, OPT-1.3b/OPT-6.7b as target), but the generalizability is not demonstrated. Table 2 shows clear wins for SS in all six comparisons. However, the analysis in Equation 6 and Figure 4 makes a conditional prediction: SS wins when is small relative to , i.e., when the draft model's acceptance advantage does not overcome its serial overhead. The paper tests only one draft-model size (125M) with two target sizes (1.3B, 6.7B). Missing experiments include:
- Smaller draft models (e.g., OPT-60M or a distilled 30M-parameter LM): Would the drafting overhead shrink enough to make two-model SD competitive or superior? The paper's own analysis predicts "yes" for sufficiently small drafts, but this is not tested.
- Larger target models (e.g., OPT-13B, OPT-30B): As grows, the drafting overhead becomes proportionally smaller, and two-model SD may overtake SS. The paper does not report where this crossover occurs for any model family.
- Draft models from a different family that are better aligned: Two-model SD performance depends strongly on draft-target alignment. The paper uses OPT-125m (same family), but a domain-specific small model might achieve higher and tip the balance.
The paper acknowledges this conditionality implicitly (Section 4.1.2: "finding/creating such a model usually requires significant engineering efforts"), but the experimental evidence only demonstrates the existence of a regime where SS wins, not the boundaries of that regime.
Claim: Tree pruning is essential for realising speedups with .
Supported by Figure 5, but the ablation is under-reported. The paper does not state:
- The pruning threshold used.
- The fraction of tree nodes pruned on average.
- Whether the pruning adapter was trained jointly or post-hoc for this experiment.
- The false-positive rate (good branches incorrectly pruned) or false-negative rate (bad branches retained), which would help practitioners calibrate the threshold.
Additionally, the pruning adapter uses the base model's language modeling head and a rank-8 linear transformation . It is plausible that a dedicated small classifier (trained from scratch, not early-exit) would achieve better pruning accuracy with similar parameter cost, but this ablation is not presented.
Experiment Would Have Strengthened the Paper
- A held-out validation-based selection of , , , and pruning threshold, with test-set results reported for the selected configuration. This would eliminate the selection bias from reporting best-over-sweep results.
- Measurements on resource-constrained hardware (mobile phone, edge GPU, or simulated memory-bandwidth constraints) to validate the claim that SS is "well-suited for resource-constrained devices."
- A scaling study of : how do speedup, CR ratio, quality, and training cost change as the speculation window grows from 4 to 8, 16? The paper's parameter-efficiency argument (SS scales as , not ) implies that SS should maintain an advantage at larger , but this is not demonstrated.
- Ablation of the loss weights : the paper sets for all speculative streams without justification. Sweeping would reveal whether higher weights (prioritising speculative accuracy) trade off against main-token quality, and whether per-stream weighting (e.g., higher weight for stream 1, which is closer and easier to predict) improves overall acceptance rates.
- Combination with soft matching for verification. The paper notes in Appendix A.2 that soft matching "may yield higher speedups" but uses hard matching throughout. Showing speedup with soft matching (and its effect on quality) would strengthen the practical case.
- Memory-footprint comparison on actual hardware, not just parameter counts. Medusa's parameters affect memory traffic even if they are only in the output layer; SS's MSA layers add computation but not significant memory. Quantifying the memory-bandwidth implications would make the resource-efficiency argument more concrete.
Where the Claims Hold Conditionally
- The 10,000× parameter advantage holds specifically for the tested configuration. It would be smaller for smaller and larger for larger . The relative ranking (SS << Medusa in parameter count) is robust; the exact factor is not.
- The wall-time latency advantage over two-model SD holds for the tested draft-target pairings (OPT-125m → OPT-1.3b/6.7b) on an A100. It likely holds for any scenario where is not large (i.e., the draft model is not extremely fast relative to the target), which is common on memory-constrained hardware. It may not hold for server-grade deployments with very small draft models or very large target models.
- The quality-preservation claim holds for the tested ratios (1/6 and 1/2). The paper shows that quality improves monotonically with (Figure 6), implying that choosing too small would degrade quality while choosing it too large would add unnecessary FLOPs. The claim is therefore conditional on selecting an appropriate per task.
- The tree-pruning benefit holds for and depends on the pruning threshold being well-calibrated. The paper does not explore sensitivity to the threshold, so the claim that pruning "helps" is established in principle but not characterised in operational detail.
6. Limitations and Trade-offs
The Cost of Difficulty Estimation Is Not Accounted For in Speedup Numbers
The assumption: The paper's parallel speculation-verification loop depends on tree drafting, which produces a batch of candidate tokens for verification in the next forward pass. The quality of this draft—and therefore the acceptance rate and speedup—hinges on the speculative streams' ability to predict plausible future tokens. This in turn depends on (the number of MSA layers) and (the speculation window), which are chosen per task to maintain generation quality (Section 4.2, Figure 6). The paper selects for Summarization and Meaning Representation and for Structured Queries, and reports the best speedup across different and values. This implies that deploying Speculative Streaming on a new task requires a hyperparameter sweep—varying , , , and the pruning threshold—to find the configuration that maximises speedup without degrading quality below the baseline.
The paper does not account for the cost of this sweep in any of its reported speedup or efficiency numbers. The cost is non-trivial: each configuration must be trained for 5 epochs (Section 3.2.4), and speedup must be evaluated by running full inference on the test set (or a validation split) with wall-time measurements on the target hardware.
The consequence: In a production multi-task setting—precisely the on-device deployment scenario the paper targets—the "1.8–3.1× speedup" figures are achievable speedups, not deployment-cost-inclusive speedups. If a practitioner must fine-tune and evaluate 10–20 configurations per task to find the optimal , , and , the total compute spent on hyperparameter search could exceed the inference-time compute savings for many tasks, especially those with limited inference volume ( in the terminology of the prior analysis paper, but here referring to the ratio of inference tokens to training tokens). For a summarization model deployed to serve millions of requests, the amortized tuning cost is negligible; for a structured-query model serving thousands of requests on a specific database schema, the tuning cost could dominate the total cost of ownership.
What evidence exists: The paper explicitly reports "best results for Medusa and our approach over different and values" (Section 4.1.1 and Appendix A.2), and Figure 5 shows the speedup variation across values for a single task. However, the paper provides no guidance on how to select without a sweep—Figure 6 shows the quality-vs- curve for two tasks on OPT-1.3b, but does not establish whether these curves are consistent across models or tasks, making it impossible to transfer hyperparameter choices from one setting to another. There is no reporting of validation-set speedup for a fixed configuration chosen without access to the test set.
Mitigation status: None. The paper does not discuss the hyperparameter selection cost, does not propose a method for predicting optimal , , or from task or model characteristics, and does not report results for a single fixed configuration across all tasks. This is a practical limitation acknowledged only implicitly through the reporting of "best results." A practitioner reading the paper has no recipe for choosing these hyperparameters without running the same expensive sweep.
The Draft-Target Comparison Only Tests One Draft Model Size and Architecture
The assumption: The comparison with standard two-model speculative decoding (Table 2, Section 4.1.2) uses exactly one draft model: OPT-125m, the smallest available OPT configuration, paired with OPT-1.3b and OPT-6.7b targets. The paper argues that this pairing is representative because "a ratio of 10–100× is typically considered to be optimal" (Section 4, Model Configuration paragraph). The analysis in Equation 6 and Figure 4 further formalises that the draft-target advantage depends on the latency ratio and the token-advancement ratio , and concludes that Speculative Streaming wins when the draft model is not "accura[te] enough to achieve more token advancements per target model verification step … and also small enough to yield higher latency ratios."
However, the paper does not test this prediction empirically across a range of draft model sizes or architectures. The OPT-125m draft represents exactly one point in the space of possible draft models. The paper's own formalism predicts that if a smaller, faster draft model could maintain high acceptance rates—or if a different draft architecture were better aligned with the target—the two-model approach could overtake Speculative Streaming. This prediction is not tested.
The consequence: The claim that Speculative Streaming "achieves better wall-time latencies than the standard draft-target speculative decoding" (Section 4.1.1) is established only for the specific pairing of OPT-125m → OPT-1.3b/6.7b. A practitioner using a different model family (e.g., Llama-2 with a TinyLlama draft, or Phi-2 with a distilled 30M-parameter draft) cannot conclude from this paper that Speculative Streaming would be faster than two-model SD in their setting. The failure mode is straightforward: a 30M-parameter draft model might have 3–5× lower per-token latency than OPT-125m while maintaining comparable acceptance rates (due to architectural improvements or better alignment), pushing the term below and reversing the latency advantage.
What evidence exists: Table 2 provides the raw numbers: two-model SD requires 22–43 draft calls per sample, each of which is an autoregressive OPT-125m forward pass. These numbers are specific to that draft model's speed on an A100-80G. The paper does not report the absolute latency of a single OPT-125m forward pass, making it impossible for readers to extrapolate to their own hardware or draft model sizes. Figure 4 provides the theoretical framework for extrapolation, but only if the reader can supply their own measurements of , , , , and —parameters the paper does not provide in a reusable form (e.g., per-token latencies rather than per-sample latencies).
Mitigation status: Partial, through the theoretical analysis. Equation 6 and Figure 4 give practitioners a framework for evaluating whether their specific draft-target pairing would beat Speculative Streaming, if they can measure or estimate the relevant latencies and acceptance rates. But the paper does not reduce this to actionable heuristics (e.g., "two-model SD is likely faster when and "), nor does it validate the framework across multiple draft sizes. The analysis is diagnostic, not predictive.
No Results on Resource-Constrained Hardware Despite That Being the Stated Motivation
The assumption: The paper's abstract, introduction, and conclusions repeatedly position Speculative Streaming as a method for resource-constrained deployment: "making it well-suited for resource-constrained devices" (abstract), "especially unsatisfactory for resource-constrained devices" (Section 1), "a suitable approach for resource-constrained scenarios" (Section 5). The parameter-efficiency argument (10,000× fewer extra parameters than Medusa) is explicitly framed as enabling on-device deployment where memory is scarce. The paper also notes that speculative streams "avoid storing additional key/value projections associated with individual streams" to "operate within memory bounds of resource-constrained devices during inference" (Section 3.2.1).
However, all experiments in the paper are run on a single Nvidia A100-80G GPU (Section 4.1.1, Appendix A.2). This is a datacenter-class accelerator with 80 GB of HBM2e memory and ~2 TB/s memory bandwidth—essentially the opposite of a resource-constrained device. No measurements are reported on mobile GPUs, laptop-class GPUs, edge accelerators (e.g., Apple Neural Engine, Qualcomm Hexagon), or even consumer desktop GPUs with limited VRAM.
The consequence: The central claims about resource-constrained suitability are unsubstantiated by hardware measurements. Several properties of the method might behave differently on constrained hardware:
- Memory-bandwidth sensitivity: The A100's ~2 TB/s bandwidth means the memory-bound vs. compute-bound transition occurs at a relatively large batch size. On a mobile device with ~50–100 GB/s bandwidth, the transition to compute-bound happens at a much smaller batch size, meaning the tree-draft batching overhead (which Figure 5 shows degrades speedup when the model becomes compute-bound) could kick in earlier—potentially at or even , eroding the speedup advantage.
- KV cache size: The paper claims no additional KV cache overhead because speculative streams reuse the main stream's cache. But the tree draft batching multiplies the main stream's effective batch size per forward pass, which temporarily increases the working memory for KV cache lookups during the MSA layers. On a device with limited SRAM or cache, this could cause thrashing or spill to slower memory tiers, increasing latency in ways not captured on an A100.
- Power consumption: The paper mentions that mid-layer insertion "helps with peak power consumption on the device" (Section 3.2.1), but provides no power measurements. On a thermally constrained mobile device, higher arithmetic intensity (which SS achieves intentionally to escape memory-bound underutilisation) means higher power draw, which could trigger thermal throttling and reduce sustainable throughput.
- LoRA adapter overhead: The paper uses LoRA fine-tuning throughout, but the interaction between LoRA adapter computation and the MSA attention pattern on low-power matrix units is not characterised.
What evidence exists: None. The paper provides no latency, throughput, memory-footprint, or power measurements on any device other than an A100. The kernel utilisation timeline in Figure 10 is from an A100. The speedup numbers in Table 1 and Table 2 are A100 numbers. The paper's entire empirical case for resource-constrained suitability rests on the parameter-count comparison with Medusa—an indirect and incomplete proxy for on-device performance.
Mitigation status: None. The paper does not acknowledge this gap, does not propose even a simulation-based evaluation (e.g., throttling memory bandwidth or reducing available compute), and does not frame the resource-constrained claims as aspirational rather than demonstrated. This is arguably the most significant gap between the paper's stated motivation and its empirical evidence.
Generation Quality Can Degrade Depending on and Task, with No Automatic Safeguard
The assumption: The tuning of (the number of top layers converted to MSA) involves a trade-off between speculation quality (and therefore speedup) and generation quality. Figure 6 shows that downstream metrics improve monotonically with , meaning that for a fixed , the model's next-token prediction accuracy may be worse than the baseline fine-tuned model if is chosen too small. The paper chooses for Structured Queries (where the strong syntactic patterns of SQL make future-token prediction easy) and for Summarization and Meaning Representation (where more MSA capacity is needed). This per-task tuning is manual and requires access to task-specific validation metrics.
The implicit assumption is that a practitioner can and will perform this tuning, and that there exists an for every task that recovers baseline quality while providing useful speedup. The paper provides no evidence for this assumption beyond the three tested tasks.
The consequence: In a deployment where is chosen too aggressively (too small for the task's complexity), the model silently degrades generation quality while still appearing to produce plausible outputs. There is no runtime quality check or fallback mechanism. The paper's own results show a small quality regression on E2E-NLG with OpenLlama-7b (Rouge-1/RougeLSum drops from 69.50/50.30 to 68.66/49.56), even with . If a practitioner chose for this task (as used for Structured Queries), the quality degradation could be substantially larger, and the paper provides no way to predict the magnitude.
This is particularly concerning for tasks where quality evaluation is difficult or subjective—summarization, dialogue generation, creative writing—where a small drop in Rouge scores might mask more significant degradations in factual consistency, coherence, or relevance that are not captured by automated metrics.
What evidence exists: Figure 6 shows the quality-vs- relationship for two tasks on OPT-1.3b. The curves differ: Summarization benefits substantially from more MSA layers (steep improvement from 0 to 8), while Structured Queries show a flatter curve. This demonstrates that the optimal is task-dependent, but does not quantify the risk of choosing too small—the figure's y-axis ranges are not aligned between the two subplots, making direct comparison difficult. The E2E-NLG quality regression (Table 1) is the only concrete evidence of quality degradation in the paper's chosen configurations, and it receives no discussion or analysis in the text.
Mitigation status: None, beyond the implicit suggestion to tune per task. The paper does not propose a validation protocol for detecting unacceptable quality degradation, does not provide a correlation between and quality that could guide initial choice, and does not test whether quality degradation can be recovered by training for more epochs or with different loss weights (, which are fixed at 0.1). A practical mitigation—training with progressively larger until validation quality matches the baseline—is possible but unmentioned.
The Method Is Evaluated Only on Relatively Short-Output, Structured-Output Tasks
The assumption: The three evaluation tasks—SQL query generation, dialogue summarization, and meaning representation (E2E-NLG)—share a common property: outputs are relatively short (typically tens to low hundreds of tokens) and highly structured (SQL syntax, summary templates, slot-value pairs). The paper frames these as "a diverse set of applications that are vital to on-device AI assistants" (Section 4), implying that results transfer to other on-device use cases.
However, the tasks are narrow in an important dimension: they all involve constrained generation where the output space has strong syntactic or template-based regularities. SQL queries follow a strict grammar. Summaries recombine dialogue content into standard phrasal patterns. E2E-NLG outputs fill structured templates. These regularities make future n-gram prediction easier because the model can learn frequent multi-token patterns (e.g., "SELECT COUNT(*) FROM", "said he would", "is a family-friendly"). The qualitative examples in Figures 11–12 show exactly this: the accepted speculative drafts are common multi-token phrases specific to each domain.
The consequence: Speculative Streaming's speedup depends on the acceptance rate of drafted tokens, which in turn depends on how predictable future tokens are from the current context. For tasks with strong local regularities (code generation, structured data extraction, template filling), the method is likely to work well. For tasks with weak local regularities—open-ended creative writing, long-form reasoning where the next 4 tokens are genuinely uncertain, multi-turn dialogue with diverse responses—the acceptance rate would be lower, and speedup would degrade toward 1×. The paper provides no evidence on where this boundary lies.
This is not a flaw of the method per se—all speculative decoding approaches face the same challenge—but the paper's claim of "1.8–3.1×" speedups implicitly suggests generality that the task selection does not support. A practitioner deploying Speculative Streaming for, say, a chatbot that generates long, diverse, open-ended responses might see speedups far below the reported range, and the paper provides no way to predict this from task characteristics.
What evidence exists: The paper reports speedups on exactly three tasks, all in the structured-output family. There are no experiments on open-ended generation, long-form reasoning, code generation (which would be a natural fourth task given the SQL results), or multi-turn dialogue. The paper's limitation is one of coverage, not negative evidence: we simply do not know whether the speedups generalise. The call reduction ratios (2.34–4.13×) are higher for SQL (3.53–4.13×) than for summarization (2.34–2.62×) and meaning representation (3.55–3.72×), which is consistent with the hypothesis that stronger structural regularity improves acceptance rates, but the variation is confounded by the different ratios used per task.
Mitigation status: None. The paper does not discuss the generalisation of speedup results to other task types, does not analyse what task properties predict acceptance rates, and does not include any open-ended generation task in the evaluation suite. The diversity claim ("a diverse set of tasks") is accurate with respect to surface form (code, summaries, meaning representations) but misleading with respect to the underlying regularity that likely drives the method's success.
The Joint N-Gram Training Objective's Effect on Base Model Quality Is Not Controlled or Analysed
The assumption: The training objective in Equation 5 replaces standard next-token prediction fine-tuning with a weighted sum of next-token loss () and future-token prediction losses ( for ). This means the main stream—which produces the verified output tokens—is trained on a different objective than standard fine-tuning. The expectation is that the auxiliary future-token losses act as a beneficial regulariser (improving the main model's representations) or are at worst neutral (preserving baseline quality). The paper reports that "generation metrics of our method are consistently comparable with LoRA fine-tuned base models" (Section 4.1.1), and in some cases exceed the baseline (e.g., SqlContext on OPT-1.3b: 87.40% vs. 84.98%).
However, the paper does not isolate the effect of the changed objective from the effect of the architectural modifications. The baseline is standard LoRA fine-tuning on the same base model; Speculative Streaming uses the same LoRA adapters plus MSA layers plus the joint n-gram objective. An improvement in quality (or a regression) could be due to the additional training signal from future tokens, or due to the MSA layers providing richer representations to the main stream (since the main stream also passes through MSA layers, where it can potentially benefit from the multi-stream attention pattern), or due to an interaction between them. The paper does not ablate the objective separately from the architecture—for example, training the same MSA-augmented model with (pure next-token prediction, no speculative loss) and comparing quality.
The consequence: A practitioner cannot determine whether the joint objective is necessary for the reported quality, or whether the MSA architecture alone would suffice. If the quality sometimes degrades (as on E2E-NLG with OpenLlama-7b), it is unclear whether to attribute this to the MSA layers (reducing effective capacity for the main stream), the auxiliary losses (diverting representational capacity toward future tokens), the specific weight, or an interaction. This matters for two reasons:
- When quality degrades: Without knowing the cause, a practitioner cannot systematically fix it (e.g., by reducing , increasing , or training for more epochs).
- When quality improves: The paper's SqlContext results (SS outperforming baseline) could be interpreted as evidence that the joint objective acts as multi-task learning—predicting future tokens improves next-token prediction. If true, this would be an independent benefit of Speculative Streaming beyond speedup. But without the ablation, this remains speculative.
What evidence exists: The paper reports baseline quality and SS quality side-by-side (Table 1), confirming that SS is "consistently comparable." The small improvements (SqlContext on OPT-1.3b: +2.42 EM; OpenLlama-7b: +1.82 EM) and small regressions (E2E-NLG on OpenLlama-7b: −0.84 Rouge-1) are consistent with either hypothesis. The training details mention without justification and note that loss weights are "set empirically," but no sweep or ablation is reported.
Mitigation status: None. The joint objective is presented as part of the Speculative Streaming recipe without analysing its independent contribution. The paper does not report an ablation where the MSA architecture is trained with only next-token prediction loss, which would be the minimal experiment needed to separate the effects of architecture and objective. This is a missed opportunity to strengthen the method's intellectual clarity and to give practitioners guidance on whether the objective is essential or merely convenient.
7. Implications and Future Directions
How This Work Changes the Landscape
This paper makes a methodological pivot in how the field thinks about speculative decoding, but it is not a paradigm shift. It is better understood as a re-architecting that collapses two previously separate design spaces—"how to draft" and "how to verify"—into a single fused mechanism. The key reframing is: don't add speculation to a model; restructure the model's attention to perform speculation natively. Prior work split along a clean fault line: either use a separate draft model (Leviathan et al., 2023; Chen et al., 2023) or bolt prediction heads onto the output layer (Medusa, Cai et al., 2023). Speculative Streaming argues—and demonstrates empirically—that both approaches pay unnecessary costs. The two-model approach pays serial drafting overhead and deployment complexity. The multi-head approach pays massive parameter overhead for independent predictions that cannot model inter-token dependencies. The paper shows that moving speculation into the attention mechanism via multi-stream self-attention resolves both problems simultaneously: the attention pattern captures dependencies between speculated tokens (unlike Medusa) without requiring a separate model (unlike standard SD), and the parameter cost collapses from per future position to —a 10,000× reduction at the tested scale.
The conceptual shift that makes this work is treating the draft model's autoregressive dependency structure as an attention pattern rather than a separate forward pass. In two-model SD, draft tokens are generated sequentially, with each conditioning on the previous. The causal chain is enforced by the draft model's transformer. Speculative Streaming recovers this same causal chain within one model's attention mask: speculative stream attends to streams at the same position (Equation 2), so the prediction of can condition on what was predicted for , just as in autoregressive drafting—but without any sequential forward passes. This is not an incremental optimisation; it reveals that the draft model's sequential computation was never strictly necessary for dependency modeling. What was needed was the right attention mask, and that can be embedded in the target model at negligible parameter cost.
The paper also resolves a latent tension in the speculative decoding literature about what the primary bottleneck actually is. Standard SD was developed under the intuition that the target model's verification is the expensive step and that amortising it over many drafted tokens is the path to speedup. The paper's comparison with draft-target SD (Table 2) complicates this picture: two-model SD achieves higher acceptance rates (fewer target calls) than Speculative Streaming, yet SS achieves lower wall-time latency. The bottleneck, it turns out, is not the target model's verification cost but the serial, memory-bound autoregressive drafting phase. This finding reframes the evaluation of speculative decoding methods: the metric to optimise is not tokens-per-target-call ( or ) but wall-time latency per token advanced, and parallelising speculation with verification (eliminating idle drafting time) can outweigh a draft-model advantage in acceptance rate. This lesson generalises beyond this paper: any future speculative decoding method—single-model or two-model—should be evaluated with a breakdown of where wall-clock time is actually spent, and the drafting phase must be treated as a first-order latency contributor, not a negligible prelude to verification.
Beyond speculative decoding specifically, the paper contributes a design principle for parameter-efficient inference-time acceleration: embed the acceleration mechanism into the model's existing computational primitives (attention, not separate heads) and exploit the fact that memory-bound models have "free" compute cycles. The MSA layers add computation, but because autoregressive decoding is memory-bound, the additional FLOPs cost essentially zero wall-clock time—the compute units were idle anyway, waiting for weight data from memory. This principle—that you can recover speedup by increasing arithmetic intensity without increasing memory traffic—is applicable beyond speculation. Any inference-time method that adds computation without adding parameters or KV cache overhead (e.g., adaptive computation time, early exiting, iterative refinement within the same forward pass) should be evaluated through this lens: if the model is memory-bound, "free" compute is genuinely free.
The research directions that become more attractive after this paper include: embedding other "auxiliary model" functions (retrieval, fact-checking, planning) into the target model via multi-stream attention rather than separate models; exploring non-autoregressive generation via stream-based future-token prediction at scale; and treating parameter efficiency as a first-order constraint in inference acceleration, not an afterthought.
The directions that become less attractive include: developing increasingly sophisticated draft models for two-model SD without addressing the serial drafting bottleneck; adding more independent prediction heads to the output layer (the Medusa approach, unless parameter cost can be dramatically reduced); and optimising acceptance rates in isolation without measuring wall-clock time on target hardware. The paper's kernel-utilisation argument (Figure 3, Figure 10) and the cost model in Equation 6 provide a framework that makes it harder to justify work that ignores the drafting-phase latency contribution.
Follow-Up Research This Work Enables
1. Scaling the speculation window to 8, 16, or beyond—and finding where the method breaks. The paper demonstrates speedups at and notes that parameter cost scales as (not as in Medusa), implying that larger speculation windows should be feasible. But the paper does not test this. A direct follow-up would sweep on a fixed model and task, measuring speedup, acceptance rate, and generation quality. The prediction from the paper's logic is that speedup should continue to increase until one of two limits is hit: (a) the acceptance rate drops because predicting tokens 16–32 positions ahead is too uncertain, or (b) the tree draft batch size (even with pruning) pushes the model into the compute-bound regime on the deployment hardware. Characterising which limit bites first—and at what —would establish the practical ceiling for this method. A negative result (speedup plateauing or declining beyond or ) would be equally informative, identifying the fundamental predictability horizon for future n-gram speculation and bounding the method's applicability.
2. Training a model to predict optimal , , and from task and hardware characteristics. The paper's hyperparameter selection is done by brute-force sweep (the paper reports "best results … over different and values"), incurring a tuning cost that is not accounted for in the speedup numbers. A practical follow-up would train a lightweight predictor—perhaps a small MLP or gradient-boosted tree—that takes as input task-level features (e.g., average output length, vocabulary diversity, n-gram entropy of the baseline model's outputs) and hardware-level features (memory bandwidth, FLOPs/s, SRAM size) and predicts the Pareto-optimal configuration. The training data would come from running the sweep described in the paper across many tasks and hardware simulators. The question is whether the optimal configuration transfers across tasks with similar structure—the paper's own data hints that Structured Queries (SQL) and Summarization have different optimal , but with only three tasks it is impossible to generalise. This follow-up would test whether hyperparameter selection can be systematised, turning Speculative Streaming from a method that requires per-task tuning into one that can be deployed with a single inference-time configuration lookup.
3. Stress-testing Speculative Streaming on open-ended, long-form, and creative generation tasks. The paper's three evaluation tasks—SQL generation, dialogue summarization, meaning representation—share strong local structural regularities that likely inflate acceptance rates compared to less constrained generation. A stress-test would evaluate SS on tasks deliberately chosen to challenge future-token predictability: open-ended story generation (e.g., WritingPrompts), long-form reasoning (e.g., GSM8K with chain-of-thought, MATH), multi-turn dialogue with diverse responses (e.g., DailyDialog or an open-domain chatbot benchmark), and code generation in multiple languages (extending the SQL results). The null hypothesis is that SS's speedup degrades substantially on these tasks—perhaps to 1.2–1.5× rather than 1.8–3.1×—because the speculative streams cannot reliably predict tokens 1–4 positions ahead when the output space is unconstrained. If the speedup does degrade, the interesting question is whether the degradation is gradual (correlated with some measurable property like per-token entropy of the baseline model) or abrupt (a phase change at some level of output unpredictability). This would establish the boundary conditions for the method's applicability and give practitioners a way to predict whether SS is worth deploying for their specific task.
4. Combining Speculative Streaming with soft verification matching and measuring the speedup–quality trade-off. The paper uses hard matching for verification throughout ("greedy sampling and ") but notes in Appendix A.2 that "relaxing this criteria to 'soft' matching may yield higher speedups (Cai et al., 2023)." Soft verification accepts a drafted token with probability rather than only when the target's greedy prediction matches the draft token. This increases acceptance rates at the cost of introducing a distributional bias (the output distribution is no longer exactly the target model's distribution). A systematic follow-up would sweep the acceptance criterion from hard matching through increasingly permissive soft matching, measuring the wall-time speedup and the KL divergence between the generated output distribution and the target model's true distribution. The key question: is there a "free lunch" regime—soft matching that provides meaningful speedup gains with negligible distributional divergence—or does any speedup gain come with a proportional divergence cost? The paper's existing framework (MSA layers, tree drafting, pruning) is compatible with soft matching without modification; the experiment requires only changing the verification logic.
5. On-device benchmarking of Speculative Streaming on mobile-class hardware with memory-bandwidth constraints. This is the most important missing experiment given the paper's stated motivation. A follow-up would implement Speculative Streaming on a mobile device (e.g., an iPhone with Apple Neural Engine, a Pixel phone with an edge TPU, or a laptop-class GPU with limited VRAM) and measure: wall-time latency per token, peak memory usage (model weights + KV cache), and power consumption during sustained generation—comparing SS against baseline autoregressive decoding, Medusa, and (if memory allows) two-model SD with a compressed draft model. The paper's theoretical argument is that SS should be more advantageous on memory-constrained hardware because (a) the serial drafting overhead of two-model SD is proportionally larger when even small models are bandwidth-limited, and (b) Medusa's parameter overhead consumes scarce memory that could push the working set into slower tiers. But theory is not evidence—hardware behaviour is full of surprises (cache effects, thermal throttling, driver optimisations). A negative result—SS providing minimal speedup on mobile hardware due to unforeseen bottlenecks—would be highly informative and would redirect research toward hardware-specific optimisations. A positive result—SS maintaining or even improving its relative advantage on constrained hardware—would validate the paper's central deployment thesis.
6. Exploring the interaction between the joint n-gram training objective and the MSA architecture via ablations. The paper reports that SS sometimes improves generation quality over the baseline (e.g., SqlContext on OPT-1.3b: 87.40% vs. 84.98%) and sometimes slightly degrades it (E2E-NLG on OpenLlama-7b). It is unclear whether these effects are due to the changed training objective (joint next-token + future-token prediction), the MSA architecture (multi-stream attention affecting the main stream's representations), or an interaction. A systematic ablation would train four model variants on the same tasks: (a) standard LoRA fine-tuning (baseline), (b) MSA architecture with (no future-token loss, pure next-token prediction through multi-stream layers), (c) standard architecture with the joint n-gram objective applied to a multi-head output (no MSA, but still predicting future tokens), and (d) full Speculative Streaming (MSA + joint objective). Comparing (a) and (b) isolates the architecture effect; comparing (a) and (c) isolates the objective effect; comparing (b), (c), and (d) reveals whether the gains are additive or interactive. The hypothesis from the paper's framing is that the joint objective is the primary driver of quality preservation (or improvement), and the MSA architecture enables it efficiently—but this is untested. A finding that the MSA architecture alone improves quality (variant b > variant a) would suggest that multi-stream attention provides representational benefits independent of the training objective, which would be a novel insight about transformer architectures beyond speculative decoding.
Practical Applications and Downstream Use Cases
1. On-device assistant tasks with multiple fine-tuned adapters sharing a base model. The paper explicitly targets this scenario: a base LLM is deployed on a mobile device, and application-specific LoRA adapters are loaded for different tasks (summarization, SQL generation, structured data extraction). Speculative Streaming enables acceleration for each task by fine-tuning the adapter with the joint n-gram objective and adding stream identifier embeddings—at a cost of parameters per task (e.g., ~8K parameters for a 4-stream, hidden-size-2048 model), which is negligible compared to the adapter itself. Without SS, the practitioner faces a bad choice: deploy two-model SD (requiring a separate draft model and its per-task adapters, doubling memory and management complexity) or deploy Medusa (adding ~400M parameters per task, likely exceeding on-device memory). SS breaks this trade-off. The concrete benefit: a single on-device model can support 20+ task-specific accelerated adapters with less total parameter overhead than one Medusa-augmented adapter.
2. Server-side batch inference for structured-output tasks with cost-sensitive pricing. For API providers serving high volumes of SQL generation, summarization, or data-to-text requests, the wall-time speedup translates directly to throughput gains and cost reduction. The paper's CR ratio numbers (2.34–4.13×, Table 1) suggest that the call-reduction benefit is robust across hardware, meaning even on different GPU generations or cloud instance types, the per-request compute cost should decrease by a similar factor. Unlike two-model SD, there is no need to manage draft model instances separately or to worry about draft-target alignment drifting over time. The tree pruning mechanism ensures that the batch size stays controlled, preventing the compute-bound transition that would erode speedup in high-throughput settings.
3. Fine-tuning pipelines where the same base model generates training data across many domains. When using LLMs to generate synthetic training data (e.g., for distillation or self-improvement), the generation phase is often the dominant cost. Speculative Streaming can be applied by fine-tuning the base model with the joint n-gram objective on each domain's data, then using the accelerated model for data generation. Because the extra parameters per domain are minimal ( to ), maintaining many domain-specific speculative models is storage-efficient. The paper's finding that SS sometimes improves generation quality over standard fine-tuning (e.g., +2.42 EM on SqlContext for OPT-1.3b) is a bonus: the generated training data may be of higher quality, creating a virtuous cycle where better data improves the next round of fine-tuning.
4. Interactive coding assistants requiring sub-200ms latency for responsiveness. The SQL generation results (2.39–3.14× speedup, Table 1) demonstrate that SS works well on code-like structured generation. For an interactive coding assistant (e.g., in-IDE code completion), latency requirements are stringent—typically under 200ms for a suggestion to feel instantaneous. A model that takes 500ms per suggestion with standard decoding becomes viable at 160–210ms with a 2.4–3.1× speedup. The tree-draft mechanism is particularly well-suited to code: programming languages have strong local syntax (e.g., "import torch.nn as" → "nn"), and the SS attention pattern can learn these frequent multi-token patterns. The paper doesn't test code beyond SQL, but the structural similarity (strict grammar, common multi-token phrases) suggests the speedup should transfer. A deployment would fine-tune a base code model with SS on the specific codebase or language, deploy behind an IDE plugin, and measure end-to-end suggestion latency including network round-trip and editor rendering time.