Abstract
Superposed Decoding (SPD) is a novel algorithm designed to generate multiple text drafts from a Large Language Model (LLM) simultaneously using the computational cost of a single inference pass. By feeding a weighted "superposition" of token embeddings into the model and filtering results with efficient n-gram models, SPD achieves significant speedups—up to 3.54x for eight drafts—while maintaining quality and factuality comparable to standard, more expensive decoding methods. This paper explores the methodology, the underlying linearity hypothesis of LLMs, and the performance gains across various benchmarks.
Introduction
Modern interactive AI applications, such as Gmail's autocomplete or GitHub Copilot, often provide users with multiple suggestions to choose from. Traditionally, generating $k$ different suggestions requires the LLM to perform $k$ separate inference passes or utilize a batch size of $k$. Because LLMs are autoregressive—predicting the next token based on all previous ones—this process scales linearly with the number of drafts, creating a significant "compute tax." For real-time applications, this forces a trade-off between latency, cost, and the number of options provided to the user. Superposed Decoding (SPD) addresses this bottleneck by breaking the linear scaling requirement, effectively providing multiple drafts for the price of one.
Methodology
The core innovation of SPD lies in treating the LLM input as a mixture of possibilities rather than a single deterministic path. The process consists of five primary stages:
- Token Superposition: Instead of feeding a single token embedding into the LLM, SPD takes the most recent tokens from $k$ different drafts and creates a weighted linear combination (a superposition) of their embeddings. These weights are dynamically determined by the current probability of each draft.
- Single Inference Pass: This blended embedding is processed by the LLM in a single pass. The authors demonstrate that LLMs are "sufficiently linear," allowing them to process this mixture and produce an output distribution containing valid next-token candidates for all underlying drafts.
- Expansion and Pruning: The LLM's output is used to identify the top-$k$ most likely next tokens. These are combined with the $k$ existing drafts to create $k^2$ potential new draft candidates.
- N-Gram Interpolation: To maintain coherence—which can be compromised by the "blurry" nature of superposed inputs—SPD employs a set of fast n-gram models (ranging from 2-grams to 6-grams). These models act as a coherency filter, scoring the $k^2$ candidates and pruning them back to the best $k$ drafts.
- Resetting: To prevent the eventual breakdown of internal representations over long sequences, a "reset" mechanism periodically refreshes the generation process every few tokens.
Experimental Setup
The researchers evaluated SPD using several standard benchmarks to measure quality, factuality, and speed:
- OpenWebText: Used for evaluating general generation quality and perplexity.
- TriviaQA & Natural Questions: Used to test fact-based coverage (i.e., whether the correct answer appears in at least one of the $k$ drafts).
- RedPajama: A subset was used to construct frequency tables for the n-gram interpolation models.
- Human Evaluation: Conducted via Amazon Mechanical Turk to compare user preferences between SPD and standard Nucleus Sampling in compute-normalized settings.
Key Insights
The Linearity Hypothesis
A central finding of this research is that LLMs can effectively interpret superposed inputs. For approximately 10–20 timesteps, the model's internal representations of a mixture of tokens remain remarkably close to a mixture of the model's representations of individual tokens. This suggests that the high-dimensional space of LLM embeddings possesses structural properties that allow for parallel information processing.
N-Grams as Anchors
While the LLM provides high-level semantic intelligence, it can become confused by superposed inputs. The n-gram models serve as essential "local" grounding. Despite their simplicity, they are computationally inexpensive and critical for preventing the generated text from degrading into gibberish.
Diversity over Perfection
In a "compute-normalized" setting—where two algorithms are given the same total processing power—users frequently prefer having multiple "good" drafts over a single "great" draft. The diversity of options provided by SPD is often more valuable to a user than the marginal quality increase of a single-pass Nucleus Sampling generation.
Results
SPD demonstrates significant improvements over standard decoding methods across multiple metrics:
- Speed: SPD is substantially faster than standard methods. For $k=3$ drafts, it achieves a 2.44x speedup over Nucleus Sampling; for $k=8$, the speedup reaches 3.54x.
- Quality: On OpenWebText, the best draft produced by SPD showed a 5% lower average perplexity than Nucleus Sampling when matched for compute.
- Factuality: On TriviaQA, using three drafts with SPD increased the probability of generating the correct answer by 2.72% compared to the best single-pass greedy decoding.
- Human Preference: In head-to-head studies, SPD generations were preferred 63.6% of the time over Nucleus Sampling in compute-normalized setups.
Limitations and Future Work
Currently, SPD is best suited for short-form completions, such as sentences or code snippets, as the linearity of embeddings degrades over longer sequences. While the drafts are syntactically distinct, they may lack semantic diversity, often expressing the same idea in different ways. Future work may explore "orthogonality" in token embeddings to improve semantic variety. Additionally, while the current implementation uses unoptimized Python code, the authors anticipate even greater performance gains through low-level C++ or CUDA kernel optimizations.
Summary updated