TL;DR
Generative recommendation using Large Language Models (LLMs) is powerful but painfully slow due to autoregressive decoding. This paper introduces AtSpeed, a speculative decoding framework specifically designed for the "top-K" requirements of recommendation systems. By aligning a smaller draft model with the target LLM and relaxing verification constraints, AtSpeed achieves up to a 2.5× speedup while maintaining recommendation accuracy.
What Problem Does This Paper Address?
Generative recommendation models represent items as token sequences (like titles or IDs) and use LLMs to "generate" a list of recommendations. However, LLMs generate tokens one by one autoregressively, which incurs massive inference latency. In fact, decoding often accounts for over 90% of the total inference time cost.
Speculative Decoding (SD) is a common solution for this bottleneck: a tiny "draft" model quickly predicts several tokens, and the large "target" LLM verifies them in a single parallel batch. If the draft is correct, the system skips several expensive LLM steps.
The catch? Standard SD is built for N-to-1 verification (generating a single sequence or sentence). Recommendation, however, requires N-to-K verification—generating a list of $K$ distinct items via beam search. In a strict setting, if the draft model fails to predict even one of the top-$K$ items correctly, the entire speculative step is rejected. This "all-or-nothing" requirement makes standard SD highly inefficient for recommender systems, leading to excessive rejected drafts and wasted compute.
Methods: The AtSpeed Framework
To overcome the N-to-K bottleneck, the authors propose AtSpeed, an alignment framework that optimizes speculative decoding from two distinct angles:
-
AtSpeed-S (Strict) for Lossless Acceleration: Designed for scenarios where exact target LLM outputs must be preserved. It uses a novel optimization objective combining Reverse Kullback-Leibler Divergence (RKLD) and a density regularization term. Instead of matching the entire vocabulary distribution like standard knowledge distillation, this forces the draft model to align its high-probability outputs specifically with the target LLM’s top-$K$ sequences.
-
AtSpeed-R (Relaxed) for Maximum Speed: For even greater acceleration, the authors introduce a relaxed sampling verification strategy. Instead of requiring a perfect match for the top-$K$ list, it allows the system to accept drafted sequences based on their generation probabilities. To support this, AtSpeed-R minimizes the Total Variation Distance (TVD) between the draft and target models, significantly reducing trivial LLM calls while maintaining high recommendation quality.
-
Tree-based Attention: To verify multiple beam search candidates efficiently, AtSpeed utilizes a tree-structured attention mechanism. This avoids redundant computations for sequences that share the same prefix—a common occurrence in beam search—further streamlining the verification step.
Datasets
The researchers evaluated AtSpeed on four real-world datasets:
- Amazon Beauty: User interactions with beauty products.
- Amazon Games: User interactions with video games.
- MovieLens-1M: A classic movie recommendation benchmark.
- Goodreads: Book reviews and ratings.
Experiments utilized LLaMA-7B as the target model and a significantly smaller LLaMA-68M as the draft model.
Key Insights and Results
- The N-to-K Bottleneck is Unique: The primary insight is that recommendation isn't just "harder" NLP; the verification logic itself must change. Strict top-$K$ matching is an unreasonably high bar for a tiny draft model without specialized alignment.
- Alignment over Distillation: Standard knowledge distillation (KD) tries to match the entire vocabulary distribution. AtSpeed demonstrates that for recommendation, focusing the draft model's "attention" strictly on the top-K sequences causes the acceptance rate (and thus speed) to skyrocket.
- Significant Speedups: AtSpeed-S (Strict) achieved nearly a 2× speedup across datasets with zero drop in ranking accuracy (lossless). AtSpeed-R (Relaxed) pushed this further, reaching up to a 2.5× speedup by accepting a negligible drop in accuracy.
- Robustness: The framework proved effective across different values of $K$ (from 1 to 20), consistently outperforming standard distillation baselines like WordKD and SeqKD.
Limitations and Future Work
- Draft Model Overhead: While the draft model is small, it still consumes resources. Future work could explore non-LLM draft models (like traditional collaborative filtering models) that might generate high-quality drafts even faster.
- Memory Optimization: The current implementation focuses primarily on latency. Integrating memory-access optimizations, such as advanced KV cache management, could further improve throughput in high-traffic production environments.
- Long-tail Items: On datasets with extremely long-tailed distributions, the draft model occasionally struggles to align, leading to lower speedups. Refining the relaxed strategy for these edge cases remains an open challenge.
Summary updated