arXiv:2610.21091cs.AIOct 2026

Manuscript Offprint

arXiv:2610.21091

MemComposer: Learning to Assemble Memories for LLM Agents via Reinforcement Learning

Yixuan Xie, Xueqiang Xu, Xinyi Fan, Xinxi Lyu, Tao Feng, Xing Fan, Chenlei Guo, Jie Hao, Shaowen Wang, Jiashuo Sun, Jiawei Han

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Agent memory enables large language model (LLM) agents to reuse past experiences without updating their parameters. However, semantic similarity alone does not guarantee memory usefulness: downstream performance depends on how memories are selected and presented to the agent. We propose MEMCOMPOSER, a memory composer that jointly examines the current query and retrieved candidates to decide which experiences to include, how many to select, and how to order them. We train the composer using Experience Policy Optimization (ExPO), a GRPO-based framework that evaluates assembled memory contexts through complete agent interactions and uses task-success feedback to optimize the assembly policy. Across three τ2\tau^{2}-bench domains with two frozen executors, MEMCOMPOSER outperforms the strongest baseline for each executor while reducing average memory-token usage by 16.9% and 4.9%, respectively. The learned policy also transfers to unseen domains, executors, and memory banks, and benefits from memories generated by stronger models without further training. These results demonstrate the value of learning query-specific memory assembly using downstream task feedback.

1 Introduction

Agent memory augments large language models (LLMs) with reusable experience (Zhang et al., 2025c; Hu et al., 2025), skills (Wang et al., 2024a; Zheng et al., 2024; Ouyang et al., 2026), and knowledge (Park et al., 2023; Zhong et al., 2024; Packer et al., 2023; Xu et al., 2025; Chhikara et al., 2025) without updating model parameters, and has shown promising potential for agent continuous learning (Shinn et al., 2023; Suzgun et al., 2026; Ouyang et al., 2025; Zhang et al., 2026b). A typical agent memory system stores past experiences in an external bank, retrieves candidate memories for a new task, and inserts them into the agent's context to

Figure

Write the prepared sales forecast to the Orion team's shared spreadsheet.

RETRIEVED MEMORY

Sales forecasting

Updated the Atlas team's sales forecast by writing the prepared data directly to its shared spreadsheet.

Write directly

Write fails

Permission denied

High similarity / Low usefulness

RETRIEVED MEMORY

Automated photo backup

Fixed a failed photo backup by

requesting write access for svc-

agent, then retrying the upload

after approval.

Obtain access

then write

Write succeeds

Access established

Low similarity / High usefulness

Figure 1: Semantic Similarity ≠\neq Memory Usefulness. The more similar memory misses the permission issue; the less similar one leads to success.

guide its subsequent decisions. However, the effectiveness of an agent’s memory system depends on how useful the retrieved memories are for the current task. Recent work on agentic memory (Wang et al., 2025; Zhao et al., 2024) has primarily focused on improving memory representations, while still relying on similarity-based methods, such as sparse retrieval (Robertson and Zaragoza, 2009) and embedding-based retrieval (Karpukhin et al., 2020; Izacard et al., 2022; Zhang et al., 2025b), for retrieved memories.

Although such methods are widely used in knowledge-intensive scenarios such as retrieval-augmented generation (RAG) (Lewis et al., 2020; Guu et al., 2020; Gao et al., 2023) and offer a natural starting point, similarity alone does not guarantee that a retrieved memory is useful. As illustrated in Figure 1, a memory describing semantically less similar content provides the crucial information while the similar memory does not. Recent work

Figure

(a) Effect of memory count

Figure

(b) Effect of ordering

Figure 2: Both the number and the order of memory matter. Frozen Qwen3-4B-Instruct agent on τ2\tau^{2}-bench pass 1^{1} averages c/nc/n across tasks; pass 4^{4} averages (c4)/(n4)\binom{c}{4}/\binom{n}{4}, where cc of nn trials succeed. Dashed lines denote no-memory performance. (a) Increasing kk does not consistently improve performance, and the best kk differs across domains. (b) Reordering the same memory set changes per-task outcomes, though no single order is best on average.

has accordingly used downstream execution feedback to learn memory utility or optimize memory-use policies (Zhang et al., 2026c; Zhou et al., 2025; Yan et al., 2026). Closing this gap therefore requires learning how candidate memories jointly affect downstream task performance, enabling the model to assemble a variable-length memory sequence tailored to the current query.

To better understand how memory assembly affects downstream task performance, we examine two key decisions: how many memories to include and in what order to present them. Figure 2a shows that performance varies non-monotonically with memory count, with different domains favoring different retrieval budgets. Figure 2b further shows that even when the selected memories remain unchanged, their presentation order affects task outcomes, consistent with order sensitivity observed in in-context learning (Lu et al., 2022). Together, these observations suggest that constructing a useful memory context requires decisions beyond ranking memories by similarity. To address this problem, we introduce MEMCOMPOSER, a memory composer that jointly examines the task query and retrieved candidates to select an ordered subset of variable size. We train the composer using Experience Policy Optimization (ExPO), a GRPO-based framework that evaluates assembled contexts through complete agent interactions.

By learning to assemble useful memory combinations, MEMCOMPOSER outperforms the strongest baseline for each agent while using fewer memory tokens per task: 26.9% fewer for Qwen3-4B-Instruct and 35.2% fewer for Ministral-3-8B-Instruct on RETAIL, and 16.9% and 4.9% fewer, respectively, across all domains. Furthermore, the learned composer demonstrates strong transferability to unseen domains, executors, and memory banks. Notably, MEMCOMPOSER continues to improve performance when supplied with memories generated by stronger models, without further training (Figure 6). This suggests that it learns a transferable ability to assess which memories are useful for downstream tasks.

Our contributions are summarized as follows:

• We propose MEMCOMPOSER, a memory composer that jointly selects and orders a variable-size subset of retrieved experiences for a frozen LLM agent.

• We develop Experience Policy Optimization (ExPO), a GRPO-based training framework that evaluates assembled contexts through complete agent interactions and combines empirical task success with selection-size and format penalties.

• Experiments on τ2\tau^{2}-bench demonstrate improved task success and memory-token efficiency with two frozen executors, together with strong transferability across domains, executors, and memory sources.

References (1)