Abstract
Speculative decoding (SD) has emerged as a primary strategy for accelerating Large Language Model (LLM) inference. However, standard SD is strictly lossless, rejecting draft tokens that deviate from the target model's output even when the semantic meaning remains unchanged. While "Judge Decoding" can mitigate this by allowing minor mismatches, it has historically relied on expensive and non-scalable human annotations. We introduce AutoJudge, a framework that automates the identification of "unimportant" tokens and trains a lightweight classifier to accept safe mismatches during inference. Our approach achieves up to a 2x speedup on mathematical reasoning tasks with less than a 1% drop in accuracy, all without requiring manual human labeling.
Introduction
Large Language Models (LLMs) are computationally expensive due to their autoregressive nature, generating text one token at a time. Speculative Decoding (SD) addresses this by using a small "draft" model to propose multiple tokens, which a larger "target" model then verifies in parallel. In its standard form, SD is lossless: if the draft model suggests a token that differs from the target model's top choice, the token (and all subsequent tokens in that sequence) is discarded.
This strict adherence to the target model's distribution is often unnecessary. In tasks like mathematics or programming, multiple phrasing or variable naming choices can lead to the same correct result. Previous attempts to implement "lossy" decoding—where semantically equivalent mismatches are accepted—depended on human experts to label which tokens were critical. AutoJudge removes this bottleneck by automating the data collection and training process.
Methodology
AutoJudge consists of a three-stage pipeline designed to make speculative decoding more flexible and efficient.
1. Automated Mining
To identify which tokens are truly essential for a correct output, AutoJudge employs a semi-greedy search algorithm. Starting with a correct response generated by the target model, the algorithm systematically replaces tokens with suggestions from the draft model. If the final output (e.g., the final numerical answer in a math problem or the successful execution of a code block) remains correct despite the substitution, the substituted token is labeled as "unimportant." This process creates a high-quality dataset of "safe" mismatches tailored to the specific model pair.
2. The Classifier
Using the data from the mining stage, AutoJudge trains a lightweight logistic regression classifier. This "Judge" does not look at the text directly; instead, it analyzes the hidden states (internal mathematical representations) of the LLM. This allows the Judge to predict in real-time whether a mismatch between the draft and target model is likely to impact the final answer's quality.
3. Inference Integration
The trained classifier is integrated into high-performance inference engines like vLLM. During generation, if the draft and target models disagree, the Judge evaluates the mismatch. If the Judge deems the mismatch unimportant, the system accepts the draft token and continues, effectively increasing the number of tokens accepted per inference cycle.
Experimental Setup
The researchers evaluated AutoJudge across a diverse set of benchmarks to test its robustness and generalizability:
- GSM8K: Grade school math word problems.
- LiveCodeBench: Real-world programming tasks.
- TriviaQA: Fact-based question answering.
- Arena-Hard-Auto-v2.0: Open-ended creative writing tasks.
- MATH-hard: Challenging mathematics problems used to test task transferability.
Key Insights
Contextual Importance
A primary finding of the study is that token importance is highly contextual. A token's value is determined not by its identity, but by how it influences the subsequent generation. AutoJudge's automated search captures these contextual nuances more effectively than human annotators, who may struggle to predict how a specific model's internal logic will react to a minor change.
Automation vs. Human Labeling
In comparative tests, the automatically mined data produced a classifier that outperformed one trained on 8–10 hours of manual human labeling. The automated process is more consistent and better aligned with the specific "quirks" of the models being accelerated.
Efficiency of Embeddings
The study demonstrates that a simple linear layer placed on top of existing LLM hidden states provides a sufficient signal for the Judge. This ensures that the overhead of the Judge itself is negligible compared to the speed gains achieved through increased token acceptance.
Results
AutoJudge demonstrates significant performance improvements across multiple metrics:
- Speedup: On the GSM8K benchmark using a Llama 3.1 70B model, AutoJudge achieved a ~2x speedup over standard speculative decoding.
- Accuracy Preservation: The speed increase resulted in a minimal accuracy trade-off, with a ≤1% drop in math tasks and a ~2% drop in coding tasks.
- Throughput: When integrated with vLLM on A100 GPUs, the system reached generation speeds of 107.4 tokens/second for 8B/70B model pairs.
- Energy Consumption: By increasing the number of tokens generated per forward pass of the target model, AutoJudge reduced total energy consumption per task by approximately 14%.
Limitations and Future Work
While highly effective for objective tasks, AutoJudge faces challenges in creative writing and open-ended generation, where "equivalence" is subjective and harder to define via automated mining. Additionally, while the Judge transfers well to longer contexts within the same domain, it does not transfer perfectly to significantly more difficult tasks (e.g., from GSM8K to MATH-hard), indicating that some domain-specific mining remains necessary.
Future research will explore more advanced drafting techniques, such as tree-based decoding, and investigate methods for defining quality criteria in more informal or subjective generation tasks.
Conclusion
AutoJudge represents a significant step forward in making LLM inference more efficient. By automating the "Judge" training process, it removes the need for human intervention while providing substantial speedups and energy savings. This framework paves the way for more scalable, task-adaptive speculative decoding in production environments.
Summary updated