HashEvict: A Pre-Attention KV Cache Eviction Strategy using Locality-Sensitive Hashing
Minghui Liu, Tahseen Rabbani, Tony O'Halloran, Ananth Sankaralingam, Mary-Anne Hartley, Furong Huang, Cornelia Ferm\"uller, Yiannis Aloimonos

TL;DR
HashEvict is a novel LSH-based algorithm that compresses the KV cache in transformer models, reducing memory usage by 30-70% with minimal performance loss across various NLP tasks.
Contribution
It introduces a pre-attention, dynamic cache eviction strategy using locality-sensitive hashing to efficiently compress KV caches in large language models.
Findings
Compresses KV cache by 30%-70%.
Maintains high performance in multiple NLP tasks.
Reduces computational costs compared to attention-based methods.
Abstract
Transformer-based large language models (LLMs) use the key-value (KV) cache to significantly accelerate inference by storing the key and value embeddings of past tokens. However, this cache consumes significant GPU memory. In this work, we introduce HashEvict, an algorithm that uses locality-sensitive hashing (LSH) to compress the KV cache. HashEvict quickly locates tokens in the cache that are cosine dissimilar to the current query token. This is achieved by computing the Hamming distance between binarized Gaussian projections of the current token query and cached token keys, with a projection length much smaller than the embedding dimension. We maintain a lightweight binary structure in GPU memory to facilitate these calculations. Unlike existing compression strategies that compute attention to determine token retention, HashEvict makes these decisions pre-attention, thereby reducing…
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.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSpam and Phishing Detection · Internet Traffic Analysis and Secure E-voting · Network Security and Intrusion Detection
MethodsSoftmax · Attention Is All You Need
