Latent Compaction with Test-Time Training

Yingfa Chen, Xingyu Shen, Chaojun Xiao, Xu Han

Tsinghua University

Published October 14, 2026 · on the feed October 15, 2026 · ▲ 8 · arXiv 2610.20582

Efficiency & inferenceLLM training & RL Code arXiv ↗Hugging Face ↗

The abstract

Long contexts enlarge key--value (KV) caches, increasing memory use and attention costs during generation. Compressing these caches must preserve information for unseen questions. We introduce **Latent Compaction**, which learns a compact document-specific cache through test-time training. We initialize cache entries using reconstruction importance, teacher attention, and key-space diversity. Training first fits attention outputs and log-normalizers to those of the full cache, with reconstruction-selected entries held fixed. It then jointly optimizes the entire cache through end-to-end distillation from the full-cache model. Model weights remain frozen throughout, and training uses only generic prompts about the document, without access to downstream questions or answers. Experiments on RULER, LongBench, and Phonebook Lookup demonstrate substantial gains over budget-matched compression baselines. On a RULER, for example, our method achieves 96.7% accuracy at 32times compression, compared with 40.0% for KVZip+. The method also transfers across model scales and families, with retrieval gains on both Qwen3 and MiniCPM5. These results show that treating the KV cache as a neural network and optimizing it with test-time training can preserve retrieval accuracy under aggressive compression. The code is released at https://www.github.com/THUNLP/latent-compaction

The Brief

2:05

A short podcast summary of the paper. Written and voiced by AI.

Transcript

Latent Compaction with Test-Time Training. By Yingfa Chen and three others, from Tsinghua University. Published on the fourteenth of October. Its code repository is public and real: about thirty source files.

Long contexts make key-value caches large, and a large cache raises both memory use and attention cost during generation. Compressing the cache is the obvious response, but it carries a hard requirement. The compressed cache has to preserve information for questions nobody has asked yet. Whatever is thrown away cannot be chosen with the eventual question in mind.

Latent Compaction learns a compact cache specific to one document, using test-time training. The cache itself becomes the thing being trained. The model's weights stay frozen throughout. Only the cache entries change.

Initialisation draws on three signals: reconstruction importance, teacher attention, and diversity in key space. Training then runs in two phases. First, with the entries chosen by reconstruction held fixed, the cache is fitted so that its attention outputs and log-normalizers match those of the full cache. Second, the entire cache is optimised jointly, through end-to-end distillation from the model running on the full cache. Throughout, training uses only generic prompts about the document. It has no access to downstream questions or their answers, which is what the requirement of preparing for unseen questions demands.

Experiments on RULER, LongBench, and Phonebook Lookup show substantial gains over compression baselines held to the same budget. One example from RULER: at thirty-two times compression, the method reaches ninety-six point seven percent accuracy. KVZip plus reaches forty percent at the same setting. The method also transfers across model scales and families, with retrieval gains on both Qwen3 and MiniCPM5. Code is released.

The authors draw a reframing from these results. Treat the key-value cache as a neural network, optimise it with test-time training against the model that holds the full cache, and retrieval accuracy can survive compression that is aggressive. Nothing about the model changes. What gets learned is a smaller memory of one document, prepared without knowing what will be asked of it.

More with an account

Listen to every day’s papers

Daily playlists, deep dives, quests for the papers, and quizzes on their key terms.

Join free
KipQuest: the day’s AI research, as podcasts and quests. All papers Android app Privacy Contact Episodes are written and voiced by AI from each paper. Summaries can contain mistakes: the paper is the source.