The recording
You were last reading slide 1.
Learning to manage memory
Information retrieval for AI
9 November 2026
Seong Joon Oh - KAIST AI
Upcoming sessions
11 November - project workshop
No preparation needed. Workshop task and instructions will follow.
18 November - RAW-RAG discussion
Preparation is due 17 November, 18:00 KST.
Last lecture and today
Recall: what should agentic memory do?
- Representation and organisation - represent past experiences, avoid duplicates, resolve conflicts.
- Memory maintenance - when to write, how to handle stale information, how to recover from failed operations.
- Human control - can people understand and edit what the agent remembers?
- Need for memory - would unlimited context remove the need for memory?
Last lecture - desiderata 1 and 2 through prescribed procedures.
Today
- Learning memory decisions: from Memory-R1 to MemRL - desiderata 1 and 2, learned from reward
- Human control - the open problem - desideratum 3
Need for memory is left for the RAW-RAG discussion on 18 November.
Section 1
Learning memory decisions
The same questions place every learned memory method
Each method trains one decision on this path. The designer fixes the rest: storage format, retrieval, and the available actions.
- Which component is trained?
- When does it decide: at write time, at read time, or both?
- What does the reward measure, and how late does it arrive?
- What must the method show to transfer?
We ask them of Memory-R1, AgeMem, UMA, JitMem, and MemRL in turn.
No gradient reaches a memory decision from the reward
Every method in this section shares this shape:
The gradient path breaks at each step after
- the action
is sampled text or a tool call; - edits to a store are program operations on text entries;
- retrieval selects a discrete top-
; - the answer is sampled, and its score is often a step function such as exact match.
RL uses the log-probability of the sampled action instead:
Standard policy-gradient identity.
PPO and GRPO turn an outcome into an update
PPO clips the ratio of new to old policy probabilities. A learned critic estimates the advantage
GRPO samples
GRPO keeps PPO’s clip; only the advantage changes. Memory-R1’s equation 3 writes the unclipped term.
Each method in this section uses GRPO or a variant of it. The variants differ in what forms a group and which steps receive the advantage.
Memory-R1 (ACL 2026), section 3.1, equations 2-3; GRPO with the clip as in Shao et al. (2024) and UMA equation 9.

Memory-R1 learns memory operations from the answer reward alone
For each new fact, a manager sees related stored entries and chooses ADD, UPDATE, DELETE, or NOOP, with the content to write.
No label says which operation is correct. The only signal is whether a frozen answer agent later answers correctly.
Memory-R1 (ACL 2026), sections 3.1-3.2, Figure 2.
Memory-R1: one exact-match answer trains the manager
Pipeline. Trainable: the manager
- Data: a LoCoMo training tuple of dialogue turns
, a question , and its gold answer . - For each turn
: extract facts ; retrieve the related entries from the bank ; sample an operation with ADD, UPDATE, DELETE, NOOP and its content; apply it to . - Retrieve the top-
entries of for . The frozen Answer Agent returns .
Reward.
Algorithm. PPO or GRPO, as above, with one update per tuple. The Answer Agent is trained afterwards in the same way on the question and 60 retrieved memories.
Memory-R1 (ACL 2026), sections 3.1-3.2, Algorithm 5, Appendix B.2.
Quiz: which way do the probabilities move after one update?
One GRPO round on the dog example. UPDATE and ADD earned
After one clipped GRPO update, how do the four probabilities move?
Sign in with your course account to choose. The lecturer will reveal responses and the answer.
Constructed round with illustrative probabilities; the policy picks one of four operations with fixed text. Input from Memory-R1 (ACL 2026), Figure 1.
Memory-R1 improves on prescribed memory managers
LoCoMo, LLaMA-3.1-8B-Instruct, overall LLM-judge score:
| Method | Judge score |
|---|---|
| Mem0 | 45.68 |
| MemoryOS, the strongest baseline | 48.20 |
| Memory-SFT, imitating GPT-5 | 58.76 |
| Memory-R1-PPO | 57.54 |
| Memory-R1-GRPO | 62.74 |
Training uses 152 LoCoMo questions; the table tests on 1,307 questions from the same LoCoMo dataset, split 1:1:8. Training and test share one dataset and question types, so the gap between them is small. MSC and LongMemEval test transfer without further training.
Memory-R1 (ACL 2026), Table 1 and section 4.1.
But Memory-R1 learns only the bank operation
Retrieval stays a fixed similarity top-
The manager and the answer agent are separate policies, trained one after the other.
Every operation in a run shares one answer reward, so the reward cannot say which operation earned it.
Memory-R1 (ACL 2026), sections 3.1-3.2, Algorithm 5.

AgeMem trains one agent over long-term memory, retrieval, and context
AgeMem names this gap: earlier RL methods optimise one aspect of memory at a time and treat retrieval or context handling as fixed. Its answer is one policy that reasons and calls memory tools:
ADD,UPDATE,DELETEon long-term memory, at write time;RETRIEVE,SUMMARY,FILTERon the context, at read time.
Retrieval is an action the policy chooses, not a fixed step.
AgeMem (ACL 2026), sections 3.1-3.2, Table 1; Qwen2.5-7B and Qwen3-4B Instruct.
AgeMem’s training episode makes the agent rely on what it saved
Same as Memory-R1: ADD, UPDATE, and DELETE on a memory bank, trained by GRPO from an answer reward.
Different from Memory-R1:
| Memory-R1 | AgeMem | |
|---|---|---|
| Who edits the bank | A separate manager | The same agent that answers |
| Retrieval | Fixed top- | RETRIEVE, an action the agent chooses |
| Context | Not managed | FILTER and SUMMARY, chosen by the agent |
| Training episode | Dialogue turns, then the question | Store, then distract after a context wipe, then answer |
The context wipe and distractors force the answer to come from what the agent saved and retrieved. One reward at the end is copied back to every step, including the saves in the first stage.
AgeMem (ACL 2026), sections 3.1-3.5, Appendices A.2 and C.4; Memory-R1 (ACL 2026), sections 3.1-3.2. AgeMem trained with GRPO on HotpotQA.
AgeMem also rewards good memory habits, because the answer score alone is late and coarse
An answer score says whether the episode went well, not which habit helped. AgeMem adds checks on the context and on long-term memory.
, an LLM judge’s score in ; if there is no answer. : tokens in context at answer time, . if a context tool was called before overflow, else 0. if the key entities of are still in context at answer time, else 0.
: of stored entries, are rated useful for by an LLM. if any UPDATE or DELETE was performed, else 0. , an LLM’s relevance score in for the retrieved entries .
if the episode exceeds the round limit, if .
The extra checks encode the designers’ view of good memory, and several are scored by an LLM.
AgeMem (ACL 2026), section 3.5, Appendix A.2 (equations 16-26) and C.4.
AgeMem’s extra rewards raise the score, but each episode serves one task and the metric overlaps the reward
Reward ablation, HotpotQA, Qwen2.5-7B-Instruct:
| Reward | Judge score | Memory quality | Tokens | Tool calls |
|---|---|---|---|---|
| Task only | 0.509 | 0.479 | 2,078 | 3.93 |
| Task, context, and memory | 0.544 | 0.533 | 2,117 | 4.92 |
- Each episode stores facts for a single task, so storage is tuned to that query.
- Memory quality is scored by an LLM, and the memory reward also uses LLM-based scores, so the reward and the metric partly overlap.
- AgeMem describes Memory-R1 as optimising one aspect of memory at a time. Its baselines are LangMem, A-Mem, Mem0, and Mem0g; Memory-R1 is not run.
Trained on HotpotQA only; ALFWorld, SciWorld, PDDL, and BabyAI test transfer.
AgeMem (ACL 2026), Table 4 and section 4.1.

UMA scores one store with several questions, not one
In all three methods the question is hidden while memory is written: the writer sees only the incoming text, and the question arrives later. The difference is how many questions judge each store.
| Memory-R1 | AgeMem | UMA | |
|---|---|---|---|
| Question hidden while writing | Yes | Yes | Yes |
| One policy writes and answers | No | Yes | Yes |
| Questions that score one store | 1 | 1 | Several |
| Separate advantage groups for writing and answering | No | No | Yes |
Why it matters. With one question per store, a stored fact earns reward only if that one question needs it. With several, the store is rewarded for holding what many later questions need, which is closer to a memory reused after deployment.
The policy writes chunk by chunk into a key-value bank plus a core summary. Training still uses question-answer pairs, but only to score the finished store.
UMA (EMNLP 2026), sections 1, 2.1-2.3 and Appendix G, Table 8.
UMA: several later questions score each store
- Build. One policy reads the context chunk by chunk and edits a key-value bank. The question is hidden. Repeat 16 times for 16 different stores.
- Answer. The same policy answers every training question from each store.
- Score. Each answer is scored against the gold answer. A store’s building sessions all receive the mean score over its questions.
- Update. GRPO compares building sessions across the 16 stores, and answering sessions per question across the 16 stores.
UMA (EMNLP 2026), sections 2.1-2.3 (equations 3-9), Figure 3, Appendix I. Qwen3-4B-Instruct; KL coefficient 0.001.
JitMem moves curation to read time, so the reward is immediate
Prior work, as JitMem describes it
- Most memory systems curate at write time: what is stored is fixed before any future task is seen.
- Learned write-time memory, including Memory-R1 and AgeMem, is graded only when a later task uses what was written.
- SkillOS trains a write-time curator with GRPO, but must group related tasks to create that delayed signal.
JitMem’s change
- Store raw trajectories unchanged. A trajectory enters when an LLM judge deems its task solved.
- When a task arrives, BM25 retrieves trajectories and a trained curator writes a briefing for that task.
- The frozen executor uses the briefing, so the same task rewards the curator at once.
JitMem (arXiv 2026), sections 1-3; curator initialised from Qwen3-8B. UMA is not cited; its question groups play the same role as SkillOS’s task groups, in our reading.
JitMem: the same task rewards each briefing at once
Pipeline. Trainable: the curator
- Data: a training task
and a fixed bank of successful raw trajectories from the base executor. - Retrieve
, the top trajectories by BM25 over task descriptions. - Curate a briefing
. - Execute:
attempts with in its prompt and receives reward .
Reward.
Algorithm. GRPO without a value network. Sample
100 steps, batch 32, learning rate
JitMem (arXiv 2026), sections 3 and 4, Appendix A.
JitMem: keep every trajectory, retrieve simply, and put the learning into curation
ALFWorld success rate with a Qwen3-8B executor:
- Learning better write-time operations is not needed here. Raw trajectories, plain BM25, and a trained curator reach 77.4; SkillOS, which learns what to write, reaches 61.2. Distilling trajectories at write time instead of keeping them raw costs the untrained curator 1.7-2.9 points, and 6.8-8.2 on WebShop. Retrieving 5 trajectories instead of 3 adds nothing (WebShop 32.8 both).
- The curation design and its RL training both matter. No memory 47.9; untrained curator 60.5; trained curator 77.4.
In our reading, these tasks never change or delete a stored fact, and the bank only grows. Would a raw store still suffice when facts change?
JitMem (arXiv 2026), Tables 1, 8, 9; section 4.2.

MemRL keeps learning after deployment, with the LLM frozen
Why look further. Can an agent keep raising its task success after deployment, from feedback, without changing weights? MemRL’s answer: learn which memories to retrieve.
| The four methods above | MemRL | |
|---|---|---|
| What learns | LLM weights | A utility |
| When | Offline, then fixed | After every task, in use |
| Ranks memories by | Similarity | Similarity plus learned utility |
| Reward changes | Weights, by PPO or GRPO |
Why MemRL does it this way. MemRL argues that fine-tuning is costly and risks catastrophic forgetting, while similarity-only retrieval cannot tell a useful memory from a merely similar one. A per-memory utility uses deployment feedback without touching the weights.
What it gives up. The LLM never learns to use memories better, and every memory used for a task receives the same reward.
Update:
MemRL (arXiv 2026), sections 1, 3.2 and 4.1-4.3; ranking
MemRL’s training loop is deployment itself
Each task runs retrieval, acting, and an update to the utilities of the memories used. Nothing waits for an offline training phase.
- Recall by intent similarity, then select by similarity and utility; on HLE,
recalled and selected worked best. - The reward comes from the environment for that task, so each update arrives at once.
- New experience enters the bank as a summarised entry with an initial utility.
MemRL (arXiv 2026), sections 3.2, 4.1-4.3 and 5.3.4.
Each method trains a different part of the same pipeline
- Memory-R1 trains only the write step.
- AgeMem and UMA train one model across write, read, and use.
- JitMem keeps every trajectory and trains only the read step.
- MemRL learns the read step too, but as stored utilities, with no weight update.
The later the reward arrives after the trained step, the harder it is to credit.
Memory-R1 (ACL 2026); AgeMem (ACL 2026); UMA (EMNLP 2026); JitMem (arXiv 2026); MemRL (arXiv 2026).
Are dedicated training and structure for memory management needed?
Every method in this section trains something for memory (a manager, an agent, a curator, or utilities) and most also impose a structure on what is stored.
- Do we need a designed knowledge vault at all? RAW-RAG (Bao et al., 22 October 2026) reports that retrieval over raw history is stronger than expected against designed memory systems, on offline conversation tasks.
- Do strong models already manage memory well enough without dedicated training or structure? In Anthropic’s own tests (6 November 2026), Opus 5.5 with a plain memory folder rose from 0.655 to 0.838 on CL-Bench, and prescribed memory rules reduced the gains of stronger models.
- If so, where would memory training and structure still pay off? Smaller models, changing facts, deletion, or human control?
We take these up in the RAW-RAG discussion on 18 November. Preparation is due 17 November, 18:00 KST.
RAW-RAG (arXiv 2026); The components of agent memory, Figures 3 and 5.
Section 2
Human control
Inspection, understanding, and correction - an open problem.
Memory will have errors, so people must be able to read and fix it
Lecturer’s view
- Memory can never be perfect. Every method above still fails on part of its tasks.
- But a memory mistake can be traced. A wrong answer leads back to a readable record, not to billions of parameters.
- So the memory should be laid out for people, with an interface that makes reading and editing easy.
- Where the model fails, a person fixes the rest, especially when the application matters.
Task scores do not show whether a person can find, understand, and correct what the agent stored
The work we have examined gives task performance more attention than human inspection and correction.
| Reported evidence | Human-control question |
|---|---|
| Correct answer from conversation history | Can a person find the stored assumption? |
| Successful agent task | Can they understand why the memory guided it? |
| Effective update procedure | Can they identify and correct a mistaken record? |
Compare Mem0 (ECAI 2025), §3; A-MEM (NeurIPS 2025), §4; ReasoningBank (ICLR 2026), §4. These task measurements do not directly answer the human-control questions.
Karpathy’s LLM Wiki puts agent memory in the format people already use to edit knowledge
A wiki of linked pages is a familiar interface for reading and editing shared knowledge. In Karpathy’s LLM Wiki, the agent maintains readable Markdown pages, and the person supplies sources and directs revisions.
- Raw sources: preserved source documents.
- Wiki pages: derived summaries, entities, concepts, and synthesis.
- Schema: organisation, conventions, and workflows, revised by the person and agent together.
- Index, links, graph view, and log: browse the knowledge and examine changes.
Karpathy’s LLM Wiki (GitHub gist), The core idea, Architecture, Indexing and logging. A workflow account, not a controlled comparison.
A wrong memory in a wiki can be traced to its cause
Constructed example. A project wiki says final evaluation uses corpus v1. A meeting on 3 Oct switched it to v2.
The person follows the index to the page, the page to its source, and the log to the missed update. Each step is a readable record.
With weights, the same wrong belief has no page, no source, and no log to follow.
A wiki fix is easy to make, but not guaranteed to spread or last
Same constructed example. The person corrects one sentence and keeps the v1 pilot history.
The fix is visible and dated. It does not reach the paper draft, and a later agent update writes v1 back.
Karpathy’s account proposes a workflow. It does not measure human repair success, effort, or how long corrections survive.
Karpathy’s LLM Wiki (GitHub gist). A workflow account, not a controlled comparison.
A knowledge vault that people can inspect and edit is the open problem
Task scores measure what the agent does with its memory. They do not measure what a person can do with it.
A usable vault lets a person:
- find what the agent holds about a topic;
- see the source and date behind each claim;
- correct a claim once and have derived pages follow;
- keep that correction through later agent updates.
- do all of this within a few minutes and one screen at a time.
Karpathy’s wiki makes the knowledge readable, but reports no measure of human inspection or editing.
Measure the time a person needs to find and fix an error, how many pages the fix must touch, and whether it persists.
People check memory through a narrow window, so the vault must fit it
Lecturer’s view
A person sees one screen at a time and has minutes, not hours. Agent memory grows without that limit. Three things follow.
- Hierarchy. A short top level, with detail one click down, so a person reads only the branch that matters.
- An intuitive search engine. Questions in the person’s own words, answered with the exact claim, its source, and its date.
- One claim, one place. Duplicates merged, with other pages linking to the single copy. Then a fix made once reaches every page, unlike the paper draft in the wiki example.
Some of this already exists in agent memory, aimed at the model: MemoryOS keeps short, mid, and long-term levels, and Mem0 checks related records before adding one. The open question is whether the same structure serves the person.
Memory should serve the person who works with the agent
Use the accumulated knowledge.
Understand what the agent remembers.
Correct what seems wrong.
Next lectures
From next time, the lectures become more philosophical and fundamental, and stay practical. They examine the nature of learning and its connection to search. Sutton’s Bitter Lesson connects search, learning and intelligence through scaling with computation.
- Retrieval from the context - attention and the KV cache
- Retrieval from the parameters - what the weights hold
- An explicit index of the training data
- Architectural lookup - mixture of experts, memory layers and Engram
- Memory updated during inference
The syllabus holds the current dates.