RAG, measured

Search

The search compares the question with every passage and keeps the closest. “Closest” can mean sharing words, sharing meaning, or a mix of both.

Two rankings, one list

Questionas askedKeywordsBM25: shared wordsMeaningclosest numbersMergekeywords weigh 0.1Top passagesthe first 10Questionas askedKeywordsBM25: shared wordsMeaningclosest numbersMergekeywords weigh 0.1Top passagesthe first 10
A hybrid search ranks the passages twice, once by shared words and once by meaning, then merges the two lists. The weight says how much the keyword list counts.

Four ways to search

SearchRight page in the first 10Right report in the first 5
Keywords only15 in 10042 in 100
Meaning only47 in 10086 in 100
Both, equal weight42 in 10078 in 100
Both, keywords at 0.147 in 10085 in 100
One run, 150 questions over 84 annual reports, passages of 256 tokens with the report's name on top.

Two questions, three searches

The first three pages each search returned. The right page is marked.

Using only the information within the balance sheet, how much total assets did Costco have at the end of FY2021? Answer in USD millions.
SearchFirst three pagesThe right page
Keywords
  1. Costco 2021 annual report, page 30
  2. Block 2016 annual report, page 86
  3. AES 2022 annual report, page 149
Not in the first 20
Meaning
  1. Costco 2021 annual report, page 38
  2. Costco 2021 annual report, page 58
  3. Costco 2021 annual report, page 29
Ranked 1
Both, keywords at 0.1
  1. Costco 2021 annual report, page 38
  2. Costco 2021 annual report, page 58
  3. Costco 2021 annual report, page 29
Ranked 1
The balance sheet never says “how much total assets did Costco have”: keywords miss it, meaning finds it first.
As of FY2023Q1, why did Pepsico raise full year guidance for FY2023?
SearchFirst three pagesThe right page
Keywords
  1. PepsiCo 2023 Q1 earnings release, page 10
  2. PepsiCo 2023 Q1 earnings release, page 1
  3. PepsiCo 2023 Q1 earnings release, page 1
Ranked 2
Meaning
  1. PepsiCo 2021 annual report, page 73
  2. PepsiCo 2022 annual report, page 75
  3. PepsiCo filing of 2023-05-30, page 26
Not in the first 20
Both, keywords at 0.1
  1. PepsiCo 2021 annual report, page 73
  2. PepsiCo 2022 annual report, page 75
  3. PepsiCo filing of 2023-05-30, page 26
Not in the first 20
Here the words match better than the meaning: keywords rank the page second, meaning brings other years. At weight 0.1 the mix follows meaning and misses too.

From the run of 2 October 2026: 150 questions, 84 reports, passages of 256 tokens with the report's name.

What meaning bought over keywords

15 → 47

Searching by keywords alone found the right page for 15 questions in 100. Searching by meaning found it for 47.

FinanceBench: 150 questions over 84 annual reports, right page in the first 10 results, bge-small embedder. One run.

Keywords still find what meaning misses, as the second question shows. Long questions in plain language match too many words to rank well; exact terms such as a product code or an invoice number are where they help.

One question to ask your team

Does our search use keywords, meaning, or both, and who chose the weight?
For engineers

The settings behind the lesson.

  • Hybrid search: a BM25 ranking and a vector ranking of 20 candidates each, merged by reciprocal rank fusion (k 60). The BM25 weight scales its share; 0.1 is the app's default.
  • On BEIR's FiQA, nDCG@10 rose as the BM25 weight fell: 0.351 at 1.0, 0.383 at 0.1. hybrid@0.1 stays within 0.005 of vector search alone.
  • This run (passages with the report name): page hit@10 bm25 0.147, vector 0.473, hybrid@1.0 0.420, hybrid@0.1 0.473. Without the names, bm25 reached 0.160.
  • The saved results show page ids as the run recorded them; two of PepsiCo's three are passages from the same page.