Introduction
Large Language Models (LLMs) are increasingly deployed for long-context tasks such as multi-document summarization and complex retrieval. However, these models face a significant "memory wall" due to the Key-Value (KV) cache, which stores previous token representations to avoid redundant computation. In long sequences, the KV cache can exceed the model's parameters in size, necessitating efficient token eviction strategies to maintain a manageable memory footprint.
Current state-of-the-art eviction methods, including H2O, TOVA, and SnapKV, primarily rely on attention scores to determine token importance. These methods assume that tokens with high alignment to the current query are the most critical to retain. This paper argues that such an approach is incomplete because it ignores the Value vectors, which contain the actual information being aggregated.
Methodology: The CAOTE Framework
The authors propose CAOTE (Cache Selection via Attention Output Error), a post-training method that optimizes LLM memory by minimizing the mathematical error in the attention output caused by eviction. Unlike previous heuristics, CAOTE considers both the attention weights and the content of the Value vectors.
The CAOTE Score
The core of the method is a closed-form metric derived to calculate the "eviction error"—the difference between the full attention output ($X_{attn}$) and the output after removing a specific token $j$. The resulting score $c_j$ is defined as: $$c_j = \frac{\alpha_j}{1 - \alpha_j} \| X_{attn} - v_j \|_2$$ where $\alpha_j$ represents the attention score and $v_j$ is the value vector. This formula effectively identifies tokens that are either highly attended to or contain information that is significantly different from the current aggregate state.
FastCAOTE and Integration
To ensure practical deployment, the authors introduced FastCAOTE, which approximates the dynamic attention output $X_{attn}$ using a simple mean of the value vectors. This reduces computational overhead to negligible levels (less than 0.1% during prefill). CAOTE is designed as a "meta-heuristic" that can be integrated into existing methods like H2O or SnapKV to refine their selection process.
Experimental Results
The framework was evaluated using Llama 3.1-8B, Llama 3.2-3B, and Qwen 2.5 models across benchmarks including LongBench and "Needle-In-A-Haystack."
Performance Gains
The integration of CAOTE consistently improved performance across all tested baselines. On the "Needle-In-A-Haystack" retrieval task, adding CAOTE to the H2O baseline resulted in precision increases of 30% to 60% at a 4k token budget. In LongBench tasks, H2O + CAOTE significantly improved the average score for Llama 3.1-8B, increasing it from 16.89 to 33.31 at a 2k budget.
Efficiency and Perplexity
Beyond accuracy, CAOTE maintained lower perplexity on long-form text (Booksum), indicating better preservation of the model's internal state. The computational cost of FastCAOTE is minimal, making it a viable solution for real-world deployment on resource-constrained hardware.
Conclusion
CAOTE demonstrates that incorporating Value vectors into eviction logic is essential for maintaining LLM performance under tight memory constraints. By shifting from simple attention-based heuristics to a principled error-minimization approach, CAOTE enables high-fidelity long-context processing on consumer-grade hardware. Future work may explore adaptive layer-wise budgeting and accounting for non-linearities like layer normalization.
Summary updated