Zero-Mem: structured memory without generative bookkeeping
Instead of asking a language model to rewrite the past, keep the original traces and build better routes back to the evidence.
These are reported experimental results, not guarantees. “Zero” excludes encoder computation and the final question-answering LLM.
1. What problem is the paper solving?
An assistant may remember thousands of interactions, yet still answer the wrong question about the right person. Suppose a user once worked at Cedar Labs, later changed jobs, and mentioned the new employer’s office location in a different conversation. A useful answer requires more than finding a sentence with a similar meaning. It must connect the right person to the right employer and preserve the relevant point in time.
Two common approaches
Generated memory: ask an LLM to summarize, extract, consolidate, or rewrite records. This can make retrieval easier, but introduces extra inference costs and opportunities to omit details or merge unrelated facts.
Flat retrieval: keep the text and search for similar chunks. This preserves the original evidence but can miss a necessary bridge in another interaction, or return the wrong session or outdated state.
Zero-Mem’s alternative
Keep the raw text as the source of record. Build two non-generative indexes over it: a graph for connections and a temporal hierarchy for conversational locality. Select and repair the evidence package before handing it to a single final-QA reader.
answer = Reader(query, R(q))
Here, R(q) is a compact collection of source evidence. The paper’s boundary is deliberately strict: construction, organization, query routing, retrieval, evidence closure, and deterministic checks use no LLM calls. The reader is the only LLM-dependent stage.
2. A walkthrough of the complete method
2.1 Preserve the record, derive the indexes
Each derived unit carries original text and provenance: a source identifier, session time, boundary identifier, and any other available metadata. The system can therefore explain not just which unit was retrieved, but which original interaction it came from.
The graph has context nodes and entity nodes. A non-generative NER model, such as spaCy, detects names in a context. An edge means “this entity appeared in this context.” Neighboring context units also get adjacency edges.
This is not a graph of asserted semantic triples. An edge to Cedar Labs does not itself mean “Mira works there.” Co-occurrence is an access signal; the original sentence supplies the meaning. The weight on a context–entity edge is the entity’s occurrence count divided by the total entity occurrences in that context. If Mira occurs twice and Cedar Labs once, their context-edge weights are 2/3 and 1/3.
The hierarchy has four granularities: turns for atomic utterances, windows for short-range context, episodes for neighboring windows grouped using semantic continuity and available temporal or session boundaries, and local spans around a selected turn. These are not LLM-written summaries.
Two additional access signals complement the structure: BM25 for exact lexical matches and BGE-M3 embeddings for semantic similarity. A precise date or title may need lexical matching; a paraphrased question may need a dense embedding.
2.2 Route the question, without turning off the other view
A lightweight query profile identifies the subject, keywords, expected answer type, temporal cues, and an admissible boundary when one is available. Deterministic signals prioritize either relational access or local access. A cross-document question benefits from the graph; a question about what happened immediately afterward benefits from the hierarchy.
Both views still run. Routing changes their weights rather than selecting one exclusive tool. The paper uses a shared primary-view weight ρ = 0.6: the primary view contributes 60%, the secondary 40%.
2.3 Graph retrieval: spread relevance, not invented facts
- Seed: align query entities to observed entities by dense similarity. Dense context matches provide priors, or a fallback if no entities are detected.
- Propagate: pass activation to other entities through shared sentences, weighted by how relevant those sentences are to the query.
- Diffuse: use personalized PageRank to spread scores over the graph. Context-node scores produce a retrieval ranking.
- Refine: lexical and phrase matches help recover exact names, values, dates, titles, and quoted expressions.
Imagine a random walker moving through the graph. With probability γ it follows an edge; otherwise it restarts at query-relevant nodes according to r. A context ranks highly when many relevant paths reach it. The reset distribution combines propagated entity activations and dense context priors. This diffusion does not establish that a retrieved statement is true; it makes a source worth inspecting.
2.4 Hierarchical retrieval: zoom in while retaining context
The hierarchy searches coarse to fine: episode → window → turn → local span. Semantic relevance is refined by subject consistency, temporal validity, scope consistency, answer type, and lexical support. A promising episode narrows the search; original turns expose the evidence; neighboring turns resolve dependencies such as pronouns and follow-up answers.
For example, retrieving “That is my preference now” without the preceding choice is not enough. A local span can preserve both the question and the answer even if only one turn contains the user’s name.
2.5 Fuse scores, then close gaps in the evidence
Graph scores and hierarchy scores live on different scales. Zero-Mem normalizes each view’s returned candidates to a 0–1 range before combining them. A candidate absent from a view gets zero in that view. If all returned scores in a view are equal, they receive one under the paper’s rule.
+ (1 − ρ) × normalized_secondary(d)
Top-ranked primary candidates form M(q). Evidence closure then adds bounded, query-conditioned support: graph-ranked relational bridges and local neighboring turns. Duplicates merge by unit ID or provenance. This is different from blindly retrieving more similar chunks: a bridge can have low direct similarity yet be necessary to connect the question to the answer.
2.6 Calibrate before and after reading
Before the LLM, hard filters remove candidates violating provenance or query-boundary constraints. Remaining candidates are ranked using subject, temporal, and answer-type compatibility; their original text is not rewritten.
After the LLM, the system checks answer forms that admit deterministic validation. It can normalize formatting, shorten an answer extractively, or prune unsupported list items. A scalar answer is replaced only if there is a unique type-compatible evidence-local candidate. If no deterministic correction is available, the initial answer is retained.
3. Interactive lab: connect, recover, and filter
Use a tiny history to inspect how two views select evidence. Try the employer question with K = 1, then switch closure off: the answer needs a bridge. Try the current preference question with calibration off: an obsolete preference becomes admissible. Try the transport question with K = 1 and closure on/off: the nearby pronoun-bearing answer matters.
Paper routing uses 60/40 in favor of the primary view. This slider directly controls graph share so you can inspect either extreme.
Inspect the rankings
| Trace | Graph norm. | Local norm. | Fused | Selection |
|---|
Scores are relative to this query, not confidence probabilities. Closure may add support beyond K; the toy caps support at two extra traces. Calibration filters after selection, so it may leave fewer than K.
Original source records
4. What did the evaluation actually show?
Setup: isolate the memory pipeline
The authors use two final readers: GPT-4o-mini and Qwen2.5-14B-Instruct. Within each setting, methods share the reader and an equivalent context budget. Experiments run in a common NVIDIA RTX 4090 environment. Main comparisons cap retrieved items at five; the budget analysis specifically defines K as primary candidates before closure. The efficiency experiment uses four concurrent threads.
LoCoMo tests long, multi-session conversational memory through single-hop, multi-hop, temporal, and open-domain questions. HotpotQA uses a curated memory-evaluation variant with gold supporting documents and distractor passages. More distractors increase input histories to 56K, 224K, and 448K tokens. Those are corpus-context settings, not the number of tokens necessarily passed to the final reader.
The baselines span direct reading, flat RAG, and structured memory systems. LONG-LLM reads sliding-window blocks independently and picks the highest-confidence candidate answer. RAG retrieves five semantically similar 2,048-token chunks. Memory baselines include A-Mem, Mem0, MemoryOS, LightMem, SimpleMem, CompassMem, and GAM; LoCoMo’s table also reports HippoRAG.
LoCoMo: better averages, not every individual cell
| Method | GPT-4o-mini F1 | GPT-4o-mini BLEU-1 | Qwen F1 | Qwen BLEU-1 |
|---|---|---|---|---|
| RAG | 44.73 | 39.40 | 38.27 | 33.01 |
| SimpleMem | 48.02 | 41.68 | 45.71 | 38.39 |
| CompassMem | 52.18 | 44.09 | 52.52 | 46.17 |
| GAM | 53.75 | 47.51 | 52.70 | 46.55 |
| Zero-Mem | 59.15 | 52.96 | 57.57 | 51.41 |
Selected rows from paper Table 1; all values are reported average scores.
With GPT-4o-mini, Zero-Mem beats GAM by 5.40 F1 points. This is about a 10.0% relative increase, not a ten-point gain. With Qwen, the gain is 4.87 points. Zero-Mem leads the GPT reader’s single-hop, temporal, and open-domain categories, but GAM slightly wins multi-hop F1: 42.29 versus 41.61. With Qwen, Zero-Mem leads every reported question-type metric.
HotpotQA: the advantage survives larger distractor sets
| Reader | Method | 56K F1 | 224K F1 | 448K F1 |
|---|---|---|---|---|
| GPT-4o-mini | GAM | 63.22 | 64.56 | 59.81 |
| GPT-4o-mini | Zero-Mem | 72.07 | 66.43 | 65.04 |
| Qwen2.5-14B | GAM | 64.07 | 55.99 | 57.87 |
| Qwen2.5-14B | Zero-Mem | 68.58 | 65.47 | 61.02 |
Zero-Mem has the highest F1 in each of the six reader/length settings in Table 3, with an average 5.52-point gain over GAM. Its own scores still decline as the context expands. “Handles long contexts” does not mean “unaffected by distractors.”
Efficiency: keep the accounting boundary visible
| Method | Memory LLM tokens/query | Memory time/query (s) | Total memory time (s) |
|---|---|---|---|
| SimpleMem | 9,153.41 | 5.43 | 8,365.38 |
| LightMem | 569.54 | 0.51 | 788.76 |
| GAM | 18,552.39 | 6.00 | 9,237.25 |
| Zero-Mem | 0 | 0.22 | 334.77 |
That comparison is against LightMem, the fastest compared memory baseline, while the quality improvement in the efficiency table is against GAM. The denominator is memory-operation time, excluding the shared final-QA stage. This does not establish a 57.6% reduction in end-to-end answer latency or total serving cost.
Ablations: which parts earn their place?
On HotpotQA 56K with GPT-4o-mini, removing components while keeping other settings fixed lowers performance:
The graph-only advantage over hierarchy-only fits HotpotQA’s cross-document task. But both are substantially worse than the full model: relational connections and local context are complementary here. Closure adds 4.17 F1 points relative to its removal; calibration adds 1.94. These are conditional ablation differences, not independent gains that can simply be added together. The reported BLEU-1 scores follow the same ordering: 69.66 full, 59.90 graph-only, 51.40 hierarchy-only, 65.43 without closure, and 66.45 without calibration.
Budget sensitivity: coverage helps, then saturates
On LoCoMo with GPT-4o-mini, increasing primary K from 1 to 5 raises F1 from 52.59 to 59.15 and BLEU-1 from 46.79 to 52.96. K = 10 is best on average, just 0.65 F1 and 0.83 BLEU-1 above K = 5. Larger budgets fluctuate only slightly. The paper chooses five for baseline comparability, not because five is a universal optimum.
Metric interpretation: F1 and BLEU-1 reward answer-token overlap with references. They are useful for short-answer QA, but are not direct measures of provenance completeness, general agent safety, or every form of semantic correctness.
5. What to trust—and what remains uncertain
The evidence supports a specific conclusion: non-generative structured retrieval can outperform the compared memory systems on these QA settings while eliminating memory-stage LLM calls. It does not establish that generated memory is never useful.
Supported by the experiments
- Two different readers benefit from the same memory design.
- The advantage appears in both multi-session conversational recall and document-based multi-hop QA.
- Single-view ablations support combining the structures.
- Measured non-generative processing is faster than the compared generative memory pipelines in the controlled setup.
Limits and engineering questions
- Retrieval is not truth verification. Original traces may be mistaken, malicious, or stale. Provenance tells you where a claim came from, not whether it is correct.
- Entity ambiguity remains. NER and similarity alignment can miss aliases or confuse two people with the same name. The paper does not establish universal identity resolution.
- Co-occurrence is weaker than semantics. A mention graph can retrieve a useful sentence without encoding who did what to whom.
- Deterministic checks have limited coverage. If no safe correction is available, the reader’s initial answer remains.
Reproducibility and scope
The paper gives its main architecture, encoder choices, two global weights, comparison settings, and component results. However, it promises code and implementation details after peer review, rather than demonstrating their availability in the document. The exact query-profile rules, episode segmentation thresholds, support bounds, and compatibility logic are not fully specified in the provided method. A faithful implementation needs those details; the lab above deliberately does not pretend to supply them.
The reported tables provide point estimates, without uncertainty intervals in the presented results. The efficiency table reports aggregate memory-operation overhead, not a component-by-component breakdown of build cost, online latency, and amortization. The study also does not establish production-scale storage requirements or performance under deletion, privacy isolation, malicious history, or continuous streaming updates.
6. A minimal prototype you can reason about
The prototype’s essential data model can be small. Keep source records immutable; build views that reference their identifiers rather than duplicating rewritten facts. The following is architectural pseudocode, not the paper’s implementation. The working lab implements simplified versions of the same flow.
records = [{ id, original_text, subject, time, session, boundary }]
# Offline / incremental indexing; no generative memory statements
G = mention_graph(records, ner_model) # entity ↔ context
T = temporal_units(records) # episode / window / turn
L = lexical_index(records)
D = embedding_index(records, encoder)
function memory(query):
profile = deterministic_profile(query, metadata)
graph_rank = graph_retrieve(G, L, D, profile)
local_rank = coarse_to_fine(T, L, D, profile)
primary, secondary = route(profile, graph_rank, local_rank)
fused = 0.6 * normalize(primary) + 0.4 * normalize(secondary)
main = top_k(fused, 5)
support = bounded_bridges(G, main, profile)
+ bounded_neighbors(T, main, profile)
evidence = dedup_by_source(main + support)
return rank_compatible(filter_hard_constraints(evidence, profile))
R = memory(query)
a0 = reader_llm(query, original_texts_with_provenance(R))
a = deterministic_answer_checks(a0, R, expected_type(query))Three invariants worth testing
- Traceability: every supplied evidence span resolves to an original source record. Nothing becomes a source fact merely because a model phrased it confidently.
- Scope: no evidence outside the query’s admissible user/session boundary enters the reader context.
- Budget: closure is bounded and deduplicated. More connectivity must not imply unbounded context growth.
To evaluate your version, measure answer quality and memory costs separately from final-reader costs. Add cases requiring bridges, local context, temporal updates, duplicate names, and out-of-scope distractors. Log both the primary selections and closure additions so failures can be diagnosed as missed anchors, missing support, bad filtering, or reader mistakes.
7. Takeaway
Zero-Mem’s strongest idea is a separation of responsibilities: the memory layer locates faithful evidence; the reader interprets it. A mention graph finds connections, a temporal hierarchy restores context, and deterministic rules keep selection within known constraints. Structure helps without becoming a second generated version of the past.
Brief platform note: For a context platform, this suggests keeping provenance-bearing raw records separate from derived retrieval views. An entity–context graph is useful infrastructure, but should not be mistaken for an ontology of verified domain relations.
Source: Zero-Mem: Zero-Token Memory Operations for LLM Agents, Yilin Xiao et al. Full text · PDF.
Method explanations draw on the paper’s memory-substrate, routing, retrieval, closure, and calibration sections. Results use Tables 1–3 and the ablation and retrieval-budget discussions. All toy records, visual diagrams, and simulation rules in this report are teaching examples; limitations marked as engineering questions are analysis rather than additional paper findings.