TL;DR
HArmonized Speculative Sampling (HASS) significantly accelerates Large Language Model (LLM) inference by fixing the "disharmony" between how draft models are trained and how they are actually used during decoding. By aligning training objectives and input contexts with the decoding stage, HASS achieves up to a 4.05x speedup over vanilla auto-regressive decoding, outperforming state-of-the-art methods like EAGLE-2 by 8% to 20% without adding any inference overhead.
The Problem: Disharmony in Speculative Sampling
Large Language Models are notoriously slow because they generate text one token at a time. Speculative sampling speeds this up by using a small, fast "draft model" to guess several tokens ahead, which the large "target model" then verifies in a single parallel step.
However, existing high-performance speculative sampling methods (like EAGLE) suffer from two major discrepancies between training and inference:
- Context Misalignment: During training, draft models are fed "perfect" hidden states from the target LLM. But during actual decoding, they must rely on their own previous (and potentially noisy) predictions to generate subsequent draft tokens. This creates a form of "exposure bias" at the feature level, leading to error accumulation.
- Objective Discrepancy: Standard training optimizes for the entire vocabulary distribution. In practice, LLM decoding often uses top-k or nucleus sampling, meaning only the most probable tokens matter. Training a draft model to get the "long tail" of the distribution right wastes model capacity.
The HASS Solution
To address these issues, the authors propose HASS, which harmonizes the training and decoding stages through two primary innovations:
1. Harmonized Objective Distillation
Instead of standard cross-entropy, HASS uses a Top-K distillation loss. This forces the draft model to prioritize correctly ranking the tokens that the target LLM is most likely to pick. By effectively "recalling" the desired tokens rather than learning the entire distribution, HASS better allocates the draft model's limited capacity to the "head" of the distribution where the target LLM actually operates.
2. Harmonized Context Alignment
HASS introduces a multi-step training procedure to fix context misalignment. Instead of just training on target LLM features, it trains the draft model to use its own predicted features from previous steps as context. This mimics the auto-regressive drafting process used during inference.
To keep this multi-step training efficient, the authors developed a customized attention mask that allows the model to process these sequences in parallel rather than truly sequentially during the training phase.
Key Results
The researchers evaluated HASS across several diverse benchmarks, including MT-bench (multi-turn conversation), HumanEval (code generation), GSM8K (math), and translation tasks. The models were trained on the ShareGPT dataset.
HASS demonstrates superior performance across LLaMA-2 (7B/13B) and LLaMA-3 (8B/70B) models:
- Wall-Clock Speedup: Achieves 2.81x to 4.05x speedup compared to vanilla auto-regressive decoding.
- Superiority over EAGLE-2: Consistently outperforms the previous state-of-the-art by 8% to 20% in speed and improves acceptance length (the number of tokens accepted per cycle) by 8% to 16%.
- Robustness: HASS maintains its lead even with sparse training data (e.g., using only 1/4 of the training set) and generalizes well to translation tasks it wasn't specifically adapted for.
Limitations and Future Work
While HASS adds zero overhead to inference, the multi-step alignment training is more computationally expensive than simpler methods. Standard HASS (3-step alignment) requires roughly 3x the training FLOPs of EAGLE-2. Additionally, performance is sensitive to hyperparameters like the choice of $K$ in the distillation loss. Future work may explore even more sophisticated loss functions to exploit the target LLM's distribution more effectively.
Summary updated