RAG & Retrieval
Grounding models in your own documents, from basics to advanced retrieval.
7 RAG
- Why RAG Exists A 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 Step Two 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 RAG Chunk 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 Reranker Vector 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 Works Cosine similarity, dot products, and why 'nearest' is a weaker signal in high dimensions than it sounds.
14 Advanced RAG
- Agentic RAG Let the model decide what to search for, read results, and search again. Multi-hop retrieval without building a graph.
- Contextual Retrieval A chunk torn from its document loses the context that made it meaningful. Adding that context back at index time is unusually effective.
- GraphRAG Build a knowledge graph from your documents, then traverse it. Answers questions that span many sources, which vector retrieval cannot.
- Hybrid Search Vector search misses exact terms; keyword search misses meaning. Combining them is the highest-value upgrade to a basic retrieval pipeline.
- RAG over Images and Tables Charts, diagrams, and tables carry the answers text extraction throws away. Three strategies for retrieving over them.
- Query Rewriting and Expansion Users ask badly. Rewriting the query before retrieval fixes more failures than tuning the retriever.
- Evaluating RAG Measure retrieval and generation separately. Most RAG failures are retrieval failures, and a single quality score hides which half is broken.