Peking University's Mem-T Teaches AI Agents to Remember 14 Points Better
Mem-T uses tree-guided RL to teach LLMs how to build and search memory, beating Mem0 and A-Mem by up to 14.92% F1 while using 24% fewer tokens
ProTakeaways
- Mem-T is a new memory agent that learns to manage its own memory end-to-end via RL, beating Mem0 and A-Mem by up to 14.92% F1.
- The core innovation is MoT-GRPO, a tree-guided RL algorithm that converts sparse terminal rewards into dense per-step supervision for both memory construction and retrieval.
- Mem-T uses a four-layer hierarchical memory (working, factual, experiential, raw) and jointly trains all three memory operations: formation, evolution, and retrieval.
- On out-of-domain benchmarks (HotpotQA, LongMemEval, NarrativeQA), Mem-T generalizes with an average 13.52% improvement over the next best method despite training only on LoCoMo.
- Mem-T reduces inference tokens per query by ~24% compared to GAM while simultaneously improving accuracy, placing it on the Pareto frontier.
- Code and a trained Mem-T-4B model are publicly available on GitHub and Hugging Face.
Long-term memory is one of the hardest unsolved problems in production AI agents. Every time a user closes a chat window, most agents forget everything. Frameworks like Mem0 and A-Mem have made real progress by giving LLMs structured memory stores, but they rely on hand-crafted prompts and frozen models to manage those stores. The result is a ceiling: performance is bounded by how well the base model follows instructions, not by any learned understanding of what good memory management looks like. A new paper from Peking University and Nanyang Technological University proposes a fundamentally different path.
Mem-T is a memory agent that learns to manage its own memory end-to-end through reinforcement learning. The key contribution is not just the agent architecture itself, but a new training algorithm called MoT-GRPO (Memory Operation Tree-guided GRPO) that solves a deep problem in training these systems: how do you give a model useful feedback when it executes hundreds of memory operations before you know whether any of them were helpful?
The credit assignment wall
Imagine an agent processing a 500-turn conversation. It creates, updates, and deletes memory entries at every turn. Then, much later, a user asks a question. The agent either retrieves the right memory and answers correctly, or it doesn't. Standard RL training would propagate that single binary reward signal back across all 500+ operations equally, which is almost useless. This is the temporal credit assignment problem: attributing a sparse, delayed outcome to the specific earlier actions that caused it.
Prior trainable memory agents like Memory-R1 and Mem-alpha use GRPO (a variant of PPO that avoids needing a separate value network) but apply the terminal reward indiscriminately across all memory operations. Existing approaches fail to bridge this gap, as they indiscriminately propagate the sparse terminal reward across all memory operations without dense supervision or process-level attribution. Mem-T's core innovation is turning that sparse signal into dense, step-wise feedback.

Four layers of memory, two phases of operation
Before getting to the training algorithm, it helps to understand what Mem-T is actually managing. The system maintains a hierarchical memory database with four components:
- Working memory , a rolling session summary, updated at every turn
- Factual memory , discrete, time-stamped declarative facts ("User started a new job on March 3rd")
- Experiential memory , procedural lessons and strategies ("When user asks about X, approach Y works best")
- Raw memory , archived verbatim conversation turns for fallback retrieval
The agent operates in two phases. During memory construction, as new conversation turns stream in, the agent decides whether to create a new fact, create a new experience, update an existing entry, delete a stale one, or ignore the input. During memory retrieval, when a query arrives, the agent iteratively searches across memory types , issuing multiple Search(type, key, topk) calls , before calling Finish with an answer. Both phases are trained jointly.
How MoT-GRPO works
The training algorithm has two tracks that mirror the two operational phases.
For retrieval training, MoT-GRPO builds a Memory Operation Tree (MoT). Instead of sampling a single rollout per query, the system generates G independent trees (G=3 in practice). Each tree starts with a full rollout from the initial state, then iteratively branches by picking non-terminal nodes and generating new sub-trajectories from those points. This produces a rich tree of diverse retrieval paths for the same query. Each node in the tree gets a dense reward that combines three signals:
- Format reward , did the tool call parse correctly?
- Evidence reward , what fraction of ground-truth evidence has been retrieved so far?
- Performance reward , for leaf nodes, the F1 score of the final answer; for internal nodes, the average performance of all child nodes
Advantage estimation happens at two scales simultaneously: within each tree (intra-tree), to identify which search paths were locally better, and across all trees (inter-tree), to identify globally strong strategies. The final advantage for each node is the sum of both. Through this dual-scale design, the intra-tree advantage supports reliable local comparisons sharing similar contexts and effective credit assignment to identify nodes that critically influence the final outcome. Meanwhile, inter-tree advantages encourage cross-tree competition, guiding the optimization toward globally high-quality solutions.
For construction training, the problem is harder because memory construction happens hundreds of turns before any query. MoT-GRPO uses hindsight credit assignment: after the retrieval trees are built, the system looks backward and asks which memory construction actions contributed to the successful retrieval paths. A construction action gets credit if (a) it processed source turns that contained ground-truth evidence for the query, or (b) the memory entry it created actually appeared in a successful retrieval path. The top 50% of construction actions by this hindsight score become supervised fine-tuning data.
Benchmarks and results
Mem-T was evaluated on four long-context benchmarks: LoCoMo (long-term conversational QA, ~600 turns, ~16K tokens per conversation), HotpotQA (multi-hop reasoning embedded in 56K-token haystacks), LongMemEval (115K-token chat histories), and NarrativeQA (book and movie script comprehension). The model was trained only on LoCoMo; the other three are out-of-domain generalization tests.

On the in-domain LoCoMo benchmark against 13 baselines:
- Mem-T with MoT-GRPO (Qwen3-4B) achieves 58.65 overall F1, a 14.92-point gain over the best training-free baseline
- Even without any training, the hierarchical architecture alone scores 49.38 F1, beating all trained baselines including Memory-R1 and MemAgent
- Adding standard GRPO (without the tree structure) gets to 53.56 F1; MoT-GRPO pushes it to 58.65, showing the tree structure itself contributes ~5 F1 points
- The Qwen3-8B variant scores 58.53 F1, confirming the approach generalizes across model sizes
On out-of-domain benchmarks, Mem-T scores 66.35 F1 on HotpotQA, 65.80% accuracy on LongMemEval, and 30.29 F1 on NarrativeQA , an average improvement of 13.52% over the next best method. Mem-T learns effective memory management strategies through training on LoCoMo and achieves state-of-the-art performance across all three out-of-domain benchmarks.
The efficiency story is equally compelling. Compared to GAM, Mem-T not only achieves a 5.17 to 28.48 improvement in F1 Score but also reduces the inference overhead by 19.94% to 24.45% per query. This places Mem-T on the Pareto frontier , better accuracy and lower cost simultaneously.
What the ablations reveal
The ablation study is worth reading carefully because it shows which design choices actually matter:
- Removing retrieval optimization (using the base model for retrieval) costs 5.28 F1 , the biggest single drop
- Removing construction optimization costs 3.29 F1
- Removing inter-tree advantage estimation costs 4.56 F1; removing intra-tree costs only 1.70 F1 , cross-tree competition is more important than within-tree comparison
- Factual memory is the most critical memory module; removing it drops overall F1 by 3.40
The sensitivity analysis also reveals a practical sweet spot: 6 retrieval steps and G=3 trees. Beyond those values, performance plateaus while token costs grow linearly , going from 6 to 10 steps improves F1 by less than 0.5% but nearly triples token consumption.
What this enables
The practical implications are significant for anyone building agents that need to maintain context across long interactions. The correct framing isn't "memory as storage" but "memory as a cognitive substrate." The systems that will win long-term are the ones that maintain the distinction between facts and beliefs, track how knowledge changes over time, can explain their reasoning, and stay cheap enough to actually run in production. Mem-T moves meaningfully in that direction.
Concrete use cases where this matters most:
- Long-running personal assistants that need to track user preferences, commitments, and life events across months of conversation
- Customer support agents that must remember prior interactions, product states, and resolution history without stuffing entire transcripts into context
- Research or coding assistants that accumulate procedural knowledge about a user's codebase or workflow over time
- Multi-session tutoring systems where understanding what a student already knows is as important as the new material
The current limitations are worth noting. The model is trained and evaluated on conversational QA tasks, so its memory construction heuristics are optimized for dialogue. Performance on tasks with very different information structures (structured data, code repositories, documents) would need separate evaluation. The training pipeline also requires generating large retrieval trees, which is computationally expensive at training time even if inference is efficient.
Availability
The code is available on GitHub and the trained Qwen3-4B model is released on Hugging Face as EdwinYue/Mem-T-4B. The paper is open access on arXiv. The training uses standard infrastructure: Ray + vLLM for retrieval training, LLaMA-Factory + DeepSpeed ZeRO-3 for construction training, both on 8 GPUs.