Fast KV Compaction via Attention Matching
Abstract
Lay Summary
When an AI language model reads a long document or holds a long conversation, it keeps an internal memory of everything it has seen. This memory grows with the length of the input, and for long texts it becomes a major bottleneck — taking up large amounts of computer memory and slowing the system down. A common fix is to summarize the text into something shorter, but summaries discard details that may later turn out to matter, which hurts the model's answers. A recent alternative compresses this memory directly and preserves quality well, but it is slow and expensive, often needing hours of computation for a single document. We introduce a method called Attention Matching that compresses the internal memory quickly while keeping the information the model actually relies on. Rather than retraining anything, it builds a compact memory designed to reproduce how the model would have behaved on the original text, using simple calculations that finish in seconds. This makes it possible to shrink the memory many times over with little loss in accuracy, helping AI systems handle long documents and conversations far more efficiently and affordably.