GenAI 2026 · Module 10 · RAG
A quick revision before we open notebook six today. No new code in this part, just the shape of the pipeline so far.
Notebook 01 · Why RAG
We asked gpt-4o-mini about a company we made up, a phone that does not exist, and a private engineering decision. It answered all three, confidently, and got every single one wrong.
The RAG contract
Notebook 01 used keyword overlap as a toy retriever. Everything from notebook 02 onward is about building each of these three stages properly.
Notebook 02 + 03 · Ingestion
Before any chunking, a document has to be read correctly. Here is the same table from the same PDF, read two different ways.
| Region | Ship. | On-Time |
|---|---|---|
| Northwest | 128,400 | 97.2% |
Left side: you cannot tell if 128,400 is a shipment count or a revenue figure. Right side: the grid survives, so a retrieved chunk still means something.
We built this twice, once in LangChain and once in LlamaIndex. Same lesson both times: the parser matters, the framework does not.
Notebook 02 + 03 · Chunking
SentenceWindowNodeParser and HierarchicalNodeParser do the same job in one line. That is where LlamaIndex earns its keep.Notebook 04 · Embeddings
Notebook 05 · Vector databases
Where we stand
Today · Notebook 06
Dense embeddings find meaning. But do they ever lose to plain keyword search? And can keyword search fail completely? Let's measure it.
Open the notebook and we will find out exactly where BM25 wins, where it goes blind, and why production systems run it alongside dense search rather than picking one.