trentdoney's picture
Link asset to BrainCore Collective collection
c90c41e verified

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

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:

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, a public Hugging Face collection of datasets, starter kits, and Spaces for practical agent memory, AI operations, and media automation workflows.