Introduction
Large Language Models (LLMs) have revolutionized natural language processing but remain constrained by high inference latency. This bottleneck stems from the autoregressive nature of decoding, where tokens are generated sequentially. Speculative decoding has emerged as a primary solution, utilizing a smaller "draft" model to propose multiple tokens that a larger "target" model verifies in parallel. While tree-based drafting—where multiple potential paths are explored simultaneously—has further optimized this process, the verification step remains a bottleneck. This paper discusses "Traversal Verification," a novel algorithm that rethinks the verification process from the bottom up to maximize token acceptance rates.
The Limitations of Top-Down Verification
Current speculative decoding frameworks typically employ a top-down verification strategy. In this paradigm, the target model evaluates tokens starting from the root of the drafted tree. This approach suffers from two primary inefficiencies:
- Top-Down Rigidity: If a parent node fails the verification check, the entire subtree branching from that node is discarded. This occurs even if the subsequent tokens in that branch were statistically likely or "correct" according to the target model.
- Token-Level Myopia: Traditional methods often verify tokens in isolation, failing to account for the joint probability of an entire sequence. This narrow focus often results in the rejection of valid sequences that, when viewed as a whole, would meet the target model's distribution requirements.
Proposed Method: Traversal Verification
Traversal Verification addresses these flaws by inverting the verification logic. Instead of a waterfall approach starting at the root, the algorithm begins at the leaf nodes and moves upward.
Bottom-Up Traversal and Sequence-Level Acceptance
By starting at the leaves, the algorithm evaluates the probability of an entire path from the leaf back to the root. If a leaf node is accepted based on sequence-level criteria, the entire path leading to it is validated instantly. This "leaf-to-root" logic allows the system to "rescue" valid subsequences that a top-down approach would have prematurely terminated. If a leaf is rejected, the algorithm backtracks to check siblings or other branches, ensuring that no potentially valid drafted token is wasted.
Sequence-Level RRSw
To ensure the process remains mathematically lossless, the authors adapted Recursive Rejection Sampling without replacement (RRSw) for sequence-level verification. This adaptation ensures that the final output distribution of the speculative process is identical to the distribution of the target model. Consequently, Traversal Verification provides a speedup without any degradation in model quality or "hallucination" beyond the target model's own parameters.
Experimental Evaluation
The researchers benchmarked Traversal Verification using the Spec-Bench dataset, a comprehensive suite covering six NLP domains:
- Multi-turn conversation (MT-Bench)
- Translation (WMT14 DE-EN)
- Summarization (CNN/Daily Mail)
- Question Answering (Natural Questions)
- Mathematical Reasoning (GSM8K)
- Retrieval-Augmented Generation (DPR)
The experiments utilized various model pairs, notably the Llama 3 series (1B draft / 8B target) and Llama 2 (68M draft / 7B target), to demonstrate the algorithm's versatility across different model architectures and sizes.
Results and Discussion
The findings indicate that Traversal Verification consistently outperforms standard token-level verification across all tested dimensions.
Increased Acceptance and Throughput
The algorithm improved the average acceptance length—the number of tokens accepted per decoding cycle—by 2.2% to 5.7%. These gains in theoretical efficiency translated directly into real-world performance, with throughput (tokens per second) increasing by up to 5% over existing state-of-the-art tree decoding baselines.
Scaling and Temperature Sensitivity
The advantages of Traversal Verification become more pronounced as the complexity of the drafting tree increases. In frameworks like Sequoia, which utilize deeper and wider trees, the bottom-up approach is expected to yield even more significant gains. Furthermore, the method excels at higher "temperatures." In creative or stochastic generation modes where probability distributions are more diverse, Traversal Verification’s ability to navigate complex paths allows it to find valid sequences that top-down methods would miss.
Conclusion and Future Work
Traversal Verification represents a significant step forward in making LLM inference more efficient. By treating verification as a sequence-level search problem rather than a token-level gatekeeping task, it maximizes the utility of drafted trees.
However, the method is not without limitations. It provides no benefit in greedy decoding (temperature = 0), where the probability distribution collapses to a single point. Additionally, the exhaustive nature of the search introduces a minor computational overhead during the verification phase. Future research may focus on "pruning" strategies to discard low-probability branches early in the traversal, further optimizing the balance between computational cost and token acceptance.
Summary updated