A “successful” run of 5,540 garbage chunks
A missing dependency made the PDF reader index raw PDF bytes as text. No error was raised. I found it by opening sample chunks and reading them.
An agent that knows when it doesn’t know. It reviews loan agreements against the FCA Consumer Duty, cites its evidence and hands uncertain cases to a person.
Pointing an LLM at a loan agreement and asking “is this compliant?” creates a worse problem than it solves. A confident wrong answer about regulatory compliance isn’t a quirky bug. It’s the failure mode.
Compliance review of consumer credit documents is still mostly manual: someone reads the agreement, reads the relevant FCA guidance, and judges whether the two line up. It’s slow, and two reviewers can reasonably disagree.
The core design problem is making the “I don’t know” case work as reliably as the “yes, compliant” case: grounding every claim in real regulatory text, and routing anything uncertain to a person.
Lender, borrower, amount, APR, term, fees and clauses pulled into a validated schema.
1 LLM call · PydanticOne query per Consumer Duty outcome against 344 pages of FCA text.
ChromaDB · top 5 · local embeddingsA verdict per outcome, with reasoning and verbatim quotes as claims.
4 LLM calls · structured outputConfidence comes from retrieval quality, never the model’s self-report. Below 0.65, the verdict becomes “insufficient evidence”.
No LLM callEvery case lands in a review queue. Overrides need a written reason; decisions are append-only and audited.
Streamlit · audit logThe clever version needs a baseline to beat. The agentic loop was only evaluated live once the fixed workflow’s numbers existed, and it lost on verdicts, so verdicts stayed with the fixed workflow.
Regulation changes, and every claim needs traceable evidence. Retrieval keeps the source text one click away.
Fewer moving parts to audit. The checks that matter run as plain code, not another model call.
A model saying it’s sure isn’t evidence. The routing signal is measured, and below threshold the case goes to review.
Zero misses on 13 approved documents still leaves a 95% upper bound of 20.6%. Showing a 5% miss rate would take 59.
| Consumer Duty outcome | Accuracy | False alarms | Missed breaches | Abstained |
|---|---|---|---|---|
| Price and value | 0.978 | 1 | 0 | 0 |
| Consumer support | 0.933 | 3 | 0 | 0 |
| Products and services | 1.000 | 0 | 0 | 0 |
| Consumer understanding | 0.907 | 4 | 0 | 2 |
How to read this. Accuracy is the judge’s verdict before the 0.65 confidence override, with abstentions excluded. A false alarm is a compliant document flagged as possibly non-compliant (8 in total). A missed breach is a planted defect the judge called compliant.
Across 60 document–outcome pairs, all 3 runs agreed 52 times. Every one of the 8 wrong verdicts, and both abstentions, sat in the 8 pairs where runs disagreed.
Mean confidence for right and wrong verdicts differs by at most 0.0123. At 0.65 it still routes 62.5% of wrong verdicts to review, which is the safety property, and it sends half the correct verdicts to review too, so it is not a correctness detector. Disagreement between runs did better: the 3 runs disagreed on 8 of 60 document–outcome pairs, and all 8 wrong verdicts were among them. That held for the fixed workflow only; the agent’s errors repeat across runs. This is a finding from the saved runs, not yet a routing rule, and it is measured on 15 synthetic agreements.
A missing dependency made the PDF reader index raw PDF bytes as text. No error was raised. I found it by opening sample chunks and reading them.
The model returned several tool calls at once, and structured calls failed with HTTP 400s.
Arguments arrived wrapped in a literal placeholder key. All 49 recovered on an automatic retry.