systemdesign.academyAI EngineeringFree lessonsSign inGet the course
  1. Home
Previous lessonDocument Ingestion: The Layer That Quietly Caps EverythingNext lessonQuery Transformation and Routing: Fixing Retrieval Before It Runs

System Design

  • Foundation
  • Intermediate
  • Advanced
  • Capstone

AI Engineering

  • Foundation
  • Data, RAG and Agents
  • Evaluation, LLM Ops and Security

systemdesign.academy

  • Home
  • Glossary
  • Interview prep
  • Reviews
  • About
  • Pricing
  • Privacy
  • Terms
  • Refunds
  • Delivery
  • Contact
AI Engineering: Data, RAG and Agents
  • Retrieval and RAG in Production
  • The RAG Retrieval Cliff: Engineering Recall Back at Scale
  • AI Engineering · Retrieval Rag

    The RAG Retrieval Cliff: Engineering Recall Back at Scale

    Free preview: the first 2 parts of this 16-part lesson.

    Already bought the course? Sign in to read the whole lesson.

    this lesson is part of

    AI Engineering

    Unlock this lesson and the 199 other paid lessons

    • 210 lessons in 16 chapters
    • 118 lessons built on a lab that really ran
    • An AI tutor beside every lesson that answers and draws
    • Lifetime access, every new lesson included

    $49 once, by PayPal

    See the AI Engineering course

    The rest of this lesson

    1. Same Corpus Growth, Three Retrieval Designs
    2. Run the Cliff, Then Buy It Back
    3. Metadata Filtering: Shrink N Before You Rank
    4. Where the Filter Runs Decides Whether It Helps
    5. The Filtered-HNSW Trap: In-Scope Nodes Can Be Islands
    6. Partition by Tenant: a Zero-Error Routing Key
    7. Topic Routing Trades a Soft Failure for a Hard One
    8. Coarse-to-Fine: Narrow Before You Search Deep
    9. A Hierarchical Summary Index: Query the Tree, Not the Leaves
    10. The Same ANN Knob Buys Less Recall as the Corpus Grows
    11. Recall and Cost at Ten Million Chunks: the Frontier
    12. Which Fix, for Which Query Shape
    13. What This Looks Like Outside the Lesson
    14. Knowledge Check

    read the rest of this lesson in

    AI Engineering

    Unlock this lesson and the 199 other paid lessons

    • 210 lessons in 16 chapters
    • 118 lessons built on a lab that really ran
    • An AI tutor beside every lesson that answers and draws
    • Lifetime access, every new lesson included

    $49 once, by PayPal

    See the AI Engineering course

    Continue this lesson

    in Retrieval Rag

    This lesson is part of the AI Engineering course. Unlock the full course, a separate one-time payment, for lifetime access.

    One-time payment. Lifetime access. No subscription.
    Global
    $49/lifetime

    One-time payment by card or PayPal

    Get Lifetime Access
    Foundation lessons free, try before you buy
    India Special
    India
    ₹999/lifetime

    One-time payment: UPI, card or netbanking

    Get Lifetime Access
    Foundation lessons free, try before you buy
    Every ML Platform lesson, Foundation to Advanced
    Real architecture diagrams with real tool logos
    MLOps, LLMOps, and data engineering in depth
    Quizzes with instant feedback
    Built and reviewed by senior engineers
    Lifetime access, all future content included

    Foundation lessons of this course are free, no payment needed. Try them now

    Half a Percent

    0.005. That is the recall@10 of the answer-bearing chunk at one million chunks, under the distractor model you will run a few slides from now, for a query whose recall was 1.000 at a hundred thousand. Not a gradual erosion. A tenfold corpus growth took that query family from perfect to effectively zero, while the retriever kept returning ten results with cosine scores above 0.8 on every single call.

    The chapter opener showed you this cliff exists, mapped its symptoms, and made the case that no vendor swap repeals it. This lesson does the part an introduction could not: it reduces the whole failure to one equation, then works down the list of engineering fixes that hold recall at ten million chunks, and prices each one. By the end you will be able to answer the three questions that actually come up in a scaling review. Which fix does my traffic call for? Where in the pipeline does it belong? What does it cost per million queries?

    The mechanism takes one sentence to restate: k is fixed while the corpus grows, so the chunk that answers the question competes against an ever-larger crowd of semantically similar, factually wrong neighbors for the same few seats. Everything after this slide is attacking the terms of that sentence, in order of payoff, with real architecture.

    Every Fix Attacks One Term of the Same Equation

    Start with the equation, because it is the map for everything that follows. Lambda is the expected number of chunks that outscore the answer for a given query. The answer makes the top k exactly when fewer than k chunks beat it, and lambda factors cleanly into the corpus size N times a per-query beat probability p.

    Lambda equals N times p lever map: a dark banner stating lambda equals N times p, expected competitors equals corpus size times per-query beat rate, above two columns. The blue left column, shrink N, lists metadata pre-filtering, partitioning and namespaces, and coarse-to-fine routing. The violet right column, shrink p, lists deduplication at ingestion, a hybrid lexical path, and wider k plus reranking, each with a short cost note

    That factorization is the entire strategy. You have exactly two ways to keep lambda below k as the corpus grows. Shrink N, so fewer chunks are even in the race, which you do before any vector math runs through filtering, partitioning, and coarse routing. Or shrink p, so the answer wins its race more often, which you do by cleaning the corpus, adding a lexical signal, and sharpening the ranking. There is a third lever, raising k itself, but it does not shrink lambda, it buys more seats, and it pays for those seats in reranker compute on every query. That is why it is the last resort on the map, not the first.

    The value of the equation is that it turns a vague symptom into a specific choice. A tenant-scoped workload wants N shrunk by partitioning. A corpus full of mirrored exports wants p shrunk by deduplication. An identifier query wants p shrunk by a lexical path. Only when neither factor can move any further do you spend compute on a wider k. The rest of this lesson walks the levers in that order, because the cheap ones are also the durable ones, and a system that partitions and filters well often never needs the expensive one at all.