cs.CLOct 19, 2026

CoMem: Learning to Anticipate Failures from Retrieved Experience

Authors: Yun Shen, Ming Shen, Tianjun Yao

Organizations: The Ohio State University · Shenzhen Loop Area Institute · Shanghai Jiaotong University

Abstract

Reflection lets LLM agents improve from their own attempts, but the memory it builds is local to a single task, so an agent reflecting on its own tends to revisit the same explanation for failure. Cross-task reflective memory addresses this in two forms: retrieved memory keeps past experience explicit and looks up related cases, which is specific but bounded by the bank, and parametric memory internalizes experience into parameters, which generalizes but is grounded in nothing beyond the task description. When both are used, existing agents combine them additively, feeding their outputs to the solver side by side, so retrieved experience never changes what the learned memory produces. We introduce CoMem (Compounding Memory), which makes retrieved experience an input to the learned memory itself, at training and at inference. The agent builds a bank of its own successful and failed reflections, learns from retrieved cases to write failure hypotheses, candidate explanations of how an attempt is likely to go wrong, and at test time reasons from newly retrieved cases to guide each attempt. Varying the retrieved cases gives the memory different perspectives, yielding reflective diversity that is not merely sampled but also grounded in retrieved experience. Across two backbones and five benchmarks in math, code, and multi-hop QA, CoMem achieves strong overall performance. Additional evaluations show that it generalizes to out-of-distribution tasks and enables smaller models to provide effective guidance to stronger solvers.

Figures & tables

Appendix figures & tables2 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. MemComposer: Learning to Assemble Memories for LLM Agents via Reinforcement Learning

    Oct 15, 2026Yixuan Xie, Xueqiang Xu, Xinyi Fan +8Memory-Augmented Language Model AgentsRL for LLM Agents

  2. Experience Memory Graph: One-Shot Error Correction for Agents

    Jul 15, 2026Wenjun Wang, Yuchen Fang, Fengrui Liu +2Agent MemoryLLM Self-Correction

  3. Retrieval-Augmented LLM Agents: Learning to Learn from Experience

    Mar 18, 2026Thomas Palmeira Ferraz, Romain Deffayet, Vassilina Nikoulina +2Fine-TuningLLM Agent Training