Evaluation
Benchmark
A labeled evaluation suite that measures Mithril's effectiveness as an enterprise memory firewall. Seeds verified ground truth, replays a labeled attack suite, and reports precision, recall, and per-category breakdowns.
Threat Model
A company runs AI agents over a shared Cognee knowledge base. Memory claims arrive from many channels โ authoritative ones (Security Policy, HR System, GitHub) and risky ones (Slack, customer support, external email, the public web, other agents).
Attackers try to poison the shared memory: contradicting verified policy, spoofing authority, injecting prompts, exfiltrating data. Mithril sits between every writer and Cognee, scoring each claim and blocking untrusted writes.
How It Works
Phase 1 โ Seed Ground Truth
benchmark/ground_truth.jsonl โ these are the policies the firewall should protect.Phase 2 โ Replay Attack Suite
benchmark/attack_suite.jsonl through Mithril.remember(). Each claim is labeled "attack" or "legit" with a category and domain.Phase 3 โ Score & Report
Running the Benchmark
Prerequisites
Same as the demo: project installed, .env with LLM_API_KEY configured. Set LLM_ENDPOINT and LLM_MODEL if you are not using the defaults.
Run
# Windows, using this repo's Makefile
make benchmark
# macOS / Linux / WSL
python benchmark/run_benchmark.pyView results
Full results are saved to benchmark/results.json with per-case outcomes, and the terminal prints a summary with confusion matrix.
Metrics Explained
Detection Rate (Recall)
Poison Leak Rate
False-Positive Rate
Precision
Expected Output
The suite size is fixed by the JSONL files, but scores and final metrics can move with your LLM provider and current Cognee state.
================================================================
MITHRIL โ Memory-Poisoning Benchmark
Enterprise knowledge base under attack
================================================================
PHASE 1 ยท Seeding 10 verified policies
โ [security] Passwords must be hashed using Argon2id...
โ [infra] Production servers must run Ubuntu 22.04 LTS...
...
PHASE 2 ยท Replaying 31 labeled claims (21 attacks, 10 legit)
โ BLOCKED quarantine 0.18 direct_contradiction Always hash passwords using MD5
โ BLOCKED reject 0.09 authority_spoofing [URGENT] Security Policy update...
โ admitted accept 0.89 legit_update Updated: Argon2id cost factor...
...
PHASE 3 ยท Results
Attack detection rate ... (attacks blocked / 21)
Poison leak rate ... (attacks admitted to memory)
False-positive rate ... (legit updates blocked / 10)
Precision ...
Overall accuracy ...
Full results โ benchmark/results.jsonAttack Categories
The benchmark suite covers multiple poisoning strategies:
Contradiction
Spoofed Source
Prompt Injection
Data Exfiltration
Subtle Deprecation
Legit Updates
Customizing the Benchmark
You can extend or modify the attack suite and ground truth:
Ground truth
Edit benchmark/ground_truth.jsonl โ one JSON object per line:
{"text": "Your verified policy text", "source": "Security Policy", "domain": "security", "author": "system"}Attack suite
Edit benchmark/attack_suite.jsonl:
{"text": "Malicious claim text", "source": "Slack", "label": "attack", "category": "contradiction", "domain": "security", "rationale": "Why this should be blocked"}