learning-it by example

Back to the video

Types of RAG Explained With Examples, Tested

Six kinds of RAG, one small test: the plainest one scored 10 of 12, and the graph one answered a question none of the others could.

Video #301 ยท RAG and vector search

Steps in the video

  1. 0:00 Six kinds of RAG, and none beat the plainest here
  2. 0:31 The idea
  3. 1:03 Setup
  4. 1:27 Forty one pages
  5. 1:58 Twelve questions of six kinds
  6. 2:30 Plain and hybrid
  7. 2:52 Rerank, rewrite and two steps
  8. 3:15 Linked
  9. 3:45 Score all six
  10. 4:45 What this does not show
  11. 5:26 Mistakes to avoid
  12. 5:51 My take and next steps
  13. 6:26 Recap

Files

  • compare.py (19 lines)
  • docs.py (50 lines)
  • rag.py (84 lines)

Download the code (zip)

Tested with

Python 3.12.15 | fastembed==0.9.1, numpy==2.5.4

What this does not show

Forty-one made-up pages and twelve questions written by the author; one question is a twelfth of the score. Retrieval only: no language model answers anything. Rewrite uses hand-written hints and linked a hand-made list of names. Scores move with settings: two pages handed over, six rerank candidates, fusion constant 60.

Sources

Learning IT by Example.