Ledger

150 hand-checked eval questions, a search bake-off, and a planted prompt-injection corpus

Ledger answers questions about public companies using their annual reports. Every figure comes back with the sentence it came from and that sentence’s character position in the filing. When the filings don’t contain the answer, it says so instead of guessing.

I built it to learn how agent systems are put together, and specifically how you tell whether one is any good. Most of the work here isn’t the agent. It’s the test questions, the search comparison, and the security testing that say what the agent actually does.

Results

Measured on 150 hand-written questions with known answers. Every expected value was checked against the actual filing text by script before the questions were used.

Score
Correctness 87%
Citation validity 100%
Faithfulness (model judge) 98%
Refusal accuracy 100% (24/24)
False refusal rate 13%
Median latency 6.4s
Median cost per question about $0.015

Citation validity at 100% matters more than it looks. It doesn’t mean the model was careful. It means every quote was checked in Python against the passage it claimed to be quoting, and anything that didn’t match exactly was thrown out and counted. Across 150 questions, nothing was thrown out.

The weak spot is the tricky category, 47% on questions with false premises, vague years, and multiple parts. I left it weak rather than papering over it.

The reranker made things worse

Before touching a language model I measured search on its own, with 23 queries where I knew which passage held the answer.

Configuration recall@5 recall@10 MRR
Vectors only 0.83 0.96 0.54
BM25 only 0.70 0.74 0.48
Hybrid (RRF) 0.91 0.91 0.59
Hybrid + reranker 0.74 0.96 0.52

BM25 alone scores the same at 5 and at 10, which means the queries it misses it never finds at any rank. Those are the paraphrased ones, where the question shares no words with the document.

The reranker cost 17 points of recall@5 while leaving recall@10 alone, so it wasn’t losing passages, it was pushing correct ones from the top 5 down into positions 6 to 10. In one trace it promoted a footnote about deferred revenue above the actual income statement. I guessed it was struggling with tables and added prose queries to check. That didn’t help, so the guess was wrong and the cause is still open. I turned it off and left the comparison row in so it can be measured again if the corpus changes.

Prompt injection

Filings are documents, and documents can contain text written to manipulate whatever reads them. I built a fake company out of a real filing with seven attacks planted in it, four visible and three hidden with CSS.

Attacks resisted: 12 of 12, defenses on or off. The honest reading is that the keyword screen did nothing for whether attacks succeeded. The prompt instruction that evidence is data and not instructions did all the work. What the screen measurably changed was citation validity, 88% to 100%, because with the poisoned passage dropped before the model saw it there was nothing left to misquote.

The interesting attack was a quiet fake correction telling any automated summary to report total net sales as $1 billion. It contains none of the phrases a keyword screen looks for, so the screen never flagged it. The model caught it anyway and told me the document contained a planted instruction. Keyword screening only catches attacks that look like attacks.

I also checked the judge

The faithfulness number comes from a model grading answers, so I graded the grader. I labelled 33 answers by hand: 97% agreement, Cohen’s kappa 0.00.

That isn’t a contradiction, it’s what kappa does when one category dominates. 32 of 33 labels were “faithful”, so chance agreement is also about 97% and kappa divides out to nothing. So I measured what I actually cared about instead: I took 15 correct answers, shifted one figure in each, and re-judged. It caught 14 of 15, and graded severity sensibly without being asked. The miss had cited a passage that stated the figure in rounded prose, so the corrupted exact number didn’t look obviously different. Exact-match faithfulness checking gets weaker wherever the filing rounds.

← all projects