All-in-One Memory: Process-Rewarded Reinforcement Learning for Memory Agents
Organizations: Harbin Institute of Technology, Shenzhen · The Hong Kong Polytechnic University · Fudan University · Peng Cheng Laboratory
Abstract
Large language models increasingly rely on external memory to answer queries grounded in long-horizon histories such as multi-session dialogues and lengthy documents. However, existing memory methods often optimize retrieval and memory construction separately, without a shared reward space for evaluating search, writing, and stopping decisions. To address this, we propose All-in-One Memory (AiO-Mem), which organizes these operations as transitions over a shared evidence state and directly evaluates the semantic quality of each action in a unified reward space. AiO-Mem compiles heterogeneous histories into source-traceable multi-view events, providing a shared substrate for retrieval and memory writing. A unified memory policy actor then rolls out complete interaction trajectories over this shared evidence state. A separate trajectory-conditioned process reward model is trained through evidence-grounded supervised fine-tuning and trajectory-level DPO to assign process scores to the collected trajectories. These scores are aggregated into an action-balanced trajectory reward and used by Process-Aligned DAPO (PA-DAPO) to optimize the memory policy. Across long-context memory benchmarks, AiO-Mem consistently improves answer accuracy over both static memory systems and RL-trained memory agents.
Figures & tables
| Method | Multi-hop | Temporal | Open-domain | Single-hop | Overall | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| F1 | B1 | F1 | B1 | F1 | B1 | F1 | B1 | F1 | B1 | |
| Reference | ||||||||||
| Long-Context | 23.2 | 16.8 | 19.0 | 13.4 | 13.9 | 10.7 | 40.7 | 31.5 | 31.5 | 23.9 |
| RAG | 23.5 | 17.1 | 43.1 | 37.4 | 20.2 | 14.9 | 49.5 | 44.9 | 41.6 | 36.5 |
| Agent Memory Harness | ||||||||||
| MemGPT | 16.7 | 14.0 | 12.6 | 10.9 | 11.6 | 9.2 | 14.0 | 11.8 | 14.1 | 11.8 |
| Method | Multi-hop | Temporal | Open-domain | Single-hop | Overall | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| F1 | B1 | F1 | B1 | F1 | B1 | F1 | B1 | F1 | B1 | |
| Base Model | 39.3 | 30.9 | 65.0 | 58.4 | 25.9 | 21.9 | 61.3 | 56.1 | 55.8 (-5.2) | 49.8 (-5.2) |
| Memory Representation and Interaction Ablations | ||||||||||
| w/o Event Comp. | 43.2 | 34.6 | 66.9 | 61.0 | 27.2 | 22.6 | 64.3 | 58.7 | 58.6 (-2.4) | 52.5 (-2.5) |
| w/o Multi-view Ret. | 41.3 | 33.4 | 65.8 | 60.4 | 29.5 | 24.4 | 64.2 | 58.6 | 58.1 (-2.9) | 52.1 (-2.9) |
| w/o WM Constr. | 33.2 | 26.4 | 57.0 | 50.9 | 24.3 | 20.0 | 57.6 | 52.3 | 50.9 (-10.1) | 45.2 (-9.8) |
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
| top- | Max Step | Multi-hop | Temporal | Open-domain | Single-hop | Overall | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| F1 | B1 | F1 | B1 | F1 | B1 | F1 | B1 | F1 | B1 | ||
| 44.6 | 35.7 | 66.2 | 59.6 | 30.3 | 25.6 | 62.7 | 57.3 | 58.0 | 51.8 | ||
| 43.5 | 35.4 | 62.4 | 53.3 | 34.9 | 30.9 | 65.9 | 61.5 | 59.2 | 53.2 | ||
| 44.0 | 36.6 | 63.9 | 55.7 | 34.4 | 30.3 | 65.4 | 60.9 | 59.2 | 53.5 | ||
| 43.0 | 35.1 | 61.9 | 53.1 | 33.5 | 29.3 | 65.8 | 61.1 | 58.8 | 52.8 | ||
| 43.6 | 35.6 | 63.4 | 54.6 | 33.7 | 30.2 | 65.9 | 60.9 | 59.3 | 53.3 | ||
| System | (I) Segment & Retrieval | (II) Construction | (III) Inference |
|---|---|---|---|
| OMS | |||
| AiO-Mem |
| Symbol | Definition |
|---|---|
| Long-horizon history consisting of heterogeneous source units. | |
| Number of source units in . | |
| Average number of tokens in each source unit . | |
| Traceable event bank constructed from by the structure-aware compiler . | |
| Number of traceable events in the event bank . | |
| Number of persistent memory entries produced per source unit by OMS. |
| Stage | Tool call and function |
|---|---|
| DECIDE | search_memory_units(query) : Retrieves event-level memory units concerning information missing from the current notes. |
| DECIDE | answer_from_notes() (no arguments): Ends memory retrieval and proceeds to the answering stage using the existing working memory. |
| EXTRACT | add_note(event_id, datetime, content, evidence_turns) : Saves a clue, its event time, and the original dialogue supporting it. An EXTRACT step may invoke add_note multiple times, with each invocation writing one note. |
| EXTRACT | skip_extraction(reason) : Skips extraction when the current search results contain no relevant evidence to write. |
| Stage | Prompt template |
|---|---|
| DECIDE | You are a memory assistant. Given the current question and saved working memory, choose the next action: search memory, or stop retrieval and proceed to the answering stage. Rules: (1) Judge whether the question can be answered completely using only the working memory, including the relationships and all necessary parts requested by the question. If the evidence is sufficient, call answer_from_notes . (2) Otherwise, generate a query targeting one specific fact or clue that is still missing, and call search_memory_units . The query should identify the relevant person or object, relationship, and information needed. Avoid repeating previous searches that produced no useful notes. (3) At the final decision step, call answer_from_notes . Input: Question {question}, working memory {working_notes}, previous queries {previous_searches}, and step {step}/{max_steps}. Output: A brief explanation of the decision and one <tool_call> . |
| EXTRACT | You are a memory system analyst. Given the question, the latest search results, and the existing working memory, identify new evidence useful for answering the question and write it into the working memory. Search results are temporary; useful information not written into the notes will not be available to subsequent decisions. Rules: (1) Read the visible original dialogue in retrieved events. Highlighted turns are only hints; relevant evidence may also appear in other turns. (2) For each new useful clue, call add_note to write a concise, faithful note, preserving the exact event ID, recorded time, and original dialogue supporting its content. Each note should capture one natural clue and should be compared with existing notes to avoid duplication. (3) If the search results contain no relevant evidence, call skip_extraction . Input: Question {question}, search observation {search_observation}, and working memory {working_notes}. The search observation contains event identifiers, recorded times, retrieved fields, summaries, and visible original dialogue. Output: A brief assessment of the evidence and the required <tool_call> ; distinct clues may be written as separate notes. |
| Prompt template |
| Task and input You are a reward model evaluator of memory trajectories. Given a complete scoreable memory trajectory, evaluate each step according to whether the required evidence was found, whether useful evidence was written into working memory, and whether retrieval stopped when the evidence was sufficient. You may use trajectory context to understand the current action, but each score must evaluate only the current step; do not evaluate the quality of the final answer model’s response. Input: {question}, {reference_answer}, {gold_evidence}, {trajectory_information}, and {scoreable_steps}. Objectives by action type decide_search : Does the query target information missing from the current notes and help locate evidence needed to answer the question? A reasonable query should not receive the lowest score solely because it failed to retrieve a match. extract_add_note : Does the action faithfully write useful, previously unsaved evidence from the latest search into the notes, and do the cited turns support the note’s content? extract_skip : Does the latest search truly contain nothing worth writing? Skipping clearly critical evidence is a severe problem. decide_answer_from_notes : Are the existing notes sufficient to support an answer when retrieval stops? Evidence assessment When judging whether the notes are sufficient, consider both their content and the original dialogue they cite. Annotated evidence indicates information needed for the question, but it is not a mechanical hit-rate scoring formula: unannotated dialogue turns may also support the answer semantically, and matching annotated turns does not automatically warrant a high score. Error severity Category A, high severity: Failure of the current stage’s core objective. Category B, high severity: Factual or attribution errors in a note, or citations that do not support key content. Category C, medium severity: Problems in assessing the current state or respecting stage boundaries. Category D, medium severity: An incomplete contribution or substantial noise in the action. Category E, low severity: Wording or formatting issues. Score ranges 90–100: The action fulfills the stage’s core objective very well, with at most minor Category E issues. 75–89: The action is clearly useful and largely fulfills the core objective; it has no Category A or B issues, though minor Category C, D, or E issues are allowed. 60–74: The action makes a partial contribution but falls short of the core objective; it has no Category A or B issues, though Category C or D issues are more pronounced. 40–59: The action has a severe problem but retains some useful contribution; it typically contains one Category A or B issue. 1–39: The action provides almost no useful contribution or takes a clearly wrong direction; severe problems cause the current step to largely fail. Output requirements Output a strict JSON object containing step_scores in input order. Each step must contain step_index , step_type , quality_level , and an integer score from 1 to 100. Do not omit or add steps, and do not output scoring explanations. quality_level roughly corresponds to the score as follows: bad (1–30), weak (31–55), partial (56–70), good (71–85), and excellent (86–100). |
Persistent Memory for Language Models
Persistent memory for language models studies how models retain, update, and use information across interactions and beyond their context windows.
See all 267 papers