TRANSMISSION // 2611.31265v1

A learned way to shrink an AI’s working memory

Source published

SD-Cache compresses the internal memory language models use to process retrieved documents. Tests suggest it can retain useful information at tight memory budgets, though repeated updates remain difficult.

AI-generated conceptual illustration for A learned way to shrink an AI’s working memory
AI-generated conceptual illustration; not documentary evidence.

When an AI system reads a growing pile of documents, its working memory can grow too. A new method called SD-Cache tries to keep that memory a fixed size by blending incoming information into compact internal slots—without knowing what users will ask later.

Retrieval-augmented generation (RAG) gives a language model access to documents that may contain information missing from its training. But retrieved text has to be processed and represented inside the model’s key-value, or KV, cache: an internal working memory used while generating a response. As more context arrives, that cache can grow, consuming memory and potentially limiting inference throughput.

The paper asks whether a model’s KV states can be consolidated into a fixed-size memory while retaining information useful for future questions—even when those questions are not yet known. The authors call their approach SD-Cache, short for State-guided and Dynamically updated Cache.

Consolidating, rather than simply discarding

Some cache-compression methods keep selected states and discard others. Other approaches encode a document into a different compact representation. SD-Cache instead learns to blend incoming KV states into a limited set of memory slots. The underlying generator remains frozen; a separate trainable network learns how to update the slots.

The system begins with anchor slots based on the first tokens in a context. As new material arrives, an anchor-pooling module estimates which incoming states are poorly represented by the current memory and uses that novelty signal to guide updates. A second component, state-guided correction, uses associations gathered from the original, uncompressed KV stream to refine the pooled slots. The process is designed to run in one forward pass over each new context, without query-specific optimisation.

During training, the authors teach the compression network to make the frozen language model’s outputs from the compact memory resemble its outputs from the full KV cache. The generator itself is not trained for this method. The paper evaluates SD-Cache on retrieval-augmented question answering and on RULER, a set of synthetic long-context tasks involving retrieval and reasoning.

What the tests found

On five question-answering datasets, using Mistral-7B and five retrieved documents per question, SD-Cache’s average answer-matching accuracy was 68.67% at 16-fold compression. The paper reports this as the highest average among the compared compression methods at that setting; the uncompressed full-cache reference scored 71.00%. At 128-fold compression, SD-Cache averaged 65.46%, compared with 63.80% for PISCO, a method included in the comparison.

The authors also tested the method on 13 RULER tasks with a 4,096-token context and several language-model backbones. With Llama 3.1-8B, the cache was reduced by 98.44% in one setting, and SD-Cache scored 53.78% average accuracy. The paper reports the highest score among methods with available results at each non-zero reduction ratio in that table. These are benchmark results, not evidence that the method will perform equally well on every model, document collection, or real-world service.

Compression also has a cost: preparing the compact memory requires computation. The authors provide analytical estimates rather than direct GPU timing measurements. For a Mistral-7B question-answering setup, they estimate a total of 13.95 TFLOPs for SD-Cache, versus 11.82 for using the full KV cache and 12.88 for PISCO. Preparation costs could be spread across multiple questions that reuse the same context, but the estimates do not demonstrate end-to-end speedups in a deployed system.

A promising result with a clear caveat

A major limitation appears when the same memory must be updated repeatedly as a long context arrives in chunks. In one experiment, performance fell sharply for a recurrent update strategy as the context grew to 16,000 tokens. A skip-connected strategy did better in that test, but the authors say maintaining accuracy through repeated updates remains challenging. They also note that the method does not explicitly optimise how memory is divided among model layers.

The work is a preprint, so its claims have not necessarily been validated through peer review. Some comparisons are limited by which baselines had available implementations or results, and the paper says source code and training scripts will be released in a camera-ready version. Its benchmarks support the narrower conclusion that learned consolidation can preserve useful information under severe cache compression in tested settings—not that it removes memory costs or guarantees reliable answers in practice.

Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.