RAG & Retrieval
Grounding models in your own documents, from basics to advanced retrieval.
14 tutorials, spanning 2 of the 17 learning layers — ordered so each builds on the last.
7RAG
- Why RAG ExistsA model cannot know your documents and will confidently invent answers about them. RAG is the fix, and the problem is worth understanding before the solution.
- How RAG Works, Step by StepTwo phases: index your documents once, then retrieve and answer per question. Every stage has a failure mode worth knowing before you build.
- How to Split Documents for RAGChunk boundaries decide what can be retrieved at all. Too small loses context, too large dilutes relevance, and structure beats character counts.
- RAG or Fine-Tuning?Retrieval supplies knowledge; fine-tuning shapes behavior. Most people asking this question want retrieval, and a surprising number want neither.
- Why You Need a RerankerVector search narrows millions to dozens quickly and ranks the final few badly. A second pass that reads query and document together fixes it.
- What Is a Vector Database?Storage built around one question: which vectors are closest to this one? Why that needs different machinery than a normal database.
- How Similarity Search Actually WorksCosine similarity, dot products, and why 'nearest' is a weaker signal in high dimensions than it sounds.
14Advanced RAG
- Agentic RAGLet the model decide what to search for, read results, and search again. Multi-hop retrieval without building a graph.
- Contextual RetrievalA chunk torn from its document loses the context that made it meaningful. Adding that context back at index time is unusually effective.
- GraphRAGBuild a knowledge graph from your documents, then traverse it. Answers questions that span many sources, which vector retrieval cannot.
- Hybrid SearchVector search misses exact terms; keyword search misses meaning. Combining them is the highest-value upgrade to a basic retrieval pipeline.
- RAG over Images and TablesCharts, diagrams, and tables carry the answers text extraction throws away. Three strategies for retrieving over them.
- Query Rewriting and ExpansionUsers ask badly. Rewriting the query before retrieval fixes more failures than tuning the retriever.
- Evaluating RAGMeasure retrieval and generation separately. Most RAG failures are retrieval failures, and a single quality score hides which half is broken.