Skip to content

Extraction v1 and the end-to-end benchmark (2026-11-28)

Question: can an LLM turn messy text into assertions the ledger can trust, and does the ledger stay correct when it gets its facts from text instead of structured fields?

Setup: - gemini-3.1-flash-lite at temperature 0, prompt x1, structured output. - Every proposed fact goes through verify() (ADR-019) before it is written. - Cases: - generated: 172 cases, i.e. the 164 unstructured records of ledger-bench v1 plus 8 legal withdrawal notices. Labels are the records' structured fields. - hand: 16 hard cases written by hand (bench/extraction_cases.yaml). Human review of the labels is pending. - End-to-end: the main benchmark gains a ledger_e2e system. Contracts, policies, price lists, Slack, email and legal notices reach it only as text through the extractor. CRM and Stripe rows take the mapper path, as exports would. - Code: bench/extraction.py, bench/systems.py::LedgerE2E. - Raw results: bench/results/2026-11-28_770ca9b/ (extraction.* and the full benchmark with ledger_e2e). They're replayed from the live run's cache; folder names carry the development commit that produced them.

Results

Extraction (a fact is right only if subject, predicate, value and dates all match)

Set Facts Verified precision Verified recall Raw precision (no checks) Wrong facts the verifier caught Right facts it dropped
generated 160 100% 99% 97% 5 0
hand 11 100% 91% 92% 1 1
  • Withdrawals: 9 of 9 found (8 generated + 1 hand), no false ones.
  • Supersession links: 138 of 138 graded facts correct (a link where the document replaces another, none where it doesn't).
  • 4 generated labels are scored as optional: injected messages that never name a plan, e.g. "Dune Solar pricing has been reset to ₹10/month".

End-to-end decision benchmark (96 scenarios)

System Confidently wrong Accuracy Correct abstention Attack success
Assertion ledger, structured input (v1) 0% 100% 100% 0%
Assertion ledger, end-to-end (LLM extraction) 0% 99% 100% 0%
LLM judge + policy rules (best baseline) 14% 78% 45% 0%
Naive RAG 50% 48% 9% 33%

The one end-to-end miss is a refusal, not a wrong answer: both price-list facts in supersession-05 were rejected (see below), so the ledger had nothing authoritative and abstained.

Extraction is an ingestion cost, about 2.3 calls per scenario. The ~38 s per scenario reflects a slow API day (~15 s per call). Answering is still a ~9 ms resolver call.

What we learned

  1. The verifier's job is precision, and it did it. Of the facts the model proposed, 3% (generated) and 8% (hand) were wrong. Every one of them was rejected:
  2. a monthly fee computed from an annual one (₹6,48,000 ÷ 12);
  3. a price-list fact filed under a customer's plan;
  4. plans guessed for messages that name none.

Nothing wrong was written. 2. The first run exposed a model quirk, not hallucination. flash-lite garbles the ₹ sign inside quotes, writing —, ‘, ‑ or a thin space instead, in about 12% of quotes (22 of 188 cases). Every other character was verbatim. The strict quote check dropped all of them: generated recall was 87% and hand recall 64%, with 19 correct facts lost (15 generated, 4 hand). Quote location now ignores symbols directly before a digit. Every later check reads the document's own text at that span, so a garbled quote can't carry in a value. 3. The predicate is the weakest field. Values, dates, subjects and references were almost never wrong; plan choice was. Two vocabulary-level checks catch it: - subject_types stops a customer-price predicate from attaching to a product; - requires_any means the document must name the plan, or the plan was guessed. 4. The ledger's fail-closed design absorbs extraction errors. When the verifier drops a fact, the ledger answers from what remains or refuses. It never filled the gap with a guess: 0% confidently wrong end to end. 5. Withdrawals and supersession linking are reliable on this text. Linking only through identifier tokens ("#935", "v4.1") worked on every withdrawal and every graded supersession (138 of 138). It also refused prose such as "all previous contracts" and "the signed contract". 6. Known limitation: relative dates ("from next month") are rejected because the date isn't written down (hand-13). It fails closed, at the cost of recall.

Caveats (read before quoting)

  • The verifier was improved after looking at this run. Three checks were added in response to it: symbol-tolerant quote location, subject_types and requires_any. The before numbers are above. A fresh held-out set, written after these changes, is needed for an unbiased number.
  • Generated text is templated, so the generated set is easy: raw precision is already 97%. The hand set is small (16 cases, 11 facts). Treat it as a smoke test of hard patterns, not a statistic.
  • One model, one prompt, temperature 0. A stronger model may need fewer checks; a weaker one may trip more of them.
  • CRM and Stripe rows were not extracted. They are structured exports and take the mapper path, so end-to-end here means "documents and messages via LLM".
  • The 4 optional labels were chosen by a rule, not by hand: the label's plan doesn't appear in the text (predicate_grounded). A test pins that only injection messages are affected.