Tasks/AI Models & Agents

LLM Agent Memory Architecture Design

Design an LLM agent memory architecture that generalizes

AI Models & AgentsLLM agent memory architecturelong-term dialogue
Background

Long-term memory architecture for LLM agents—the retrieval layer that lets an assistant recall earlier interactions—remains unsolved: context windows cannot hold months of accumulated dialogue. The starting point is a minimal system that has a language model distill sessions into atomic facts, indexes them by keyword match alone, and answers questions from a few top hits. The work is to redesign that pipeline: extraction, storage, retrieval, and answering. Any gain must survive conversations the design never saw, within a fixed compute budget.

instruction.mdthis is what the agent is given

You inherit a minimal long-term-memory system for LLM agents: it extracts atomic memory entries from multi-session conversations with an LLM, indexes them with BM25 only (k=5, 8-entry context), and answers questions with one concise LLM call. Your goal is to redesign this memory architecture — extraction, storage, retrieval, and answering are all yours to change — using the visible conversations for development. Your submission is re-run by a sealed verifier on unseen conversations of the same kind and scored by token-level F1, so improvements must generalize beyond the conversations you can see.

Hard Constraints

  • Keep the grading contract of /app/methods/main/memory_system.py intact: build_memory_system(llm_call) returning an object with .ingest(sessions) and .answer(question, question_time=""). The docstring in that file is the authoritative contract.
  • Everything you submit must live under /app/methods/ — only that directory is collected for grading.
  • All LLM access must go through the llm_call the harness passes in. At grade time it is routed through a proxy that pins the base model (gpt-4o-mini); requests for any other model are rewritten to it, and your code never receives a real API key.
  • Only preinstalled packages are available at grade time (openai, rank_bm25, numpy, sentence-transformers with locally cached BAAI/bge-base-en-v1.5 and all-MiniLM-L6-v2, scikit-learn, pandas, networkx, pyyaml). The verifier cannot install packages for your code.
  • Answers must be derived from the ingested sessions via your memory system — no hardcoded question-answer mappings.
  • .answer() must return a string; a question whose call raises scores 0 — prefer a best-effort answer over an exception.
  • .ingest() may be called with several independent conversations merged into one batch (namespaced session ids); do not assume a single continuous conversation.

What You Have

  • /app/methods/main/: the inherited baseline (extraction -> BM25 index -> concise answer). This is what gets graded; improve it in place or rewrite it.
  • /app/data/conversations_visible.json: the visible dev set — 4 multi-session conversations (19-31 sessions each), 812 free-text QA pairs in 5 categories (single-hop, temporal, multi-hop/inferential, open-domain, adversarial).
  • /app/selfcheck.py: free local scoring on the visible set (token F1), with per-category breakdown, conversation/QA subsetting for cheap runs, and an extraction cache flag. A full cold visible run with the baseline takes ~70 min (extraction dominates); cached re-runs ~13 min.
  • MEMORY_LLM_API_KEY / MEMORY_LLM_API_BASE / MEMORY_LLM_MODEL in your environment for development runs (selfcheck.py reads them).

What You Submit

Leave your best memory system under /app/methods/ with the entry point /app/methods/main/memory_system.py honoring the contract. There is no submit step; it is graded once at the end.

How It Is Judged

The sealed verifier ingests unseen conversations of the same kind into one instance of your system, asks every question, and scores token-level F1 against concise gold answers. Higher mean F1 is better. Grading re-runs your full pipeline (ingest + answer) within a fixed wall-clock budget — the inherited baseline uses about half of it, and a run that exceeds it scores 0.

Rollouts

159 minWall clock
$48.21Spend
74.9MTokens
42Versions, 22 kept

On the visible set

0.300 0.375 0.450 0.525 0 150 300 450 Agent step Token F1 ↑ v0 v1 v2 v3 v4 v5 v6 v7 v15 v27 v29 v35 v36 v37 v38
keptrolled backsubmitted
  1. v0The agent snapshotted the inherited extraction baseline unchanged0.259613 min · $1.89
  2. v1The agent made the raw dialogue itself the memory and ingest almost free0.271913 min · $1.89
  3. v2The agent gave every question type its own answer shape0.365715 min · $2.29
  4. v3The agent mixed extracted facts back in, and they polluted the dates0.336218 min · $2.78
  5. v4The agent added meaning-based evidence blocks for broad questions0.362125 min · $4.10
  6. v5The agent handed over the whole conversation for lists, and repetition confused it0.337927 min · $4.55
  7. v6The agent made the model show its evidence and check itself before answering0.388929 min · $5.07
  8. v7The agent learned to keep relative dates anchored to the session's own date0.444834 min · $6.18
  9. v8The agent taught itself everyday relations between nicknames, games and places0.1317 · conv0 cat336 min · $6.57
  10. v9The agent appended the whole conversation for inference wording, and it bought little0.1387 · conv0 cat337 min · $6.88
  11. v10The agent demanded exact labels: a state, a console model, a named condition0.2113 · conv0 cat339 min · $7.33
  12. v11The agent gated travel expansion to undated place questions and recovered both states0.3022 · conv0 cat342 min · $8.53
  13. v12The agent wrote one profile per conversation to answer aggregate questions0.3235 · conv0 cat142 min · $8.53
  14. v13The agent replaced the single profile with lossless five-session ledgers0.3066 / 0.3932 · cat1/347 min · $9.76
  15. v14The agent put lossless ledger bullets beside the synthesis and demanded exact predicates0.5348 · conv0 overall49 min · $10.40
  16. v15The agent kept the profiles away from temporal questions where they blur dates0.432157 min · $13.00
  17. v16The agent counted from focused occurrences instead of broad totals0.3358 · conv0 cat158 min · $13.71
  18. v18The agent widened its counting triggers to more verbs, and nothing moved0.6154 · count QA60 min · $14.33
  19. v17The agent split counting into action counts and inventory counts0.5465 · conv1–2 overall70 min · $18.21
  20. v19The agent added an auditor that rewrote answers that were already good0.2812 · triggered QA75 min · $20.22
  21. v20The agent narrowed the second call to naming the game or console described0.267 / 1.000 · targets76 min · $20.95
  22. v21The agent guessed a plausible hidden-role game, and plausible was still wrong0.0000 · target QA76 min · $20.95
  23. v22The agent fed dated ledgers to temporal questions, and events collided0.4878 · conv1–2 cat279 min · $22.20
  24. v23The agent chopped the ledgers finer, and the synthesis still dropped facts0.2717 / 0.2063 · cat1/383 min · $23.89
  25. v24The agent put the profile ahead of raw snippets for plural inventory questions0.5207 · changed QA87 min · $26.22
  26. v25The agent audited its list answers for completeness, and they grew verbose0.5323 · list QA89 min · $26.91
  27. v26The agent marked every token's stem and distorted its own keyword scoring0.8073 · retrieval recall92 min · $27.56
  28. v27The agent stemmed only inflected words, and the fix reached the answers0.458195 min · $27.88
  29. v28The agent learned to keep the whole reason instead of compressing to one word0.5490 · why/how QA102 min · $29.21
  30. v29The agent widened its chunks, and better oracle recall still answered worse0.4451110 min · $30.97
  31. v30The agent triggered profiles on plural nouns, and one conversation collapsed0.4610 · changed QA113 min · $31.76
  32. v31The agent kept only the unambiguous plural triggers, and four questions was too few0.1882 · changed QA114 min · $32.10
  33. v32The agent fixed the shape of dates and durations without asking the model0.5994 · tune overall115 min · $32.53
  34. v33The agent added an inference auditor that invented confident answers0.0667 · triggered QA117 min · $33.10
  35. v34The agent restored the conversation's own relative wording for dates it could verify0.6032 · tune overall121 min · $34.28
  36. v35The agent dropped pronouns from its queries since names already route the search0.5163126 min · $36.26
  37. v36The agent appended semantic hits again, and they diluted selection again0.4908131 min · $38.16
  38. v37The agent traded context for precision, and removing weak support also hurt0.4847133 min · $39.24
  39. v38The agent reranked by query-term coverage, and its old order was better0.5098137 min · $40.93
  40. v39The agent made inferred yes-no answers carry the evidence that justifies them0.5609 · holdout overall139 min · $42.05
  41. v41The agent reused its own earlier answers as hints, and the order dependence failed0.6029 / 0.6339 · conv0/1–2145 min · $44.53
  42. v42The agent gave ordinal questions extracted chronology, which overrode the raw evidence0.4932 / 0.4167 · conv0/1–2149 min · $47.21

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (GPT-5.6-sol)0.5716110.3222
233 minWall clock
$29.34Spend
44.3MTokens
25Versions, 12 kept

On the visible set

0.35 0.40 0.45 0.50 0.55 0.60 0 5 10 15 20 Agent step Token F1 ↑ v1 v2 v2big v3 v3.1 v3.2 v4 v4x v5 v5.1 v5.2 v6 v6.1 v6.2 v7 v7.1 v7.2 v7.3 v7.4 v7.5 v7.6 v8 v9 v10 baseline
keptrolled backsubmitted
  1. v1The agent dropped LLM extraction and indexed raw dialogue windows with hybrid retrievalRaw dialogue is the memory: index it losslessly and let hybrid retrieval choose, instead of extracting facts at ingest.0.514423 min · $3.13
  2. v2The agent rewrote the answering prompt to quote an excerpt then answer0.5505$4.02
  3. v2bigThe agent deepened retrieval to twenty-four chunks and fifteen thousand characters0.5549$4.90
  4. v3The agent routed questions by regex type with per-type answer rules0.558343 min · $5.79
  5. v3.1The agent A/B tested shorter and fuller answer-length targets0.5297$7.30
  6. v3.2The agent added a lexical-anchor rule pointing at the question's distinctive words0.5682$8.81
  7. v4The agent added an ingest-time digest of self-contained notes with absolute datesAdd a second memory view for dates and aggregates, gated to when/duration/count/list so it cannot dilute the excerpts.0.576778 min · $10.32
  8. v4xThe agent tried ignoring the named speaker and hedging between candidates0.554$10.84
  9. v5The agent pulled extra chunks for high-IDF question terms missing from context0.581484 min · $11.36
  10. v5.1The agent batch-tested candidate enumeration, self-refine and verbatim answering prompts0.5677$13.08
  11. v5.2The agent probed much larger context windows against focused retrieval0.5168$14.81
  12. v6The agent consolidated notes into per-speaker topic lines for list questions0.5852128 min · $16.54
  13. v6.1The agent added a date-matching retrieval view for questions naming dates0.5835$17.54
  14. v6.2The agent generated three LLM sub-queries per question and merged their hits0.5784$18.54
  15. v7The agent kept relative date anchors instead of converting them to calendar datesA quarter of temporal golds read 'the weekday before <session date>', so stop rewriting them as calendar dates.0.5885144 min · $19.54
  16. v7.1The agent pushed the date-anchoring rule into the ingest-time digest prompt0.5859$20.68
  17. v7.2The agent swept retrieval knobs: name stripping and RRF fusion weights0.5794$21.82
  18. v7.3The agent added explicit instructions for handling adversarial mis-premised questions0.5666$22.96
  19. v7.4The agent tried per-type answer-length targets and note-keyed retrieval0.5863$24.11
  20. v7.5The agent reshaped the context with finer chunks and relevance ordering0.5785$25.25
  21. v7.6The agent tried self-consistency sampling and few-shot worked examples0.5812$26.39
  22. v8The agent memoised query embeddings and made ingest re-entrant0.5885221 min · $27.53
  23. v9The agent searched every conversation sharing an ambiguous speaker name0.5885223 min · $27.75
  24. v10The agent hardened imports and documented the architecture for submission0.5885232 min · $28.94
  25. baselineThe agent inherited an LLM-extraction memory system with keyword-only retrieval0.3583$29.14

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (Opus 5)0.5498780.2878
109 minWall clock
$6.36Spend
47.2MTokens
7Versions, 5 kept

On the visible set

0.36 0.40 0.44 0.48 0.52 0 2 3 4 6 Agent step Token F1 ↑ v0 v1 v2 v3 v4 v5 v6
keptrolled backsubmitted
  1. v0The agent inherited a chunk extractor with BM25 keyword search0.35
  2. v1The agent added dense MiniLM embeddings fused with BM25 via RRFRank each memory by meaning as well as by words, then merge the two rankings with reciprocal rank fusion.0.42
  3. v2The agent parallelised extraction and grounded relative dates at ingestResolve relative time wording into absolute dates at ingest so date questions match the stored text literally.0.4901
  4. v3The agent stripped names from queries and boosted matching monthsSearch on the action with speaker names removed, so a multi-hop fact filed under another entity is still reachable.0.5102
  5. v4The agent added an adversarial entity-swap router and pinned torch threads0.5307
  6. v5The agent widened retrieval to thirty chunks and added list rules0.5134
  7. v6The agent froze v4's configuration as the production submission0.5307

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (Gemini 3.7 Flash)0.4664760.1558
514 minWall clock
$8.35Spend
15.8MTokens
16Versions, 13 kept

On the visible set

0.40 0.45 0.50 0.55 0.60 0 4 8 12 Agent step Token F1 ↑ v0 v1 v2 v4 v6 v7 v7-exp v7-full v8
keptrolled backsubmitted
  1. v0The agent inherited an LLM-extraction system with narrow BM25 retrieval0.3767$0.15
  2. v1The agent added hybrid BM25+bge RRF retrieval over memories and raw turnsKeep the extracted facts but index the raw turns beside them, and search only the conversations the speakers appear in.0.5528$0.58
  3. v2The agent added question-type answer rules and deeper retrieval for counting0.5564$0.75
  4. v3The agent added a per-conversation profile consolidation layerConsolidate each conversation into structured facts and let an LLM rerank the pool before the answer call.cat1 .433, cat4 .687$2.02
  5. v3aThe agent added relative-anchored when and list answer rulescat1 .406, cat2 .589$2.52
  6. v3bThe agent added an LLM reranker over the top-25 candidate poolcat1 .432, cat3 .235$3.02
  7. v4The agent added date-aware boosting, as-of filtering and granularity rules0.5697$3.53
  8. v5The agent softened the rerank ownership rule and added an adversarial retrycat5 .538 on subset$3.86
  9. v6The agent added exact-span answer rules and widened chunks four to six0.5882$4.15
  10. v6aThe agent told the model to trust the retrieved excerptscat4 .693, cat5 .486$5.00
  11. v6bThe agent added LLM query expansion fused into retrievalcat1 .431 vs .413$5.85
  12. v7The agent shipped v6 with query expansion present but disabled0.5882$6.70
  13. v7-expThe agent tried a value-preserving extraction prompt0.5679$7.52
  14. v7-fullThe agent ran the full four-conversation evaluation and dropped the trust-excerpts rule0.5755$7.52
  15. v8The agent added an offline HuggingFace safeguard to the final candidate0.5882$7.52
  16. v8bThe agent fixed the profile-kind bug and disabled the profile boostabout v6/v7 levels$7.52

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (Kimi K3)0.5535030.2935
99 minWall clock
$10.47Spend
17.7MTokens
8Versions, 7 kept

On the visible set

0.46 0.48 0.50 0.52 0.54 0 2 4 6 8 Agent step Token F1 ↑ v1 v2 v3 v4 v5 v6 v7
keptrolled backsubmitted
  1. v1The agent replaced extraction with lexical hybrid retrieval over raw dialogue0.4527
  2. v2The agent added query expansion, first-mention injection and a temporal resolver0.5314
  3. v3The agent added per-session LLM notes to the index and contextDelete the ingest LLM: index raw dialogue at turn, window and session scale, and rewrite absolute dates into relative wording.0.5281
  4. v4The agent hid notes on when-questions and restored relative date phrasing0.5327
  5. v5The agent made notes retrieval-only and widened sessions for how-many0.5351
  6. v6The agent showed filtered inferred notes and photo tags with possessive boosts0.5333
  7. v7The agent added speaker profiles and a how-many topic-turn dumpAnswer identity and counting questions from a profile built over the notes rather than from whatever the query lexically matches.0.5074
  8. v8The agent strengthened same-month session boosting when questions name a datenot re-scored

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (Grok 4.6)0.4762720.1713
293 minWall clock
$1.97Spend
24.4MTokens
11Versions, 8 kept

On the visible set

0.225 0.300 0.375 0.450 0.525 0 2 5 8 10 Agent step Token F1 ↑ v0 v1 v1.1 v2 v2.1 v2.2 v2.3 v2.4 v2.5 v3 v4
keptrolled backsubmitted
  1. v0The agent inherited a BM25-only system over LLM-extracted memories0.2823$0.48
  2. v1The agent kept every dialogue turn verbatim and retrieved with BM25 plus dense0.287110 min · $0.96
  3. v1.1The agent piled extra attribute and polarity rules into the answer prompt0.207$1.02
  4. v2The agent added one normalized fact-extraction call per session0.3363124 min · $1.09
  5. v2.1The agent split retrieval into separate memory and turn quotas0.3306$1.20
  6. v2.2The agent normalized capitalized refusals so the retry path fired0.3196$1.32
  7. v2.3The agent kept titles verbatim at extraction and expanded refusal retries0.3974$1.44
  8. v2.4The agent widened the refusal fallback to four sessions0.4474203 min · $1.55
  9. v2.5The agent added a city-to-state answer rule for region questions0.4652249 min · $1.76
  10. v3The agent rewrote extraction, added date-aware retrieval and a timeout guard0.4759$1.86
  11. v4The agent computed weekday dates at extraction and injected per-type answer instructions0.5095$1.86

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (DeepSeek V4 Pro)0.4499440.1297
141 minWall clock
$12.89Spend
44.1MTokens
6Versions, 4 kept

On the visible set

0.35 0.40 0.45 0.50 0.55 0 50 100 150 200 Agent step Token F1 ↑ v1 v2 v2.1 v3 v4
keptrolled backsubmitted
  1. v1The agent inherited a BM25 keyword system over extracted memories0.361651 min · $2.38
  2. v2The agent rewrote retrieval as hybrid BM25 plus dense over turns0.498852 min · $2.47
  3. v2.1The agent fixed the segment budget bug and widened evidence turns0.527678 min · $3.80
  4. v3The agent added Porter stemming, anti-refusal rules and a best-effort retry0.571394 min · $4.76
  5. v4The agent clustered memories into per-person digests and merged near-duplicates0.5331115 min · $7.57
  6. v5The agent tightened answer formatting rules and capped generation length0.387 @100, cut off137 min · $11.57

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (Qwen3.8 Max)0.5499820.2879
606 minWall clock
$23.96Spend
87.7MTokens
15Versions, 9 kept

On the visible set

0.35 0.40 0.45 0.50 0.55 0 3 6 9 12 Agent step Token F1 ↑ v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14
keptrolled backsubmitted
  1. v0The agent inherited a serial extraction baseline with keyword retrieval0.3457$0.83
  2. v1The agent rewrote ingest as parallel extraction with hybrid BM25 and BGE fusion0.458963 min · $1.67
  3. v2The agent added an absolute-date rule and a second compression call0.54388 min · $2.55
  4. v3The agent showed a consolidated dossier for the person the question named0.5305$2.84
  5. v4The agent showed dossiers for both speakers in the matched conversation0.5549104 min · $3.13
  6. v5The agent restructured the dossier to lead with aggregates0.5284$4.07
  7. v6The agent gave the dossier a fuller chronology0.5487$5.01
  8. v7The agent added a mechanical conversation dump but built its index too early0.5423$5.94
  9. v8The agent fixed the dump ordering and turned the LLM dossier off0.5477$6.88
  10. v9The agent aligned retrieval to the ablation and repeated the dates rule0.5557$7.82
  11. v10The agent dropped the unattributed OTHER bucket from the dump0.5428$8.75
  12. v11The agent reverted to atomic extraction after testing a finer prompt0.5517308 min · $9.69
  13. v12The agent cleaned up dead paths and added a time-budget guard0.555374 min · $12.46
  14. v13The agent exception-guarded per-session extraction and capped the dense view0.5489475 min · $18.05
  15. v14The agent removed two debug environment hooks0.5476549 min · $21.18

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (GLM 5.3)0.5438740.2783
94 minWall clock
$11.00Spend
16.3MTokens
12Versions, 5 kept

On the visible set

0.32 0.36 0.40 0.44 0.48 0.52 0 30 60 90 120 Agent step Token F1 ↑ v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11
keptrolled backsubmitted
  1. v0The agent snapshotted the inherited baseline as a referenceinherited, not measured2 min · $0.39
  2. v1The agent replaced extraction with raw-turn BM25 retrieval and neighbor expansion0.32286 min · $0.92
  3. v2The agent normalized retrieval tokens and tightened the relative-date answer rules0.37449 min · $1.62
  4. v3The agent added MiniLM semantic turn scoring and date-neighbor retrieval0.394922 min · $2.93
  5. v4The agent triggered date-neighbor retrieval on explicit dates and added inference prompting0.489327 min · $4.04
  6. v5The agent normalized number words and raised speaker boosts0.363337 min · $5.45
  7. v6The agent applied number-word normalization alone0.372539 min · $5.92
  8. v7The agent prepended a relevance-ranked top-matches section to the context0.344242 min · $6.50
  9. v8The agent prepended a session timeline to the retrieved excerpts0.361944 min · $7.12
  10. v9The agent limited the session timeline to broad list and count questions0.368446 min · $7.63
  11. v10The agent let the model use common world knowledge for inference questions0.503171 min · $9.57
  12. v11The agent forced explicit yes-no prefixes on unprefixed answers0.384993 min · $10.61

On the hidden set

Original metricNormalised score
Starter0.3680.00
Upper1.0001.00
This run (GPT-5.5)0.5070760.2201

Leaderboard

Where each run landed on the sealed held-out set, on the same normalised-score scale as the anchors above.

0 0.3 0.6 1.0 1 GPT-5.6-sol codex · max 0.322 2 Kimi K3 kimi cli · max 0.294 3 Qwen3.8 Max qwen coder · xhigh 0.288 4 Opus 5 claude code · max 0.288 5 GLM 5.3 claude code · max 0.278 6 GPT-5.5 codex · xhigh 0.220 7 Grok 4.6 grok · xhigh 0.171 8 Gemini 3.7 Flash antigravity · high 0.156 9 DeepSeek V4 Pro claude code · max 0.130