All notable changes to MemoryLens are documented here. Format follows Keep a Changelog.
- PyPI-ready packaging — published as
memorylens-bench(the barememorylensname was already taken on PyPI by an unrelated project); the import namespace and CLI remainmemorylens. All code now lives under a singlememorylenspackage (memorylens.memory,memorylens.simulator,memorylens.evaluation,memorylens.utils). Fixed an invalidbuild-backendthat made the sdist unbuildable, added thememorylensconsole command (memorylens.cli:main), and split dependencies into a lean core plus[dashboard],[server],[faiss],[groq],[openai],[anthropic],[all],[dev]extras.python main.pystill works. - GraphMemory (
graph) — NetworkX knowledge-graph backend; fact updates replace edges in place so stale values cannot survive (#20) - FAISSMemory (
faiss) — FAISSIndexFlatIPvector backend as an optional extra (#14) - contradiction_score — flags contexts that surface both the old and new value of an updated fact; wired into checkpoints, CSV logs, and the dashboard (#21)
- Scenario framework —
Scenariodataclass + registry (#22) with three domain scenarios:edtech(#18),support(#23),medical(#24);--scenarioand--list-scenariosCLI flags - FastAPI server —
uvicorn memorylens.api:app; job-based POST/v1/benchmarks, GET/v1/backends,/v1/scenarios,/health(#25) - Dashboard Run History tab — overlay Recall@T curves from past
experiment_logs/runs and compare final metrics side-by-side (#27) - SQLite persistent storage (
memorylens/utils/storage.py) — queryable database alongside the JSON/CSV logs;log_run()writes to it,list_runs()queries it first,Storage.compare_runs()compares recall across runs, andpython -m memorylens.utils.migrate_legacy_logsimports legacy JSON logs (#26, contributed by @Sugaria0427) - 23 new integration tests (45 total): GraphMemory, contradiction_score, scenarios, FAISS, API lifecycle, SQLite storage, and cascading regressions (#31)
- CI matrix expanded to Python 3.10–3.13 on Linux plus Windows and macOS, with a
package build +
twine check+ wheel-install job (#30)
- Cascading cold-tier recall regression — the newest-first cold-summary merge introduced with the drift fix truncated away the oldest fact summaries, collapsing cascading recall at T=100 from ~75% to ~8%. Merging is oldest-first again (stale values are already rewritten in place by the update patcher) and empty "No key facts." summaries are no longer appended to the cold tier. Regression tests added.
- Experiment CSV logger crashed on every run since the
has_llm_evalflag was added (a bool was indexed as a dict); it now skips non-backend keys and rotates the CSV when the metric schema changes - Benchmark results in the README were stale and did not reproduce; all tables are regenerated from the current code
- Dead references to an unpublished research paper (
paper/memorylens_paper.mdnever existed in the repository); unverifiable "the only framework" marketing claims; fabricated ₹-cost projections in the dashboard (replaced with a clearly labelled illustrative $-projection)
Three research-quality gaps identified and documented across README, docs/, and ROADMAP:
-
±0.0% std for structure-deterministic backends — Naive and Cascading produce std=0% across 5 personas because they make eviction/decay decisions based on position and elapsed time, not content values. All personas share identical injection timing, so results are structurally identical. Chunked RAG shows real variance (±3.8%) because cosine similarity scoring is content-dependent. Documented with explanation in README results tables. Fix tracked in ROADMAP as "varied persona injection timing."
-
SummaryMemory 100% recall is extractive-mode behavior — In zero-API-key mode, SummaryMemory keeps fact-bearing messages verbatim (selective full history, not true compression). 100% recall is therefore expected and not a performance claim. With real LLM compression (any API key), abstractive paraphrasing can cause substring-match failures. Tables and callouts updated to label these results as "(extractive mode)."
-
Temporal Drift is a retrieval-layer proxy —
temporal_drift_scorecounts stale value appearances in retrieved context, which overestimates actual stale-answer rates (an LLM given both old and new values often resolves to the correct one). Clarified as a worst-case upper bound.llm_temporal_drift(LLM mode) is the behavioral measurement. Both the README metric table anddocs/why-memory-evaluation-matters.mdupdated accordingly.
Fix 1 — Multi-seed statistical validation
simulator/personas.py: 5 demographically diverse personas (Arjun Sharma, Sofia Reyes, Wei Zhang, Amara Osei, Lars Eriksson) for cross-population result validationevaluation/stats.py:aggregate_metric()+aggregate_checkpoint_series()with mean, std, and 95% confidence intervals (t-distribution)evaluation/benchmark.py:run_benchmark_multi_seed()— runs N personas and returns aggregated stats- CLI:
--seeds Nflag reportsmean ± stdacross N personas instead of single-run results
Fix 2 — Scientifically-grounded decay formula with ablation
memory/decay.py: 4 pluggable temporal decay functions with academic references:ebbinghaus(default) — Ebbinghaus (1885) forgetting curve:e^{-t/sqrt(1+t)}exponential— Jost (1897):e^{-k*t/window}linear— Wickelgren (1972) baseline:1 - t/windowdefault— original heuristic preserved for backwards compat
CascadingTemporalMemorynow accepts adecayparameter; defaults toebbinghaus- CLI:
--decay ebbinghaus|exponential|linear|default - Ablation result: Ebbinghaus achieves 5.67× cascade efficiency vs 5.45× for original heuristic
Fix 3 — Bounded Chunked RAG (realistic production simulation)
memory/rag_chunked.py:ChunkedRAGMemorywith overlapping 120-char chunks and FIFO eviction atmax_chunks=200- Models real production RAG: chunk splitting reduces retrieval certainty; bounded index causes early-fact eviction
- Shows realistic 85–87% recall at T=100 vs ideal RAG's 100% — contrast is the key finding
- Registered as
rag_chunkedbackend in benchmark runner and CLI
Fix 4 — Research paper (never merged into the repository; stale references to it were removed in 0.4.0)
Tests: 10 new tests covering decay functions, ChunkedRAGMemory, stats aggregation, and persona pool structure (24 total, all passing)
utils/providers.py— unified LLM abstraction layer supporting 5 providers:- Groq (
GROQ_API_KEY) — free tier, llama-3.1-8b-instant - OpenAI (
OPENAI_API_KEY) — gpt-4o-mini - Anthropic (
ANTHROPIC_API_KEY) — claude-haiku-4-5 - OpenRouter (
OPENROUTER_API_KEY) — 200+ models via one key - Ollama (local, no key) — any locally running model
- Auto-detection priority: Groq → OpenAI → Anthropic → OpenRouter → Ollama
- Groq (
- Two-stage LLM evaluation pipeline in
evaluation/metrics.py:llm_recall_at_t()— LLM answers the query; a judge LLM call verifies correctnessllm_temporal_drift()— checks if LLM returns old vs new value after a fact update
- CLI flags in
main.py:--llm— enable real LLM evaluation pass--provider <name>— force a specific provider--list-providers— print availability of all providers and exit
- Three-table CLI output: Content Recall, LLM Recall, and Gap (Content − LLM)
- Dashboard updates:
- Provider selector in sidebar (auto-detects available providers)
- Tabbed recall chart: Content Recall / LLM Recall / Gap
- KPI cards show LLM Recall with gap delta when available
summarybackend added to backend multiselect
- Updated
.env.examplewith all five provider keys and inline documentation
memory/summary.py: SummaryMemory backend — rolling compression memory with dual-mode support:- LLM mode (when
GROQ_API_KEYis set): Groq-powered abstractive summarisation - Extractive fallback (zero API cost): regex-based fact-pattern extraction
- LLM mode (when
- 6 new tests in
tests/test_pipeline.pycovering SummaryMemory: recall, compression, context structure, reset, token cost, and benchmark registration SummaryMemoryregistered as"summary"inevaluation/benchmark.py
| Backend | Recall@100 | Tokens/Query |
|---|---|---|
| SummaryMemory | 100% | 318 |
cascade_efficiencymetric: recall-per-token ratio of Cascading vs Naive (5.45× at T=100)quick_demo.py: full benchmark run requiring zero API keys — uses local embeddings onlyevaluation/llm_judge.py: optional Groq-powered LLM-as-judge for answer quality scoringevaluation/logger.py: persist every benchmark run toexperiment_logs/as JSON + CSV- GitHub Actions CI workflow — tests on Python 3.10 and 3.11
- Cascading cold-tier recall: now surfaces all cold summaries instead of only the last two
- CI
IndentationError: replaced inlinepython -cwith proper test scripts
- Naive memory context budget tightened to 1,200 tokens to expose realistic decay
- Demo results updated with empirically validated numbers from live benchmark runs
- Initial framework with three memory backends: Naive, RAG, Cascading Temporal
- Five evaluation metrics: Recall@T, Precision@K, Temporal Drift, Memory Noise Ratio, Cascade Efficiency
- Streamlit dashboard with demo data and live benchmark mode
- CLI runner (
main.py) with JSON and LaTeX export - Synthetic conversation simulator with 8 tracked facts and update events
sentence-transformers(all-MiniLM-L6-v2) for local, free embeddings- Groq integration (llama-3.1-8b-instant) for LLM evaluation mode