Test-Time Memory Construction

Zijun Wang, Yifan Ji, Haidong Xin, Zhenghao Liu, Yukun Yan +4 more
10/9/2026
cs.CL

Official code: OpenBMB/T2Mem (5 stars, Python, MIT, last commit 2026-09-27).

Abstract

Large Language Models (LLMs) struggle to answer questions over long interaction histories, where relevant evidence may be scattered across distant sessions. Existing memory systems typically construct and maintain sophisticated memory representations offline, before user queries are observed, incurring substantial overhead and limiting their ability to adapt memory construction to query-specific information needs.

Show full abstract

In this paper, we propose T$^2$Mem, a Test-Time Memory construction framework that defers memory construction to inference and progressively builds memory along the reasoning process. Specifically, T$^2$Mem extracts lightweight episode-level metadata offline to capture key events and temporal associations as retrieval cues, while retaining links to the original interactions to facilitate the reconstruction of dependencies across episodes. At test time, the LLM adaptively retrieves and organizes metadata and raw interactions, progressively constructing query-specific memory as reasoning unfolds. Experiments on LoCoMo and LongMemEval show the effectiveness of T$^2$Mem by consistently outperforming strong baselines across different backbone LLMs while substantially reducing the overhead of memory construction. Further analysis demonstrates that deferring memory construction to inference enables the memory construction process to dynamically adapt to the information needs of individual queries. All code is available at https://github.com/OpenBMB/T2Mem.

View on arXivView PDF

Code Implementations(1)

OpenBMB/T2MemOfficial100%
MIT

Experiment code for T2Mem: Test-Time Memory Construction.

50Python, ShellSep 27, 20262 months agoMIT

Similar Papers

Cite this paper

@article{wang2026testtime,
  title  = {Test-Time Memory Construction},
  author = {Zijun Wang and Yifan Ji and Haidong Xin and Zhenghao Liu and Yukun Yan and Zulong Chen and Yu Gu and Ge Yu and Maosong Sun},
  year   = {2026},
  eprint = {2610.13348},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2610.13348v1}
}

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.13348.svg)](https://codeofpaper.com/paper/2610.13348)

Discussion