RAGEngineering Hub

Contents

Learn RAG in 12 chapters

Every concept explained with pictures: the problem it solves, the idea, how it works, what we measured, when to use it and the usual mistakes. Read in order, or jump to what you need.

  1. 01

    What RAG is, and why

    Why a model needs outside knowledge, what one RAG request does, and when RAG is the wrong tool.

    1. 1.1Why models need outside knowledge, and what hallucination means
    2. 1.2What RAG is: anatomy of a request
    3. 1.3RAG vs fine tuning vs long context and prompt caching
    4. 1.4Use cases and the quality, latency and cost triangle
  2. 02

    Tokens, cost and your first RAG

    What a model reads and pays for, and the whole RAG lifecycle in miniature.

    1. 2.1Tokens and context windows for RAG
    2. 2.2The RAG lifecycle and your first RAG in miniature
  3. 03

    Getting documents in

    Turn messy files into clean, labelled, up to date text.

    1. 3.1Content sources and file formats
    2. 3.2Parsing, layout and OCR
    3. 3.3Tables, images and mixed content
    4. 3.4Cleaning, normalization and quality gates
    5. 3.5Metadata, document identity and versioning
    6. 3.6Updates, deletes, reindexing and ingestion pipelines
  4. 04

    Chunking

    Decide what a searchable piece of knowledge looks like.

    1. 4.1Why we chunk, and the main chunking strategies
    2. 4.2Structure aware chunking and tables
    3. 4.3Chunk size, overlap and token based sizing
    4. 4.4Contextual chunking and late chunking
    5. 4.5Parent child and multi representation indexing
    6. 4.6Chunk metadata, provenance and the chunking debugging playbook
  5. 05

    Embeddings

    How text becomes numbers, what that misses, and how to choose and change a model.

    1. 5.1Embeddings and similarity from first principles
    2. 5.2What embeddings cannot do
    3. 5.3Choosing an embedding model: size, cost, language
    4. 5.4Embedding model migration and index rebuilds
  6. 06

    Vector stores and scores

    Where vectors live, what a similarity score means, and many vectors per chunk.

    1. 6.1Vector databases, ANN indexes and choosing a store
    2. 6.2Score calibration and thresholds
    3. 6.3Late interaction and multivector retrieval
  7. 07

    Finding the right chunks

    Keyword, meaning and hybrid search, better queries, routing and reranking.

    1. 7.1Query understanding, rewriting and expansion
    2. 7.2Dense retrieval and keyword search with BM25
    3. 7.3Hybrid retrieval and rank fusion
    4. 7.4topK, no good match, and metadata filtering
    5. 7.5Routing, diversity, deduplication and caching
    6. 7.6Reranking: two stage, cross encoder and LLM rerankers
  8. 08

    When retrieval fails

    A playbook to find out why the right chunk was not found.

    1. 8.1Retrieval failure analysis playbook
  9. 09

    Building the answer

    Turn found chunks into a grounded, cited answer, or an honest I don't know.

    1. 9.1Context selection, packing and citations
    2. 9.2Grounding prompts and abstention
    3. 9.3Lost in the middle and context management
    4. 9.4Conflicts, staleness and freshness rules
    5. 9.5Hallucination checks and answer verification
    6. 9.6Conversational RAG, answer UX and RAG APIs
  10. 10

    Measuring

    Know with numbers whether a change made things better.

    1. 10.1Why measure, and what to measure
    2. 10.2Building a golden dataset
    3. 10.3Retrieval metrics: precision, recall, MRR, nDCG
    4. 10.4Faithfulness and answer correctness
    5. 10.5LLM as judge, and judging the judge
    6. 10.6Offline and online evals, regression tests and slices
  11. 11

    Safety and operations

    Keep it safe, observable, fast, affordable and reliable.

    1. 11.1Prompt injection and poisoned documents
    2. 11.2Access control, privacy and governance
    3. 11.3Index lifecycle operations
    4. 11.4Observability and tracing
    5. 11.5Latency, cost, caching and model routing
    6. 11.6Reliability, degraded modes and launch readiness
  12. 12

    Scale and advanced RAG

    Scaling up, choosing an architecture, agents and graphs.

    1. 12.1Scaling, multi tenancy and enterprise architecture
    2. 12.2Choosing an architecture: naive, advanced, agentic, graph
    3. 12.3Agentic RAG and RAG as an MCP tool
    4. 12.4GraphRAG, structured data and multimodal RAG