Latent Compaction with Test-Time Training
Yingfa Chen, Xingyu Shen, Chaojun Xiao, Xu Han
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 32× 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
Create a lesson
Related papers
Manacá-1B-Instruct-2: Reproducible Safety Alignment for a Native Brazilian-Portuguese LLM. Negative DPO Results, a Controlled Composition Scan, and a Silent Failure Mode of the LLM Judge
Bruno Leonardo Santos Menezes, Carlos Leonardo Souza Cardoso, Fabio André Machado Porto
PerSo: Investigating Facets of LLMs' Social Intelligence in Real-World Persuasion Scenarios
Ali Zamani, Soroush Esfahanian, Erfan Shahabi et al.
PrismaCoder: Pushing the Boundaries of Open Multimodal Code Intelligence through Decomposed Rubric Synthesis
Qiushi Sun, Jingyang Gong, Yang Liu et al.
VASPO: Self-Distillation with Privileged Value Estimation
Fei Wu, Zhenrong Zhang, Jianshu Zhang et al.
ReaDy: Recurrent States as Dynamic Context for Speculative Drafting in Hybrid Linear Attention Large Language Models
Bohan Sun, Zunhai Su, Xialie Zhuang et al.
Lost in Translation: Why Lower Bias Scores Don't Mean Fairer Models
Harsh Kumar