cs.CLOct 8, 2026

REMORY: Learning Residual Memory for Context Compaction

Authors: Hanchen Xia, Baoyou Chen, Yutang Ge, Naihao Deng, Senqiao Yang, Zilong Dong, Weihao Yuan, Siyu Zhu

Organizations: Shanghai Academy of AI for Science · Fudan University · Shanghai Jiao Tong University · University of Michigan · The Chinese University of Hong Kong · Alibaba Group · Nanjing University · Shanghai Innovation Institute

Abstract

Long-horizon agents compact their history to continue within a finite context window, but a textual summary alone may not support every subsequent decision. We introduce REMORY, a neural memory network that supplements the summary with a bounded sequence of soft memory tokens. Given the history and summary, the network learns to generate tokens that help a frozen LLM approximate the continuation it would produce with the full history. The tokens are conditioned on the summary and appended after it, forming an analogue of a residual connection along the sequence dimension. On SummHay, REMORY improves source attribution at nearly unchanged insight coverage and approaches the full-context joint score using only 5.2% of the input positions. Across long-horizon agent benchmarks, Qwen3.8-27B and GLM-5.3-Flash show consistent gains with residual memory. Both models also exhibit substantially fewer repeated tool outputs and tool errors on BrowseComp and Terminal-Bench 2.1.

Figures & tables

Explore similar work

CardsList
  1. Continuous Context Management

    Sep 28, 2026William Hoy, Jingxuan Fan, Nurcin Celik +1Context DistillationLong-Horizon LLM Agents

  2. InfoMem: Training Long-Context Memory Agents with Answer-Conditioned Information Gain

    Jun 2, 2026Tiancheng Han, Yong Li, Wuzhou Yu +2Long-Context ModelingRL for LLM Agents

  3. MemTrain: Self-Supervised Context Memory Training

    Jun 2, 2026Ziheng Li, Xingrun Xing, Haoqing Wang +2LLM Agent MemoryPersistent Memory for Language Models