← Latest papers
💬 NLP

IndexMem: Learned KV-Cache Eviction with Latent Memory for Long-Context LLM Inference

IndexMem addresses the KV-cache bottleneck in long-context LLM inference by combining a learnable indexer for accurate token eviction with a lightweight latent memory module that preserves discarded information, thereby significantly improving performance and stability across various models and benchmarks.

Original authors: Xintong Yang, Hao Gu, Binxing Xu, Lujun Li, Bei Liu, Jiacheng Liu, Qiyuan Zhu, Sirui Han, Yike Guo

Published 2026-05-26
📖 5 min read🧠 Deep dive

Original authors: Xintong Yang, Hao Gu, Binxing Xu, Lujun Li, Bei Liu, Jiacheng Liu, Qiyuan Zhu, Sirui Han, Yike Guo

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to read a massive, 1,000-page novel to answer a single question about the very first page. As you read, your brain naturally tries to remember every word you've seen. But here's the problem: your brain has a limited amount of "working memory." If you try to hold every single word from page 1 to page 1,000 in your head at once, you'll get overwhelmed, slow down, or run out of space entirely.

This is exactly the problem Large Language Models (LLMs) face when dealing with long documents. They use a "memory bank" called the KV Cache to remember what they've read so far. As the text gets longer, this memory bank grows until it fills up the computer's memory, causing the system to crash or slow to a halt.

The paper "IndexMem" proposes a clever two-part solution to this problem, acting like a smart librarian and a backup vault.

The Problem: The "Keep Everything" Trap

Currently, most AI models try to keep a record of every single word (token) they process. This is like trying to keep every receipt from every store you've ever visited in your wallet. Eventually, the wallet is too heavy to carry.

To fix this, previous methods tried to throw away "unimportant" receipts based on simple rules, like "keep the most recent ones" or "keep the ones with the biggest numbers." But these rules are often clumsy. They might throw away a crucial detail from the beginning of the story just because it was old, or they might keep a boring sentence just because it was recent. Once thrown away, that information is gone forever.

The Solution: IndexMem

The authors propose a system with two main parts: a Smart Indexer and a Latent Memory Vault.

1. The Smart Indexer (The "Librarian")

Instead of using a rigid rule to decide what to keep, IndexMem uses a learnable indexer. Think of this as a highly trained librarian who has read millions of books and knows exactly what kind of details are usually important for answering questions later.

  • How it works: As the AI reads, this librarian looks at the current question (or the next word the AI is about to guess) and predicts which parts of the text are actually important.
  • The Benefit: It doesn't just guess based on "recency." It understands the context. It can say, "Even though this word is from page 50, it's critical for the question on page 100, so we must keep it." It learns to be much more accurate at deciding what stays in the main memory and what gets kicked out.

2. The Latent Memory Vault (The "Backup Vault")

Here is the paper's most innovative idea. In the past, if a word was kicked out of the main memory, it was gone forever. If the AI needed that word later, it was a disaster.

IndexMem introduces a Latent Memory module. Think of this as a high-tech, compressed backup vault.

  • The Process: When the Smart Indexer decides to throw a word out of the main memory, it doesn't just delete it. Instead, it squashes that information into a tiny, compressed "summary" and stores it in this special vault.
  • The Retrieval: If the AI later needs to recall that information, it doesn't go back to the main memory (which is empty). Instead, it opens the vault, pulls out the compressed summary, and uses it to fill in the gaps.
  • The Analogy: Imagine you are packing for a trip. You can only fit a few clothes in your suitcase (the main memory). You leave your favorite sweater behind. Instead of throwing it away, you take a high-resolution photo of it and save it on your phone (the Latent Memory). If you miss the sweater later, you look at the photo to remember what it looked like and how it felt, rather than having to carry the whole sweater with you.

Why This Matters

The paper tested this system on various models (like Qwen, Mistral, and Llama) with very long contexts.

  • Better Accuracy: Even when they aggressively threw away 75% to 90% of the memory to save space, the AI still performed incredibly well. It didn't forget the "needle in the haystack" (the specific detail needed to answer a question).
  • Stability: Unlike older methods that would suddenly fail if the important detail was in a "hard" spot in the text, IndexMem remained stable.
  • Efficiency: It allowed the AI to run on standard computer chips without needing massive, expensive supercomputers, because it wasn't trying to hoard every single piece of data.

Summary

In short, IndexMem teaches the AI to be a smarter editor. It uses a learned system to decide what to keep in its immediate memory and a special "compressed vault" to store the rest. This way, the AI can read a whole library without running out of brainpower, and it never truly forgets the details it needs to solve a problem.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →