Skip to content

Commit 33599b0

Browse files
Add evidence-backed README examples
1 parent dabc74a commit 33599b0

6 files changed

Lines changed: 139 additions & 11 deletions

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ that supports the current question; and returns a bounded, attributable context
3131
| Avoid dragging the whole project into every prompt | Packs context to a configured hard budget and can return a compact MCP response. |
3232
| Keep knowledge in the operator's control | Runs local-first and offline-capable, with scopes, audit records, and optional privacy-safe receipts. |
3333

34+
### See the behavior in reproducible fixtures
35+
36+
The examples below use synthetic, checked-in evaluation inputs. They show three different
37+
contracts: retrieving focused evidence, returning an answer only with support, and explicitly
38+
abstaining when no support exists.
39+
40+
<p align="center">
41+
<img src="docs/images/evidence-backed-agent-examples.png" alt="Three evidence-backed examples: focused context holds Recall at 5 while reducing retrieved tokens, answerable questions return supported evidence, and off-topic questions abstain" width="100%">
42+
<br>
43+
<sup>Each card names its deterministic offline fixture and test scope. The examples are illustrative; they are not customer data or external benchmark results.</sup>
44+
</p>
45+
46+
Run `python -m eval.chunking_eval` and `python -m eval.grounded` to reproduce the behavior;
47+
the former measures evidence retrieval and context size, while the latter measures the
48+
answer-versus-abstain decision.
49+
3450
The diagram is the essential path. The sections below cover the dashboard, code graph, local
3551
installation, governance controls, and hosted services in detail. See [measured quality and token
3652
efficiency](#measured-quality-and-token-efficiency) for the current reproducible evidence behind
@@ -226,17 +242,17 @@ The current deterministic offline regression fixtures reproduce these quality re
226242

227243
### Proof at a glance
228244

229-
| **72.9% less retrieved context** | **3.8× smaller evidence record** | **55.38% smaller MCP response** |
245+
| **73.0% less retrieved context** | **3.8× smaller evidence record** | **55.38% smaller MCP response** |
230246
|---|---|
231-
| **808.8 → 219.0** tokens per question | **162.2 → 42.4** tokens to supporting evidence | **17,172 → 7,663** serialized tokens |
247+
| **808.8 → 218.4** tokens per question | **162.2 → 42.4** tokens to supporting evidence | **17,172 → 7,663** serialized tokens |
232248
| Same Recall@5 **1.000** in the long-document fixture | Same 18 fixture questions returned an evidence-holding memory | Same CodeMem retrieval scores across 260 timed recalls |
233249

234250
Agents spend less of their context window carrying irrelevant history, leaving more room for the
235251
current task and cited evidence. These are controlled, deterministic fixtures—not model-billing,
236252
task-time, or external benchmark claims.
237253

238254
<p align="center">
239-
<img src="docs/images/context-efficiency.png" alt="Normalized chart: Engraphis retains 27.1 percent of retrieved content, 26.1 percent of the evidence-holding record, and 44.6 percent of the compact MCP response in separate controlled fixtures" width="100%">
255+
<img src="docs/images/context-efficiency.png" alt="Normalized chart: Engraphis retains 27.0 percent of retrieved content, 26.1 percent of the evidence-holding record, and 44.6 percent of the compact MCP response in separate controlled fixtures" width="100%">
240256
<br>
241257
<sup>Each row uses a separate 100% baseline. The measurements have different counting boundaries and are not additive.</sup>
242258
</p>
@@ -246,9 +262,9 @@ task-time, or external benchmark claims.
246262
| Retrieval mode | Mean returned memory content | Recall@5 |
247263
|---|---:|---:|
248264
| Whole documents | 808.8 tokens | 1.000 |
249-
| Engraphis structure-aware chunks | 219.0 tokens | 1.000 |
265+
| Engraphis structure-aware chunks | 218.4 tokens | 1.000 |
250266

251-
The chunked mode returns the relevant passage instead of the whole document: **589.8 fewer tokens
267+
The chunked mode returns the relevant passage instead of the whole document: **590.4 fewer tokens
252268
per question**. Under the same model-context budget, that leaves roughly **590 tokens** for task
253269
instructions or other relevant evidence.
254270

@@ -259,7 +275,7 @@ boundary.
259275

260276
| What is counted | Comparison | Measured reduction | Quality held constant |
261277
|---|---|---|---|
262-
| Retrieved top-5 memory content, averaged per question | Whole documents: **808.8** tokens → structure-aware chunks: **219.0** tokens | **589.8 fewer tokens per question** (**72.9% lower**, about **3.7× smaller**) | Recall@5 **1.000** in both modes across 6 documents and 18 questions |
278+
| Retrieved top-5 memory content, averaged per question | Whole documents: **808.8** tokens → structure-aware chunks: **218.4** tokens | **590.4 fewer tokens per question** (**73.0% lower**, about **3.7× smaller**) | Recall@5 **1.000** in both modes across 6 documents and 18 questions |
263279
| Smallest returned memory that contains the reference evidence | Whole documents: **162.2** tokens → chunks: **42.4** tokens | **119.8 fewer tokens to evidence** (**73.9% lower**, about **3.8× smaller**) | The same 18 questions had a returned evidence-holding memory in both modes |
264280
| Serialized MCP recall response across 260 timed CodeMem recalls | Full result: **17,172** `engraphis.regex.v1` tokens → compact result: **7,663** tokens | **9,509 response tokens avoided** (**55.38% lower**) | Recall@5, hit@5, and answer-token recall all **1.000** |
265281
| Packed prompt-context usage in the same CodeMem performance fixture | Hard budget: **1,500** tokens; observed mean: **87.73**; observed maximum: **106** | A hard cap prevents a recall from exceeding its configured context budget | This is usage accounting, not a before/after savings comparison |

docs/images/context-efficiency.png

-201 Bytes
Loading

docs/images/context-efficiency.svg

Lines changed: 2 additions & 2 deletions
Loading
283 KB
Loading
Lines changed: 79 additions & 0 deletions
Loading

tests/test_benchmark_evidence.py

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pytest
66

77
from eval import metrics
8+
from eval import grounded as grounded_eval
89
from eval.benchmark import (
910
SCHEMA,
1011
CANONICAL_TOKEN_BUDGETS,
@@ -20,6 +21,7 @@
2021
validate_report,
2122
write_canonical_artifact,
2223
)
24+
from eval.chunking_eval import compare as compare_chunking, load as load_chunking
2325

2426

2527
ROOT = Path(__file__).resolve().parents[1]
@@ -36,12 +38,12 @@ def test_readme_distinguishes_every_current_token_context_measurement():
3638

3739
for evidence in (
3840
"### Proof at a glance",
39-
"72.9% less retrieved context",
41+
"73.0% less retrieved context",
4042
"3.8× smaller evidence record",
4143
"55.38% smaller MCP response",
4244
"### Measurement details and reproducibility",
43-
"808.8** tokens → structure-aware chunks: **219.0** tokens",
44-
"72.9% lower",
45+
"808.8** tokens → structure-aware chunks: **218.4** tokens",
46+
"73.0% lower",
4547
"162.2** tokens → chunks: **42.4** tokens",
4648
"73.9% lower",
4749
"17,172** `engraphis.regex.v1` tokens → compact result: **7,663** tokens",
@@ -64,6 +66,9 @@ def test_readme_makes_agent_benefits_and_visual_evidence_scannable():
6466
"Avoid dragging the whole project into every prompt",
6567
"docs/images/engraphis-benefit-flow.png",
6668
"docs/images/context-efficiency.png",
69+
"### See the behavior in reproducible fixtures",
70+
"docs/images/evidence-backed-agent-examples.png",
71+
"Run `python -m eval.chunking_eval` and `python -m eval.grounded`",
6772
"Each row uses a separate 100% baseline",
6873
):
6974
assert evidence in readme
@@ -73,10 +78,38 @@ def test_readme_makes_agent_benefits_and_visual_evidence_scannable():
7378
"engraphis-benefit-flow.png",
7479
"context-efficiency.svg",
7580
"context-efficiency.png",
81+
"evidence-backed-agent-examples.svg",
82+
"evidence-backed-agent-examples.png",
7683
):
7784
assert (ROOT / "docs" / "images" / filename).is_file()
7885

7986

87+
def test_example_visual_uses_the_checked_in_offline_fixture_results():
88+
"""The new examples must not drift away from the commands readers can run."""
89+
longdoc = ROOT / "eval" / "datasets" / "longdoc.jsonl"
90+
chunking = compare_chunking(load_chunking(str(longdoc)), k=5, embed_model=None)
91+
whole = chunking["reports"]["whole"]
92+
chunked = chunking["reports"]["chunked"]
93+
grounded = grounded_eval.run()
94+
visual = (ROOT / "docs" / "images" / "evidence-backed-agent-examples.svg").read_text(
95+
encoding="utf-8"
96+
)
97+
98+
assert chunking["context_reduction_pct"] == 73.0
99+
assert f"{whole['mean_context_tokens']:.1f}{chunked['mean_context_tokens']:.1f} tokens" in visual
100+
assert grounded == {
101+
"answer_rate": 1.0,
102+
"abstain_rate": 1.0,
103+
"accuracy": 1.0,
104+
"grounded_hits": 5,
105+
"abstain_hits": 5,
106+
"n_answerable": 5,
107+
"n_unanswerable": 5,
108+
}
109+
assert "5/5 answerable questions grounded" in visual
110+
assert "5/5 off-topic questions abstained" in visual
111+
112+
80113
def _complete_canonical_report(dataset, config):
81114
"""Minimal but fully auditable canonical envelope for validator coverage."""
82115
profile = config["canonical_profile"]

0 commit comments

Comments
 (0)