# BrainCore Memory Benchmark (MVP) A lightweight, extensible harness for evaluating long-term memory systems in LLM-based agents. **Status:** MVP — not a SOTA leaderboard. Intended for rapid iteration and community extension. ## Goals 1. **Retrieval accuracy** — Can the memory system recall the right fact when queried? 2. **Temporal consistency** — Does it respect the order and timing of events? 3. **Contradiction handling** — Can it resolve or flag updated / retracted facts? 4. **Cost & latency** — How expensive (time + storage) is the memory layer? ## Non-Goals - We do *not* claim these tasks are exhaustive. - We do *not* provide a SOTA ranking. - We do *not* cover multi-modal or external-tool memory yet. ## Repo Structure ``` braincore-memory-benchmark/ ├── README.md ├── requirements.txt ├── data/ │ └── synthetic_benchmark.jsonl # 100 public-safe synthetic examples ├── src/ │ ├── metrics.py # Scoring primitives │ ├── baseline_adapter.py # Keyword-based baseline │ └── evaluator.py # Main harness ├── results/ │ └── results_template.md # Copy this to report your run ``` ## Quick Start ```bash pip install -r requirements.txt python src/evaluator.py --adapter src.baseline_adapter --dataset data/synthetic_benchmark.jsonl --output results/my_run.json ``` ## Extending the Harness We designed the JSONL schema and adapter interface so future datasets (LongMemEval, LoCoMo, MemoryAgentBench, AMA-Bench) can be dropped in with minimal changes. ### Adapter Interface Your adapter must expose: ```python class MemoryAdapter: def ingest(self, raw_memories: list[dict]) -> None: """Store a batch of memory items.""" ... def retrieve(self, query: str, top_k: int = 1) -> list[dict]: """Return ranked memory items for a query.""" ... def storage_bytes(self) -> int: """Report current on-disk / in-memory footprint.""" ... ``` The evaluator calls `ingest` once per session, then `retrieve` per test case. ## Dataset Schema (synthetic_benchmark.jsonl) Each line is a JSON object with: | Field | Type | Description | |---|---|---| | `session_id` | str | Group of memories belonging to one synthetic agent session | | `memories` | list[dict] | Chronological facts / events | | `queries` | list[dict] | Questions asked *after* all memories are ingested | Query dict: | Field | Type | Description | |---|---|---| | `query_id` | str | Unique ID | | `query_text` | str | Natural-language question | | `expected_answer` | str | Ground-truth answer | | `query_type` | str | `retrieval` \| `temporal` \| `contradiction` | | `required_memory_ids` | list[str] | Which memory item(s) must be used | ## Metrics | Metric | Description | |---|---| | `exact_match` | Case-insensitive, stripped string equality | | `semantic_placeholder_score` | Cosine similarity of sentence embeddings (fallback) | | `temporal_order_score` | Fraction of temporal queries where returned memories are in correct time order | | `contradiction_resolution_score` | Fraction of contradiction queries where the *latest* (revised) fact is returned | | `latency_ms` | Mean wall-clock time for `retrieve()` | | `storage_bytes` | Bytes reported by `adapter.storage_bytes()` | ## License Synthetic data and code are released under the MIT license. ## Part of BrainCore Collective This asset is part of [BrainCore Collective](https://huggingface.co/collections/trentdoney/braincore-collective-69fc0e10898b8f9c84064fdf), a public Hugging Face collection of datasets, starter kits, and Spaces for practical agent memory, AI operations, and media automation workflows. - [Agent Memory Research Corpus](https://huggingface.co/datasets/trentdoney/agent-memory-research-corpus) — Canonical corpus for agent-memory papers, systems, benchmarks, and implementation patterns. - [Memory Explorer Space](https://huggingface.co/spaces/trentdoney/memory-explorer-space) — Interactive browser for the agent-memory research corpus. - [BrainCore Memory Benchmark](https://huggingface.co/datasets/trentdoney/braincore-memory-benchmark) — Synthetic benchmark for retrieval, temporal consistency, contradiction handling, latency, and storage cost. - [BrainCore pgvector Starter](https://huggingface.co/spaces/trentdoney/braincore-pgvector-starter) — Postgres/pgvector memory starter with a runnable Gradio landing page and FastAPI code. - [LoRA Caption Quality Checker](https://huggingface.co/spaces/trentdoney/lora-caption-quality-checker) — CPU-only Gradio utility for checking LoRA caption dataset quality before training.