Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
437 lines (412 loc) · 33.1 KB
/
Copy pathindex.html
File metadata and controls
437 lines (412 loc) · 33.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AutoMem: Automated Learning of Memory as a Cognitive Skill</title>
<meta name="description" content="AutoMem treats memory management as a trainable skill for LLM agents, automating both the memory scaffold and the model's memory proficiency across Crafter, MiniHack, and NetHack.">
<style>
:root{
--teal:#2D7D86; --teal-d:#1f5b62; --accent:#C94420; --accent-l:#E69F8A;
--ink:#23262b; --muted:#4f545a; --line:#e6e3dd; --bg:#ffffff; --soft:#f6f5f2;
--gemini:#4285F4; --opus:#B07D4F;
--mono:'SFMono-Regular',ui-monospace,'Menlo','Consolas','DejaVu Sans Mono',monospace;
--sans:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--sans);
line-height:1.62;font-size:17px;-webkit-font-smoothing:antialiased}
a{color:var(--teal-d);text-decoration:none}
a:hover{text-decoration:underline}
.wrap{max-width:1060px;margin:0 auto;padding:0 22px}
.narrow{max-width:960px;margin-left:auto;margin-right:auto}
h1,h2,h3{line-height:1.25;color:var(--ink)}
h2{font-size:1.55rem;margin:2.6em 0 .5em;letter-spacing:-.01em}
h2 .hash{color:var(--teal);font-weight:700;margin-right:.35em}
h3{font-size:1.15rem;margin:1.6em 0 .3em}
p{margin:.7em 0}
.small{font-size:.92rem;color:var(--muted)}
code,.mono{font-family:var(--mono)}
header.hero{background:linear-gradient(180deg,#fbfaf8 0%,#ffffff 100%);
border-bottom:1px solid var(--line);padding:54px 0 34px;text-align:center}
.eyebrow{font-family:var(--mono);font-size:.82rem;letter-spacing:.18em;text-transform:uppercase;
color:var(--accent);font-weight:600;margin-bottom:14px}
h1.title{font-size:2.5rem;font-weight:800;letter-spacing:-.02em;margin:.1em 0 .15em}
h1.title .am{color:var(--teal)}
.subtitle{font-size:1.12rem;color:var(--muted);max-width:720px;margin:.4em auto 1.1em}
.authors{font-size:1.18rem;margin:.9em auto .2em;max-width:820px}
.authors a{color:var(--muted);font-weight:600}
.affil{color:var(--ink);font-size:1.18rem;font-weight:700}
.btns{display:flex;gap:11px;justify-content:center;flex-wrap:wrap;margin-top:22px}
.btn{display:inline-flex;align-items:center;gap:8px;background:var(--ink);color:#fff;
padding:9px 18px;border-radius:30px;font-size:.95rem;font-weight:600;transition:.15s}
.btn:hover{background:var(--teal-d);text-decoration:none;transform:translateY(-1px)}
.btn svg{width:16px;height:16px;fill:currentColor}
.btn.ghost{background:#fff;color:var(--ink);border:1.5px solid var(--line)}
.btn.ghost:hover{border-color:var(--teal);color:var(--teal-d);background:#fff}
figure{margin:1.6em 0;text-align:center}
figure img{max-width:100%;height:auto;border-radius:8px}
figure.bordered img{border:1px solid var(--line);box-shadow:0 2px 18px rgba(0,0,0,.05)}
figcaption{font-size:.9rem;color:var(--muted);margin-top:.8em;text-align:left;
max-width:880px;margin-left:auto;margin-right:auto}
figcaption b{color:var(--ink)}
.teaserwrap{margin-top:26px}
.abstract{background:var(--soft);border:1px solid var(--line);border-radius:12px;
padding:22px 26px;margin:1.4em 0}
.abstract h3{margin-top:0;color:var(--teal-d);font-size:1.05rem;
text-transform:uppercase;letter-spacing:.08em;font-size:.85rem}
.tablewrap{overflow-x:auto;margin:1.2em 0}
table.main{border-collapse:collapse;width:100%;font-size:.95rem}
table.main th,table.main td{padding:7px 12px;text-align:center}
table.main th:first-child,table.main td:first-child{text-align:left}
table.main thead th{border-bottom:2px solid var(--ink);font-size:.85rem;color:var(--muted);font-weight:600}
table.main tbody tr td{border-bottom:1px solid var(--line)}
table.main .grouprow td{padding-top:14px;font-style:italic;color:var(--muted);
font-size:.85rem;border:none;font-weight:600}
table.main tr.ours td{background:#f0f7f7}
table.main tr.ours.best td{background:#e7f1f1;font-weight:700}
table.main .num{font-family:var(--mono);font-size:.9rem}
.se{color:var(--muted);font-size:.82em}
.envtabs{display:flex;gap:8px;flex-wrap:wrap;margin:1.2em 0 .4em;justify-content:center}
.envtab{padding:8px 20px;border-radius:30px;border:1.5px solid var(--line);background:#fff;
cursor:pointer;font-weight:600;font-size:.95rem;color:var(--muted);transition:.15s}
.envtab.active{background:var(--teal);color:#fff;border-color:var(--teal)}
.demo-card{border:1px solid var(--line);border-radius:14px;padding:18px 18px 14px;margin:18px 0;
background:#fff;box-shadow:0 2px 16px rgba(0,0,0,.04)}
.demo-head{display:flex;justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:8px;margin-bottom:4px}
.demo-title{font-weight:700;font-size:1.06rem}
.demo-sub{font-size:.86rem;color:var(--muted)}
.panels{display:grid;gap:14px;margin-top:12px}
.panels.p3{grid-template-columns:repeat(3,1fr)}
.panels.p2{grid-template-columns:repeat(2,1fr)}
@media(max-width:760px){.panels.p3,.panels.p2{grid-template-columns:1fr}}
.panel{border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#fcfbf9;display:flex;flex-direction:column}
.panel-head{padding:7px 11px;font-size:.84rem;font-weight:700;display:flex;justify-content:space-between;
align-items:center;border-bottom:1px solid var(--line)}
.panel-head .cond{color:var(--ink)}
.panel-head.c0 .cond{color:var(--muted)}
.panel-head.c5 .cond{color:var(--teal-d)}
.panel-head.ct .cond{color:var(--accent)}
.panel-head .score{font-family:var(--mono);font-size:.82rem}
.viewport{position:relative;background:#0d0f12;display:flex;align-items:center;justify-content:center;
min-height:188px}
.viewport img{width:100%;height:auto;image-rendering:pixelated;display:block}
.viewport pre{margin:0;color:#cfe3d4;font-family:var(--mono);font-size:9.5px;line-height:1.16;
padding:8px 6px;white-space:pre;overflow:hidden;width:100%;text-align:left;letter-spacing:.3px}
.viewport .ended{position:absolute;inset:0;background:rgba(8,10,12,.62);color:#fff;display:flex;
align-items:center;justify-content:center;font-size:.82rem;font-weight:600;letter-spacing:.04em}
.cap{padding:8px 11px;font-size:.8rem;min-height:74px;border-top:1px solid var(--line);background:#fff}
.cap .line1{font-weight:600}
.cap .ev{color:var(--accent);font-weight:700}
.cap .mem{font-family:var(--mono);font-size:.74rem;color:var(--teal-d);margin-top:3px;
word-break:break-word;display:block}
.cap .bl{font-family:var(--mono);font-size:.72rem;color:var(--muted)}
.cap .bl .hl-prog{color:var(--accent);font-weight:700}
.controls{display:flex;align-items:center;gap:10px;margin-top:14px;flex-wrap:wrap}
.controls button{border:1.5px solid var(--line);background:#fff;border-radius:8px;padding:6px 13px;
cursor:pointer;font-weight:600;font-size:.86rem;color:var(--ink)}
.controls button:hover{border-color:var(--teal);color:var(--teal-d)}
.controls button.play{background:var(--teal);color:#fff;border-color:var(--teal)}
.controls input[type=range]{flex:1;min-width:120px;accent-color:var(--teal)}
.controls .fidx{font-family:var(--mono);font-size:.82rem;color:var(--muted);min-width:74px}
.legendrow{font-size:.84rem;color:var(--muted);margin:.6em 0 0}
.legendrow .k{font-family:var(--mono);background:var(--soft);padding:1px 5px;border-radius:4px;color:var(--ink)}
.panels.p4{grid-template-columns:repeat(4,1fr)}
@media(max-width:760px){.panels.p4{grid-template-columns:1fr 1fr}}
.viewtoggle{display:inline-flex;border:1.5px solid var(--line);border-radius:30px;overflow:hidden;margin-left:6px}
.viewtoggle button{border:none;background:#fff;padding:8px 16px;cursor:pointer;font-weight:600;font-size:.92rem;color:var(--muted)}
.viewtoggle button.on{background:var(--teal);color:#fff}
.envnote{background:var(--soft);border:1px solid var(--line);border-radius:10px;padding:11px 15px;margin:.4em auto 1.1em;font-size:.9rem;color:var(--ink);max-width:1060px}
.envnote b{color:var(--teal-d)}
.envnote .key{font-family:var(--mono);background:#fff;border:1px solid var(--line);border-radius:4px;padding:0 5px;font-size:.86em}
.demo-tag{font-size:.72rem;font-weight:700;padding:2px 9px;border-radius:20px;letter-spacing:.01em;white-space:nowrap}
.demo-tag.train{background:#fbe9e1;color:var(--accent)}
.demo-tag.scaf{background:#e7f1f1;color:var(--teal-d)}
.demo-sub .dnote{font-weight:600}
.demo-sub .dnote.train{color:var(--accent)}
.demo-sub .dnote.scaf{color:var(--teal-d)}
.cap .mem b{color:var(--ink);font-weight:700}
.cap .mem .newop{background:#fbe9e1;color:var(--accent);font-weight:700;border-radius:3px;padding:0 4px}
.viewport pre .hl-p{color:#34e0c8;font-weight:700}
.viewport pre .hl-s{color:#f5c451;font-weight:700}
.note{border-left:3px solid var(--accent-l);background:#fdf6f3;padding:10px 16px;border-radius:0 8px 8px 0;
margin:1em 0;font-size:.93rem}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:22px;align-items:start}
@media(max-width:760px){.grid2{grid-template-columns:1fr}}
pre.bib{background:#1b1e22;color:#e8e6e1;padding:16px 18px;border-radius:10px;overflow-x:auto;
font-size:.82rem;font-family:var(--mono);line-height:1.5}
footer{border-top:1px solid var(--line);margin-top:50px;padding:28px 0 60px;color:var(--muted);font-size:.88rem;text-align:center}
hr.sep{border:none;border-top:1px solid var(--line);margin:0}
.kpis{display:flex;gap:12px;flex-wrap:wrap;justify-content:center;margin:20px 0 4px}
.kpi{background:#fff;border:1px solid var(--line);border-radius:10px;padding:10px 17px;text-align:center;min-width:134px}
.kpi .big{font-size:1.34rem;font-weight:800;color:var(--teal);font-family:var(--mono)}
.kpi .lab{font-size:.78rem;color:var(--muted)}
</style>
</head>
<body>
<header class="hero">
<div class="wrap">
<h1 class="title"><span class="am">AutoMem</span>: Automated Learning of Memory<br>as a Cognitive Skill</h1>
<p class="authors"> <a href="https://danielwusg.github.io/" target="_blank" rel="noopener">Shengguang Wu</a>, <a href="https://hao.computer/" target="_blank" rel="noopener">Hao Zhu</a>, <a href="https://cs.stanford.edu/~yuhuiz/" target="_blank" rel="noopener">Yuhui Zhang</a>, <a href="https://ai.stanford.edu/~xhanwang/" target="_blank" rel="noopener">Xiaohan Wang</a>, <a href="https://ai.stanford.edu/~syyeung/" target="_blank" rel="noopener">Serena Yeung-Levy</a> </p>
<p class="affil">Stanford University</p>
<div class="btns">
<a class="btn" href="https://arxiv.org/pdf/2607.01224" target="_blank" rel="noopener"><svg viewBox="0 0 24 24"><path d="M6 2h9l5 5v15a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm8 1.5V8h4.5L14 3.5z"/></svg>Paper</a>
<a class="btn ghost" href="https://arxiv.org/abs/2607.01224" target="_blank" rel="noopener"><svg viewBox="0 0 24 24"><path d="M12 2 2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/></svg>arXiv</a>
<a class="btn ghost" href="https://github.com/autoLearnMem/AutoMem" target="_blank" rel="noopener"><svg viewBox="0 0 24 24"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-.9-2.6c3-.3 6.2-1.5 6.2-6.7A5.2 5.2 0 0 0 19 4.8 4.9 4.9 0 0 0 18.9 1S17.7.6 15 2.5a13.4 13.4 0 0 0-7 0C5.3.6 4.1 1 4.1 1A4.9 4.9 0 0 0 4 4.8 5.2 5.2 0 0 0 2.7 8.4c0 5.2 3.2 6.4 6.2 6.7A3.4 3.4 0 0 0 8 17.7V22"/></svg>Code</a>
<a class="btn ghost" href="https://huggingface.co/papers/2607.01224" target="_blank" rel="noopener"><span style="font-size:16px;line-height:1">🤗</span>Hugging Face</a>
<a class="btn ghost" href="https://x.com/ShengguangWu/status/2073083010631795083" target="_blank" rel="noopener"><svg viewBox="0 0 24 24"><path d="M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z"/></svg>Thread</a>
</div>
</div>
</header>
<div class="wrap">
<figure class="teaserwrap">
<img src="assets/figs/teaser.png" alt="AutoMem progression across scaffold optimization and memory training">
<figcaption><b>Memory skill optimization</b> with Qwen2.5-32B-Instruct. Starting from a base agent equipped with file-system memory (<code>v0</code>), AutoMem progressively improves performance through <b>memory scaffold optimization</b> (v0–v5 for Crafter, v0–v4 for MiniHack, v0–v2 for NetHack), followed by <b>memory proficiency training</b> (<span style="color:#C94420">+train</span>) that yields further gains on top of the optimized scaffold. Colored y-ticks mark frontier references (Gemini-3.1-Pro-Thinking, Claude-Opus-4.5).</figcaption>
</figure>
<div class="kpis">
<div class="kpi"><div class="big">~2×–4×</div><div class="lab">progression gain over base agent</div></div>
<div class="kpi"><div class="big">32B</div><div class="lab">open model → frontier level</div></div>
<div class="kpi"><div class="big">memory only</div><div class="lab">no task-action weights trained</div></div>
</div>
<div class="narrow">
<div class="abstract">
<h3>Abstract</h3>
<p><b>AutoMem</b> turns memory management into a trainable skill for LLM agents. Memory operations (read, write, search, append) live in the same action space as the agent's task actions, so the model itself decides what to store, when to retrieve, and how to organize what it knows. AutoMem <b>automates the learning of this skill</b> end-to-end with two meta-LLM loops: <b>loop #1</b> optimizes the agent scaffold (memory <i>structure</i>), and <b>loop #2</b> trains a dedicated <i>memory specialist</i> from the agent's own traces (memory <i>proficiency</i>). Optimizing memory alone — without ever touching the model's task-action behavior — yields <b>~2×–4×</b> progression gains, lifting the open-weight Qwen2.5-32B to frontier-level performance on three long-horizon tasks: Crafter, MiniHack, and NetHack.</p>
</div>
</div>
<h2><span class="hash">§</span>The AutoMem Framework</h2>
<figure class="bordered">
<img src="assets/figs/method.png" alt="AutoMem overview: two automated outer loops" style="max-width:90%">
<figcaption><b>Two automated outer loops optimize a shared inner-loop agent</b> that uses the file system as its memory. At each step the inner agent runs two routines in a unified action space: a <b>LOG</b> routine (<i>“what is worth recording about what just happened?”</i>) that appends, creates, or rewrites memory files, and a <b>PLAN</b> routine (<i>“what do I need to recall to act now?”</i>) that searches and reads files before committing the next world action. Memory operations (<code class="mono"><|SEARCH|></code>, <code class="mono"><|APPEND|></code>, <code class="mono"><|UPSERT_MAP|></code>…) sit in the <b>same action space</b> as task actions, so every memory decision is a traceable action the outer loops can observe and optimize. <br><br> <b>Outer-loop #1</b> (top) optimizes the memory <i>structure</i>: a meta-LLM reviews full episode traces and iteratively revises the agent scaffold — its code, prompts, file schema, and action vocabulary. <b>Outer-loop #2</b> (bottom) optimizes the model's <i>proficiency</i>: a meta-LLM <i>training engine</i> jointly curates SFT data from the agent's own traces and matches a LoRA configuration to train a dedicated <i>memory specialist</i>. At inference, the trained memory specialist handles LOG and the consultation part of PLAN, while the unmodified base gameplay model commits the world action, so memory proficiency is sharpened without ever touching the task competence. <b>Loop #1 sets the structural ceiling; loop #2 pushes the model capacity towards it.</b></figcaption>
</figure>
<h2><span class="hash">§</span>Qualitative Demos: Watch the Behavior Improve</h2>
<p class="narrow">We study three stochastic, procedurally-generated worlds: <b>Crafter</b> — open-world survival with crafting, combat, and resource management (22 achievements, ~10<sup>3</sup> steps); <b>MiniHack</b> — 8 focused puzzle/navigation/combat tasks on the NetHack engine (~10<sup>2</sup> steps); and <b>NetHack</b> — among the hardest games, with 10<sup>4</sup>–10<sup>5</sup>-turn episodes regenerated every seed.</p>
<p class="narrow">Each demo replays <b>the same seed</b> at each stage — <code>v0</code> base scaffold, the optimized scaffold, and the trained specialist — so the world is identical and only the agent differs. The chip on each panel reports that run's <b>progression rate</b> (defined per environment in the note below). Press <b>Play</b> to advance all panels in lockstep; toggle between the <b>Visual</b> game view and the raw <b>Text</b> the model reads; memory operations the agent issued appear under every frame.</p>
<div class="envtabs">
<div class="envtab" data-env="crafter">Crafter</div>
<div class="envtab" data-env="minihack">MiniHack</div>
<div class="envtab active" data-env="nle">NetHack</div>
<span class="viewtoggle"><button data-view="visual" class="on">Visual</button><button data-view="text">Text</button></span>
</div>
<div id="env-note" class="envnote"></div>
<div id="demo-mount"></div>
<h2><span class="hash">§</span>Quantitative Results</h2>
<div class="tablewrap narrow">
<table class="main">
<thead><tr><th>Agent</th><th>Crafter (%)</th><th>MiniHack (%)</th><th>NetHack (%)</th></tr></thead>
<tbody>
<tr class="grouprow"><td colspan="4">Frontier proprietary — BALROG leaderboard</td></tr>
<tr><td>Gemini-3-Pro</td><td class="num">57.3 <span class="se">±4.4</span></td><td class="num">40.0 <span class="se">±7.7</span></td><td class="num">6.8 <span class="se">±3.2</span></td></tr>
<tr><td>Gemini-3.1-Pro-Thinking</td><td class="num">55.0 <span class="se">±6.4</span></td><td class="num">27.5 <span class="se">±7.1</span></td><td class="num">2.6 <span class="se">±0.3</span></td></tr>
<tr><td>Claude-Opus-4.5</td><td class="num">49.5 <span class="se">±3.1</span></td><td class="num">27.5 <span class="se">±7.1</span></td><td class="num">2.0 <span class="se">±0.5</span></td></tr>
<tr><td>Gemini-2.5-Pro</td><td class="num">55.0 <span class="se">±6.0</span></td><td class="num">17.5 <span class="se">±6.0</span></td><td class="num">1.7 <span class="se">±0.2</span></td></tr>
<tr class="grouprow"><td colspan="4">Open-weight — BALROG leaderboard</td></tr>
<tr><td>DeepSeek-R1 (671B)</td><td class="num">36.4 <span class="se">±3.8</span></td><td class="num">25.0 <span class="se">±6.8</span></td><td class="num">1.4 <span class="se">±0.5</span></td></tr>
<tr><td>Qwen2.5-72B-Instruct</td><td class="num">27.3 <span class="se">±3.6</span></td><td class="num">5.0 <span class="se">±3.4</span></td><td class="num">0.3 <span class="se">±0.3</span></td></tr>
<tr><td>Qwen2.5-7B-Instruct</td><td class="num">16.4 <span class="se">±3.0</span></td><td class="num">0.0 <span class="se">±0.0</span></td><td class="num">0.0 <span class="se">±0.0</span></td></tr>
<tr class="grouprow"><td colspan="4">Qwen2.5-32B-Instruct with basic context management</td></tr>
<tr><td> sliding window</td><td class="num">19.55 <span class="se">±3.46</span></td><td class="num">2.50 <span class="se">±2.47</span></td><td class="num">0.00 <span class="se">±0.00</span></td></tr>
<tr><td> + chain-of-thought</td><td class="num">17.27 <span class="se">±2.71</span></td><td class="num">10.00 <span class="se">±4.74</span></td><td class="num">0.00 <span class="se">±0.00</span></td></tr>
<tr class="grouprow"><td colspan="4">Qwen2.5-32B-Instruct with AutoMem (ours)</td></tr>
<tr class="ours"><td> memory-as-file-system, <code>v0</code></td><td class="num">25.00 <span class="se">±5.50</span></td><td class="num">7.50 <span class="se">±4.16</span></td><td class="num">0.42 <span class="se">±0.37</span></td></tr>
<tr class="ours"><td> + scaffold opt. (loop #1)</td><td class="num">47.27 <span class="se">±2.05</span></td><td class="num">27.50 <span class="se">±7.06</span></td><td class="num">1.57 <span class="se">±0.35</span></td></tr>
<tr class="ours best"><td> + memory training (loop #2)</td><td class="num">51.36 <span class="se">±3.81</span></td><td class="num">30.00 <span class="se">±7.25</span></td><td class="num">1.85 <span class="se">±0.44</span></td></tr>
</tbody>
</table>
</div>
<p class="small narrow"><b>Progression (%), mean ± standard error</b> over the fixed seed set (10 episodes Crafter, 5 episodes × 8 tasks MiniHack, 5 episodes NetHack). Optimizing memory alone — without modifying task-action weights — roughly <b>doubles or more than triples</b> performance in every environment, and the full framework yields <b>~2×–4×</b> gains, approaching the level of frontier proprietary systems. <i>Scaffold opt.</i> is loop #1 at convergence (v5 Crafter, v4 MiniHack, v2 NetHack); <i>+ memory training</i> adds loop #2's memory specialist on top, lifting Crafter to <b>51.36%</b>, MiniHack to <b>30.0%</b>, and NetHack to <b>1.85%</b>.</p>
<h2><span class="hash">§</span>Why Memory Optimization Works</h2>
<figure class="bordered" style="margin-top:0">
<img src="assets/figs/scaffold_bars.png" alt="Behavioral effect of scaffold optimization">
<figcaption><b>Loop #1 — scaffold optimization improves gameplay and memory behavior simultaneously</b> (initial agent v0 vs. the converged scaffold). The unproductive action rate (steps that are stuck or oscillating) drops 32–65%; redundant memory writes drop sharply (−68 to −83%); the empty-search rate (<code class="mono"><|SEARCH|></code>es that return nothing) falls (−13 to −50%); and the per-step input context shrinks (−3 to −30%) as leaner memory compresses what the model must attend to. Lower is better in every panel.</figcaption>
</figure>
<figure style="margin-top:1.8em">
<table class="main" style="max-width:520px;margin:0 auto">
<thead><tr><th>LOG-phase writes / SEARCH</th><th>Base</th><th>+ Trained</th></tr></thead>
<tbody>
<tr class="ours"><td>Crafter</td><td class="num">0.84</td><td class="num">0.39 <span class="se">(−54%)</span></td></tr>
<tr class="ours"><td>MiniHack</td><td class="num">2.89</td><td class="num">0.82 <span class="se">(−72%)</span></td></tr>
<tr class="ours best"><td>NetHack</td><td class="num">4.66</td><td class="num">1.31 <span class="se">(−72%)</span></td></tr>
</tbody>
</table>
<figcaption style="max-width:760px;margin-left:auto;margin-right:auto"><b>Loop #2 — training internalizes a consult-before-write discipline.</b> In the LOG phase, the trained memory specialist's ratio of memory writes per <code class="mono"><|SEARCH|></code> falls in every environment (lower = more retrieval before writing): it searches existing memory before appending new content rather than logging blindly. This is the retrieval-first pattern the optimized scaffold encourages, now internalized into the model's weights.</figcaption>
</figure>
<h2><span class="hash">§</span>Citation</h2>
<pre class="bib">@article{wu2026automem,
title={AutoMem: Automated Learning of Memory as a Cognitive Skill},
author={Wu, Shengguang and Zhu, Hao and Zhang, Yuhui and Wang, Xiaohan and Yeung-Levy, Serena},
journal={arXiv preprint arXiv:2607.01224},
year= {2026}
}</pre>
</div>
<footer>
<div class="wrap"><a href="https://arxiv.org/abs/2607.01224" target="_blank" rel="noopener" style="color:inherit">AutoMem: Automated Learning of Memory as a Cognitive Skill</a></div>
</footer>
<script src="assets/demos.js"></script>
<script>
(function(){
const D = window.DEMOS;
const mount = document.getElementById('demo-mount');
const noteEl = document.getElementById('env-note');
let viewMode = 'visual';
let curEnv = 'nle';
const ENV_NOTE = {
crafter: `<b>What to watch:</b> the agent gathers, crafts, and survives — the game view marks each achievement as it unlocks. Compare how far the tech tree goes: <span class="key">v0</span> wanders, the optimized scaffold builds tools, and the trained specialist crafts further. The panel chip reports the <b>progression rate</b> as <b>% · N ach</b> — the fraction of the 22 Crafter achievements unlocked. Memory operations the agent issued each step appear under the frame.`,
minihack: `<b>What to watch:</b> each MiniHack task is solved or not (binary). <span class="key">v0</span> wanders aimlessly; the optimized <span class="key">v4</span> scaffold already solves the mazes; and the <b>trained</b> specialist solves tasks the scaffold cannot — including <i>Corridor-R3</i>, a corridor-navigation task. In <b>Text</b> view, <b style="color:#1f8a7a">@</b> is the agent and <b style="color:#b8860b">< ></b> are stairs.`,
nle: `<b>What to watch:</b> progression in NetHack = how <b>deep</b> the player descends and how much <b>experience</b> the player gains. <span class="key">Dlvl</span> = dungeon level (higher is deeper) and <span class="key">Xp</span> = experience level, both in the status line under each frame — <b>a higher Dlvl or Xp is highlighted</b> there, and maps to a higher panel <b>progression rate (% prog</b>, the BALROG dungeon-and-experience metric). The optimized scaffold adds a new memory op, <span class="newop">UPSERT_MAP</span> — a coordinate-keyed map that dedups the dungeon (watch for it in the memory line). In <b>Text</b> view, <b style="color:#1f8a7a">@</b> = the player, <b style="color:#b8860b">< ></b> = stairs, letters = monsters.`
};
const NEWOPS = { nle:['UPSERT_MAP'], crafter:[], minihack:[] };
const OPS = ['UPSERT_MAP','SEARCH','APPEND','CREATE','WRITE','READ','TAIL','COUNT','DONE'];
function esc(s){return (s||'').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');}
function condClass(cond){
if(cond.startsWith('v0')) return 'c0';
if(cond.includes('trained')) return 'ct';
return 'c5';
}
function condLabel(panel){
return panel.cond;
}
function hlMap(map){
let h=esc(map);
h=h.replace(/@/g,'<span class="hl-p">@</span>');
h=h.replace(/<|>/g,m=>`<span class="hl-s">${m}</span>`);
return h;
}
function hlBl(s,env){
let h=esc(s);
if(env==='nle'){
h=h.replace(/Dlvl:(\d+)/g,(m,d)=> (+d>=2)?`<span class="hl-prog">${m}</span>`:m);
h=h.replace(/Xp:(\d+)/g,(m,d)=> (+d>=2)?`<span class="hl-prog">${m}</span>`:m);
}
return h;
}
function hlMem(mem,env){
let h=esc(mem);
OPS.forEach(op=>{
const isnew=(NEWOPS[env]||[]).includes(op);
h=h.replace(new RegExp('(^|[^A-Z_])('+op+')(?![A-Z_])','g'),
(m,a,b)=> a+(isnew?`<span class="newop">${b}</span>`:`<b>${b}</b>`));
});
return h;
}
const DEMO_NOTE = {
crafter_s42:{t:"+ trained crafts stone tools, a furnace, and mines iron — 13 achievements vs v0's 2",c:"train"},
crafter_s49:{t:"+ trained crafts further each stage — 13 achievements vs v0's 3",c:"train"},
crafter_s50:{t:"a harder seed — + trained still triples v0 (6 vs 2 achievements)",c:"train"},
"minihack_MazeWalk-15x15_s43":{t:"the optimized scaffold solves the large maze; v0 wanders",c:"scaf"},
"minihack_Corridor-R3_s42":{t:"only + trained solves this corridor",c:"train"},
"minihack_Corridor-R3_s46":{t:"training-only solve — both v0 and the scaffold fail",c:"train"},
nle_s42:{t:"+ trained reaches experience level 4; v0 dies early at Xp 1",c:"train"},
nle_s46:{t:"+ trained descends to dungeon level 2 and climbs to experience level 5 (241 XP gathered) — the deepest of these episodes",c:"train"},
nle_s43:{t:"the evolved v2 agent reaches experience level 3; v0 never leaves Xp 1",c:"scaf"},
};
function buildPanel(panel, env){
const isC = env==='crafter';
const score = isC ? `${panel.prog!=null?panel.prog+'% · '+(panel.nach||0)+' ach':''}`
: `${panel.prog!=null?panel.prog+'% prog':''}`;
const head = `<div class="panel-head ${condClass(panel.cond)}">
<span class="cond">${esc(condLabel(panel))}</span>
<span class="score">${score}</span></div>`;
return {head, frames:panel.frames, len:panel.frames.length, crafter:isC};
}
function renderDemo(demo, env, key){
const card = document.createElement('div');
card.className='demo-card';
const panels = demo.panels.map(p=>buildPanel(p, env));
const np = panels.length;
const maxlen = Math.max(...panels.map(p=>p.len));
const isMulti = (env==='minihack');
const title = isMulti ? (demo.title || ('seed '+demo.seed)) : '';
const note = DEMO_NOTE[key];
const noteHtml = note ? '<span class="dnote '+note.c+'">'+esc(note.t)+'</span>' : '';
card.innerHTML = `
<div class="demo-head">
<span class="demo-title">${esc(title)}</span>
<span class="demo-sub">${noteHtml}</span>
</div>
<div class="panels p${np}"></div>
<div class="controls">
<button class="play">▶ Play</button>
<button class="prev">‹ Step</button>
<button class="next">Step ›</button>
<input type="range" min="0" max="${maxlen-1}" value="0">
<span class="fidx">frame 1/${maxlen}</span>
</div>`;
const panelsWrap = card.querySelector('.panels');
const panelEls = panels.map(p=>{
const el=document.createElement('div'); el.className='panel';
el.innerHTML = p.head +
`<div class="viewport"><img style="display:none"><pre style="display:none"></pre><div class="ended" style="display:none">episode ended</div></div>`+
`<div class="cap"></div>`;
panelsWrap.appendChild(el);
return el;
});
function draw(i){
panels.forEach((p,pi)=>{
const el=panelEls[pi];
const fr = p.frames[Math.min(i, p.len-1)];
const img=el.querySelector('img'), pre=el.querySelector('pre');
el.querySelector('.ended').style.display = (i>=p.len)?'flex':'none';
const useImg = (p.crafter || viewMode==='visual') && fr.img;
if(useImg){ img.src=fr.img; img.style.display='block'; pre.style.display='none'; }
else {
const m = fr.map || '';
pre.innerHTML = p.crafter ? '(no text view — visual only)'
: (m.replace(/\s/g,'').length ? hlMap(m) : '(map unavailable for this frame — use Visual)');
pre.style.display='block'; img.style.display='none';
}
const ev = fr.event ? `<span class="ev">${esc(fr.event)}</span>` : '';
const bl = (!p.crafter && fr.blstats) ? `<span class="bl">${hlBl(fr.blstats, env)}</span>` : '';
const mem = fr.mem ? `<span class="mem">${hlMem(fr.mem, env)}</span>` : `<span class="mem" style="color:#8a8f95">— no memory op —</span>`;
el.querySelector('.cap').innerHTML = `<div class="line1">step ${fr.step} · ${esc(fr.action||'')} ${ev}</div>`+bl+mem;
});
card.querySelector('.fidx').textContent = `frame ${Math.min(i,maxlen-1)+1}/${maxlen}`;
card.querySelector('input[type=range]').value = Math.min(i,maxlen-1);
}
let idx=0, timer=null;
const playBtn=card.querySelector('.play');
function stop(){ if(timer){clearInterval(timer);timer=null;} playBtn.textContent='▶ Play'; playBtn.classList.remove('play'); playBtn.classList.add('play');}
function play(){
if(timer){stop();return;}
playBtn.textContent='❚❚ Pause';
timer=setInterval(()=>{
idx++;
if(idx>maxlen-1+1){ idx=0; }
draw(idx);
}, 1200);
}
playBtn.addEventListener('click',play);
card.querySelector('.prev').addEventListener('click',()=>{stop();idx=Math.max(0,idx-1);draw(idx);});
card.querySelector('.next').addEventListener('click',()=>{stop();idx=Math.min(maxlen-1,idx+1);draw(idx);});
card.querySelector('input[type=range]').addEventListener('input',e=>{stop();idx=+e.target.value;draw(idx);});
draw(0);
return card;
}
function showEnv(env){
curEnv=env;
noteEl.innerHTML = ENV_NOTE[env] || '';
mount.innerHTML='';
const getter = env==='crafter' ? (k=>D.crafter[k]) : (k=>D.ascii[k]);
(D.order[env]||[]).forEach(k=>{ const demo=getter(k); if(demo) mount.appendChild(renderDemo(demo, env, k)); });
}
document.querySelectorAll('.envtab').forEach(tab=>{
tab.addEventListener('click',()=>{
document.querySelectorAll('.envtab').forEach(t=>t.classList.remove('active'));
tab.classList.add('active');
showEnv(tab.dataset.env);
window.scrollTo({top:tab.getBoundingClientRect().top+window.scrollY-80,behavior:'smooth'});
});
});
document.querySelectorAll('.viewtoggle button').forEach(btn=>{
btn.addEventListener('click',()=>{
viewMode=btn.dataset.view;
document.querySelectorAll('.viewtoggle button').forEach(b=>b.classList.toggle('on', b===btn));
showEnv(curEnv);
});
});
showEnv('nle');
})();
</script>
</body>
</html>