REMORY: Learning Residual Memory for Context Compaction

Hanchen Xia, Baoyou Chen, Yutang Ge, Naihao Deng, Senqiao Yang +3 more
10/8/2026
cs.CLcs.AI

No official code found. Best implementation: 1ring2rta/Remory (46 stars, MIT, last commit 2026-10-08).

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.

View on arXivView PDF

Code Implementations(1)

1ring2rta/RemoryCommunity100%
MIT

Remory: Learning Residual Memory for Context Compaction

461Oct 7, 20261 weeks agoMIT
context-compactioninferencellm-agentsresidual-memory

Similar Papers

Cite this paper

@article{xia2026remory,
  title  = {REMORY: Learning Residual Memory for Context Compaction},
  author = {Hanchen Xia and Baoyou Chen and Yutang Ge and Naihao Deng and Senqiao Yang and Zilong Dong and Weihao Yuan and Siyu Zhu},
  year   = {2026},
  eprint = {2610.11287},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2610.11287v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2610.11287.svg)](https://codeofpaper.com/paper/2610.11287)

Discussion