Skip to content
echogeco
Retrieval, and when not to · Choosing the mechanism

"Total spend in Q3" over invoices

Decide what replaces retrieval when a finance question is an aggregate over 4,000 invoices, cost the extraction once, and say what evidence would keep the pipeline as it is.

casehardExercise · 3 min · 39 of 77
On this page

A retrieval pipeline answered a finance question with a confident, precise, wrong number. The question was never a text question, and the fix is not a better retriever.

The situation

A finance team put 4,000 supplier invoices — PDFs, about 1,500 tokens each — into a retrieval pipeline: chunked at 400 tokens, embedded, top 5 into the prompt. It answers "what did the March data-centre invoice say about late fees" well. Last week the CFO asked "what was our total spend in Q3 on cloud vendors" and got $84,000, the sum of the five invoices retrieved. The real figure, found by hand in two hours, was about $1.2M across 310 invoices. The CFO now wants either a number she can trust or the pipeline switched off. Questions arriving are roughly half text lookups and half aggregates — totals by vendor, by quarter, by category — and the invoices arrive at about 80 a week.

Constants: a 200k-token window, P_in = $3 per million input tokens, P_out = $15 per million output tokens; a one-off extraction run is work that can wait, so a batch endpoint at half price is available.

The question

What do you change, what does it cost, and what evidence would persuade you to leave the retrieval pipeline exactly as it is?

A strong answer · Rubric · Where answers go wrong

Write your answer first, then open