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
- 0:00 Six kinds of RAG, and none beat the plainest here
- 0:31 The idea
- 1:03 Setup
- 1:27 Forty one pages
- 1:58 Twelve questions of six kinds
- 2:30 Plain and hybrid
- 2:52 Rerank, rewrite and two steps
- 3:15 Linked
- 3:45 Score all six
- 4:45 What this does not show
- 5:26 Mistakes to avoid
- 5:51 My take and next steps
- 6:26 Recap
Files
- compare.py (19 lines)
- docs.py (50 lines)
- rag.py (84 lines)
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.