Abstract
As Large Language Models (LLMs) generate increasingly long sequences, the memory required for Key-Value (KV) caches grows linearly, often exceeding the memory footprint of the model parameters themselves. While sparse attention methods attempt to mitigate this by evicting tokens, they frequently suffer from permanent context loss. This paper introduces ADORE (ADaptive tOken RElease), a framework that optimizes LLM inference through dynamic KV cache management. By employing a lightweight controller to predict token importance and a mechanism to rebuild discarded tokens on-demand, ADORE achieves significant throughput gains (up to 221.8%) without compromising text quality.
Introduction: The KV Cache Bottleneck
The primary challenge in scaling LLM inference to long contexts is the linear growth of Key-Value (KV) states. For a standard 7B parameter model, caching 1,000 tokens can consume more memory than the weights themselves. Existing "Sparse Attention" solutions attempt to cap this cache size by retaining only a subset of tokens (e.g., recent or high-attention tokens). However, these methods face a critical dilemma: a token deemed unimportant at one step may become essential later. Once evicted, this context is lost forever, leading to performance degradation or hallucinations.
Methods: The ADORE Framework
ADORE addresses the limitations of static eviction through three core components designed for efficiency and flexibility.
- Lightweight Controller Module: Instead of relying on computationally expensive full-attention weights, ADORE uses a small Gated Recurrent Unit (GRU) to predict token importance. This controller is trained to approximate ideal top-K attention patterns with minimal overhead.
- Adaptive Token Release: Based on the controller's predictions, the system maintains a fixed-size KV cache. It retains high-importance tokens and "releases" (evicts) those with low predicted importance to keep memory usage constant.
- KV States Rebuild: The central innovation of ADORE is the ability to "rebuild" KV states. If the controller identifies that a previously released token has regained relevance, its state is re-computed on the fly. This provides a safety net, allowing the model to recover context without storing the entire history.
- Efficient Implementation: To maximize hardware utilization, cache updates are implemented as matrix multiplications rather than slow indexing operations like
gather.
Experimental Evaluation
The researchers evaluated ADORE across a diverse set of tasks:
- Natural Language Generation: UltraChat (dialogue), EverythingLM (instructions), and Math.
- Stream Generation: StreamEval and StreamChat, simulating infinite-length conversations.
- Natural Language Modeling: CNN Dailymail and SAMSum summarization tasks to measure perplexity (PPL).
Key Results and Insights
ADORE demonstrates that re-computing a small number of vital tokens is significantly more efficient than storing thousands of unnecessary ones.
- Throughput Gains: ADORE achieved a throughput increase of 151.4% to 221.8% compared to full attention during long-sequence generation (768–960 tokens).
- Performance Retention: Unlike methods like Window Attention or $H_2O$, which typically see a 7-14% drop in BLEU scores, ADORE showed a +1.2% improvement over full attention on the UltraChat dataset.
- Streaming Stability: In "infinite" streaming tests, ADORE maintained stable memory usage and high accuracy, whereas full attention eventually failed due to Out-of-Memory (OOM) errors.
Limitations and Future Work
While effective, ADORE requires a small amount of fine-tuning (via QLoRA) to align the LLM with sparse attention patterns and train the controller. During this phase, the model still encounters $O(n^2)$ complexity to learn the full attention distribution. Future research will focus on developing more generalized controllers that can be applied across different architectures without retraining.
Summary updated