Learnable memory consolidation for LLM agents, inspired by how the brain works.
Current agent memory systems either compress memories (but never learn) or learn associations (but never compress). NeuroMem does both — and uses what it learns to decide what to consolidate.
I studied eight agent memory systems and found a gap no one has filled:
| System | Compresses? | Learns? | Typed Relations? | Learnable Consolidation? |
|---|---|---|---|---|
| SimpleMem | Yes | No | No | Claimed, not in code |
| Shodh | Yes (LZ4/semantic) | Yes (Hebbian) | Yes (17+ types) | No |
| Mem0 | No | No | Yes (LLM triples) | No |
| Graphiti/Zep | Summaries only | No | Yes (temporal) | No |
| Memobase | No | No | No (profiles) | No |
| Letta | No | No | No | No |
| OpenViking | No | No | No | No |
| ProMem | No | No | No | No |
Shodh comes closest — it has Hebbian learning, typed relations, and compression — but it's designed for edge/offline use with no LLM in the loop (TinyBERT NER, local ONNX embeddings). Its consolidation is age-based, not informed by learned co-retrieval patterns. NeuroMem brings Shodh's cognitive algorithms into an LLM-powered pipeline with richer extraction and learnable consolidation.
Memories that are frequently retrieved together should be consolidated together.
This mirrors human sleep consolidation: the brain replays and merges related memories during rest. NeuroMem does this programmatically:
┌─────────────┐
Conversations ──▶ │ 1. WRITE │ Extract atomic facts (SimpleMem-style)
│ │ Resolve coreferences, normalize time
└──────┬──────┘
▼
┌─────────────┐
Every retrieval ──▶ │ 2. LEARN │ Strengthen Hebbian edges between
│ │ co-retrieved memories (Shodh-style)
└──────┬──────┘
▼
┌─────────────┐
Periodically ───▶ │3. CONSOLIDATE│ Cluster by learned weights ★
│ (novel) │ LLM-summarize → merge → compress
└──────┬──────┘
▼
┌─────────────┐
Queries ────────▶ │ 4. RETRIEVE │ 4-path hybrid search
│ │ Semantic + Graph + Lexical + Symbolic
└─────────────┘
Stage 3 is the contribution — using Hebbian learning to inform consolidation. No existing system does this.
When memories A and B are retrieved together, their shared edge gets stronger:
# On every co-retrieval
boost = 0.1 * (1.0 - edge.strength) # Diminishing returns
edge.strength += boost
# After 10 co-retrievals → Long-Term Potentiation (permanent)
if edge.activation_count >= 10:
edge.potentiated = True
edge.strength += 0.2 # One-time LTP bonusOnce edges are strong enough (strength > 0.7, potentiated = True), those memories become consolidation candidates. An LLM summarizes the cluster into a single node that inherits all edges.
Quality is measured with three novel metrics:
- RPR (Retrieval Preservation Rate) — can you still find the consolidated memory for the same queries? Target: > 95%
- IRS (Information Retention Score) — is the meaning preserved? Target: > 90%
- TER (Token Efficiency Ratio) — how much did we compress? Target: > 3x
| Benchmark | Best Existing | Our Target | What It Tests |
|---|---|---|---|
| LoCoMo-10 | 43.2% F1 (SimpleMem) | 50%+ | Multi-session QA over long conversations |
| LongMemEval | 71.2% (Graphiti) | 75%+ | Long-term memory retrieval (115k tokens) |
Ablation studies will isolate the contribution of each component (Hebbian learning, consolidation, extraction quality).
neuromem/
├── memory/
│ ├── main.py # Core memory system (~2400 lines)
│ ├── entities.py # Entity types, extraction, resolution
│ ├── entity_resolution.py # 2-pass resolution (MinHash+LSH → LLM)
│ ├── profiles.py # Memobase-inspired profile building
│ └── utils.py # Extraction utilities
├── graphs/
│ ├── hebbian.py # HebbianEdgeManager, LTP, decay
│ └── tools.py # Neo4j graph operations
├── configs/
│ └── prompts.py # All LLM prompts
└── ... # Vector stores, LLMs, rerankers (from Mem0 base)
Built on Mem0 as a foundation — we extend their LLM/vector/graph infrastructure and add Hebbian learning, better extraction, and consolidation on top.
- Stage 1: Write — Atomic fact extraction, coreference resolution, temporal normalization, entity extraction + resolution, relationship extraction, entity profiles, Hebbian edge initialization
- Stage 2: Learn — Hebbian strengthening on retrieval, LTP mechanism
- Stage 3: Consolidate — Cluster detection, LLM summarization, quality metrics (in progress)
- Stage 4: Benchmark — LoCoMo, LongMemEval, ablation studies
See docs/roadmap.md for detailed progress.
This started with a deep comparative analysis of 8 memory systems. I read the papers and the code for each. Key findings:
- SimpleMem's "consolidation" doesn't exist in code — the paper describes atomic → molecular → abstract compression, but
main.py:22says "future work" - Shodh has the best cognitive model but no LLM — Hebbian learning, typed relations, compression, all running on-device (TinyBERT NER, ONNX embeddings). Consolidation is age-based, not learning-informed
- Mem0 has typed relation edges but no learning — 22 vector store backends, mature eval framework, but memories are static after ingestion
- Memobase is the LoCoMo SOTA (75.78%) — profile-based organization with batch processing. We adopt their BUILD/MERGE pattern
- ProMem catches hallucinations — self-questioning verification gets 73.80% memory integrity on HaluMem. We adopt the verification concept
Full landscape analysis: docs/research/landscape.md
Individual deep dives: SimpleMem | Shodh | Mem0 | Graphiti | Letta | Memobase | OpenViking | ProMem
Architecture: docs/architecture.md
Python 3.11+ · Mem0 (base) · GPT-4o (extraction) · text-embedding-3-large · Qdrant · Neo4j
- SimpleMem — arXiv:2601.02553 (Jan 2026)
- Graphiti/Zep — arXiv:2501.13956 (Jan 2025)
- Shodh-Memory — github.com/varun29ankuS/shodh-memory
- Mem0 — github.com/mem0ai/mem0
Ongoing research by Parth Modi