Skip to content

research(memory): fact-based memory vs long-context — empirical crossover formula, cost model (arXiv:2603.04814) #2288

@bug-ops

Description

@bug-ops

Finding

Paper: "Beyond the Context Window: A Cost-Performance Analysis of Fact-Based Memory vs. Long-Context LLMs for Persistent Agents"
arXiv: https://arxiv.org/abs/2603.04814 (March 2026)

Core Idea

Empirically compares structured fact-extraction memory (Mem0-style SQLite/vector store) against full-history long-context inference on three persistence benchmarks (LongMemEval, LoCoMo, PersonaMemv2):

  • Long-context wins on recall accuracy at short histories
  • Fact-based memory wins dramatically on cost at scale
  • Provides a crossover formula: at what message count does each approach dominate

Applicability to Zeph (5/5)

Zeph already implements exactly this tradeoff (SQLite episodic + Qdrant semantic vs. full context). The paper's crossover formula directly justifies Zeph's memory-first design and could inform:

  1. A configurable field in — uses the crossover formula to pick at runtime
  2. Cost tracking already in Zeph can be extended with a running cost-per-turn estimate to trigger memory-first mode when cost threshold is hit
  3. Validates the compaction + semantic retrieval pipeline as cost-optimal for long sessions

Implementation Sketch

In : add a strategy selector that queries current turn count + cost metrics, switches from full-history to memory-retrieval-first assembly when the crossover threshold is exceeded.

Metadata

Metadata

Assignees

Labels

P2High value, medium complexitymemoryzeph-memory crate (SQLite)researchResearch-driven improvement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions