RAG, measured

What RAG is

RAG finds the right pages in your documents first, then lets the model answer from them and say where the answer came from.

The model alone, or with your documents

What changesThe model aloneRAG
Answers fromWhat it learned in trainingPages found in your documents
Knows your documentsNoYes, the ones you added
Shows its sourceNoYes, every answer cites its pages
When the page is not foundAnswers anyway, sometimes wronglyCan say it does not know
RAG stands for retrieval-augmented generation: retrieval finds the pages, generation writes the answer.

Two moments

Readfile to textCutinto passagesEmbedtext to numbersStoretwo indexesQuestionas typedPlanprepare the searchSearchclosest passagesAnswerwith its sourcesReadfile to textCutinto passagesEmbedtext to numbersStoretwo indexesQuestionas typedPlanprepare the searchSearchclosest passagesAnswerwith its sources
A document is prepared once, when it is added. A question goes through four steps every time it is asked. Each box is a lesson of this course.

One question, all the way through

A real question from FinanceBench, a test of 150 questions over 84 annual reports. The answer is on a balance sheet that never says “quick ratio”.

  1. The question

    Has AMCOR's quick ratio improved or declined between FY2023 and FY2022?

  2. Plan the search

    One short call to a small model rewrites nothing here, but picks the reports to search and says where the answer is printed. It never answers.

    documents: AMCOR_2023_10K, AMCOR_2020_10K
    hints: Consolidated Balance Sheets: cash, marketable securities,
           trade receivables, current liabilities
  3. Search

    Only the two AMCOR reports are searched. The balance sheet now ranks high, because the hint names its lines.

  4. Hand over the passages

    The 5 best passages go to the model, each with a number to cite.

    [1] AMCOR_2023_10K  Consolidated Balance Sheets … current assets …
    [2] …
  5. Answer, with its source

    The model computes the ratio for both years from the balance sheet figures and cites the page as [1].

Without the planning step, a search on the question as typed brings back passages about ratios in general and other companies. The balance sheet page is not in the first 10.

From the lab's run on FinanceBench, planner Gemini Flash-Lite. AMCOR_2020_10K is a wrong pick; the right report is also on the list, so the search still works.

AMCOR's 2023 balance sheet with cash, trade receivables and total current liabilities marked
The page the answer is printed on: AMCOR's 2023 balance sheet. Marked: the lines the planner's hint named.

What planning the search bought

47 → 75

A plain search found the right page for 47 questions in 100. With a planning step before it, 75.

FinanceBench: 150 questions over 84 annual reports, right page in the first 10 results. Planner: Gemini Flash-Lite.

One question to ask your team

On how many real questions with known answers have we checked our assistant?
For engineers

The same pipeline, in the terms you will meet.

  • Retrieval: hybrid search, a BM25 keyword ranking and a vector ranking fused by reciprocal rank fusion (k 60, BM25 weight 0.1), 20 candidates per search, 5 chunks of 256 tokens sent to the model.
  • The planner is one LLM call that returns JSON: a standalone query, the documents to search and hints. With 84 report names listed (about 1,450 prompt tokens) it took 2.6 s with Gemini Flash-Lite and 4.0 s with the local Qwen3-8B.
  • Page hit@10 is the share of questions whose evidence page is among the first 10 chunks: 0.473 plain, 0.753 with the planner, 0.647 with Qwen3-8B as the planner.