Locret: Enhancing Eviction in Long-Context LLM Inference with Trained Retaining Heads on Consumer-Grade Devices
Yuxiang Huang, Binhang Yuan, Xu Han, Chaojun Xiao, Zhiyuan Liu

TL;DR
Locret introduces a novel eviction policy with learnable retaining heads that significantly improves long-context inference efficiency in LLMs on consumer devices, enabling up to 20x cache compression with minimal performance loss.
Contribution
It is the first framework to create an eviction policy compatible with chunked prefill, enhancing memory efficiency and long-context inference on consumer-grade hardware.
Findings
Achieves up to 20x KV cache compression ratio
Enables 128K+ token inference on a single GPU
Less than 10% performance loss compared to baseline
Abstract
Scaling the input context length of a large language model (LLM) incurs a significant increase in computation cost and memory footprint to maintain the attention key-value (KV) cache. Existing KV cache compression methods suffer from inefficient compression strategies and limited memory reduction effects, making it difficult for LLMs to conduct long-context inference on consumer-grade devices, especially when inferring long-context stream input. Such obstacles prevent consumer-grade devices from supporting more complex applications, creating challenges for the democratization of LLMs. To overcome this, we propose Locret, the first framework to create an eviction policy compatible with chunked prefill. By evaluating the causal importance of KV cache units by learnable retaining heads, Locret enables precise eviction of cache units, facilitating efficient long-context inference. In our…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Imbalanced Data Classification Techniques · Topic Modeling
MethodsSoftmax · Attention Is All You Need · Shrink and Fine-Tune
