Skip to content

Part 6 · Blueprint 31

Enterprise RAG System Architecture & Failure Modes

14 min reading · Sources · Editorial review pending

Retrieved text can be relevant yet stale, unauthorized or insufficient evidence.

More
20px
Reading list
Page details

Published date · Last edited:

Draft edition. Editorial review and supplementary reading recommendations are still being completed.

Format: Architecture walkthrough. Prerequisites: the beginner bootcamp. Chapter prerequisites: Indexes & Storage Engines: B-Trees vs. LSM Trees, Security Architecture, Zero-Trust & Multi-Tenancy, Search Engine & Real-Time Typeahead.

Sixty-second mental model

Problem: Retrieved text can be relevant yet stale, unauthorized or insufficient evidence.

Use: Bind retrieval and answer claims to a current evidence scope.

Design boundary: Retrieve authorized evidence for a bounded question-answering task. Separate source revision, chunk generation, retrieval and answer acceptance; similarity is not permission or factual support.

Layer 1 · Intuition

Hypothetical scenario: Northwind is designing retrieval-augmented generation. Maya represents product requirements, Dev implementation and Priya reliability. The team must agree what one retrieved chunk means and which component owns the document and permission versions.

Think of an open-book answer checked against permitted reference pages. Separate the requester from document and permission versions, then identify the retained evidence needed after failure.

Authority
The entitled state owner.
Invariant
A rule preserved across concurrency and failures.
Embedding
A learned numerical representation of an input in a vector space. Analogy: Coordinates placing related material near each other on a map.
RAG
Retrieval-augmented generation: supplying retrieved information to a model's generation process. Analogy: An open-book answer composed using retrieved reference pages.

Architecture and worked reasoning

Design boundary: Retrieve authorized evidence for a bounded question-answering task. Separate source revision, chunk generation, retrieval and answer acceptance; similarity is not permission or factual support.

Responsibilities on the request path

Retrieval-augmented generation: responsibilities and request directionRetrieve authorized evidence for a bounded question-answering task. Separate source revision, chunk generation, retrieval and answer acceptance; similarity is not permission or factual support.Source revisionsScoped indexRetrieverAnswer validator
Retrieve authorized evidence for a bounded question-answering task. Separate source revision, chunk generation, retrieval and answer acceptance; similarity is not permission or factual support.

Workload and limiting resource

Choose 200 documents with 50 chunks each: 10,000 chunks. At 768 float32 values/vector, raw vectors use 10,000 × 768 × 4 = 30,720,000 bytes before index/text overhead. Retrieving ten chunks of 500 tokens adds 5,000 input tokens, not the whole corpus.

Keep the units attached to each intermediate result. The assumptions above describe a hypothetical exercise, not observed vendor capacity. A real capacity decision also needs a measured service curve, skew, recovery traffic and an explicit admission policy for overload.

Mutation or publication path

Retrieval-augmented generation: mutation boundaryAuthorize and version the source. Then: Build chunks/index entries tied to that version. Then: Publish a coherent searchable generation.Step 1
Authorize and version the source.
Step 2
Build chunks/index entries tied to that version.
Step 3
Publish a coherent searchable generation.
Authorize and version the source. Then: Build chunks/index entries tied to that version. Then: Publish a coherent searchable generation.
  1. Authorize and version the source.
  2. Build chunks/index entries tied to that version.
  3. Publish a coherent searchable generation.

Observation and recovery path

Retrieval-augmented generation: observation boundaryConstrain retrieval by authorized source scope. Then: Collect relevant evidence with provenance. Then: Accept an answer only under explicit grounding and uncertainty rules.Step 1
Constrain retrieval by authorized source scope.
Step 2
Collect relevant evidence with provenance.
Step 3
Accept an answer only under explicit grounding and uncertainty rules.
Constrain retrieval by authorized source scope. Then: Collect relevant evidence with provenance. Then: Accept an answer only under explicit grounding and uncertainty rules.
  1. Constrain retrieval by authorized source scope.
  2. Collect relevant evidence with provenance.
  3. Accept an answer only under explicit grounding and uncertainty rules.

Failure that changes the decision

Hypothetical scenario: A deleted source survives in an old index generation. Bind entries to source lifecycle and enforce current eligibility at retrieval/answer boundaries.

Attempt this decision before reading the explanation

Does high similarity establish that a passage supports the answer?

No. Relevance, authority, current permission and entailment are distinct checks. Preserve source provenance and evaluate the answer against an explicit acceptance rule.

Supporting mechanism analysis

Hypothetical scenario: Northwind. Maya represents product, Dev implementation and Priya reliability. The following workflow develops the underlying mechanism.

Hypothetical scenario. At Northwind, Priya must retrieve current policy without exposing restricted personnel records.

In short. Preserve evidence identity and permissions across every derived artifact. Invalidate derived evidence when permission changes.

Hypothetical scenario. An organization wants a document assistant that answers questions from internal policies and engineering notes. A fluent answer is insufficient: its sources must be permitted for the requesting employee, current for the question and adequate to support the claims made.

Define the initial product outcome as an answer supported by eligible source passages, or an explicit limitation when the available evidence is inadequate. Do not promise universal factual correctness, immediate synchronization from every source, or permission safety from a model instruction alone.

A vector index can select similar passages without establishing access, current version, deletion status or sufficient evidence. A model can then produce a persuasive answer from the wrong material. Improving similarity does not repair a missing authorization boundary.

Index ingestion also fails independently from query serving. A connector can miss updates, a parser can omit tables and an embedding change can mix incompatible vector spaces. The service needs source identity, versioned transformations and visibility into the freshness of each collection.

The retrieval-augmented generation paper by Lewis and colleagues combines parametric generation with retrieved external memory in a specific research architecture. Its results do not establish this application's permission, freshness or answer-quality contract. Those are system requirements to design and evaluate.

Ingestion records source identity, version, access scope and deletion state before deriving chunks and embeddings. A complete index version identifies the parser, chunking policy and embedding space. Switch query routing only when the intended collection is ready and retain a supported rollback path.

Query handling authenticates the reader, establishes permitted scope, retrieves candidates and expands eligible source passages. Lexical retrieval can preserve exact identifiers while embeddings capture a different similarity signal. Combining their rankings requires a declared fusion and evaluation policy; raw scores from unrelated systems are not automatically comparable.

The generator receives a bounded evidence set with stable source references. Validate output structure, citation targets and claim support separately. A valid citation URL does not establish that the linked passage supports the claim. Preserve the selected versions for authorized investigation under an explicit retention policy.

Priya's policy assistant needs an answer that belongs to the current reader and points to current evidence. A vector index is a derived representation of source material. Embeddings, chunks, lexical indexes, reranker inputs and answer caches all carry consequences of source identity and access rules. A nearest-neighbor result is a candidate; it is not proof that the reader is entitled to see the document.

Use an illustrative collection of one hundred thousand source pages, each represented by four chunks. That produces 100,000 × 4 = 400,000 chunks before any later version or duplication is retained. If one thousand source pages change, the same four-chunk assumption gives 4,000 chunk replacements. The migration needs a rule for withdrawing the old versions and confirming that the new projection is complete. Indexing four thousand new chunks alone does not establish that obsolete chunks stopped being served.

Separate the intervention from its evaluation. A new embedding model changes the representation space; a new chunking policy changes what evidence can be retrieved; a new prompt changes how that evidence is used. Compare the affected failure slices and preserve a rollback route with compatible artifacts. The complete design includes ingestion, retrieval, permission checks, generation, citations, operational budgets and evidence of accepted outcomes, rather than treating a successful demonstration answer as a release decision.

Hypothetical scenario. Choose 10,000 documents averaging 2,000 tokens of extracted content: 10,000 × 2,000 = 20 million source tokens. A simple chosen split uses 500-token chunks with no overlap, giving four chunks per document and 40,000 chunks. Real boundaries and overlap change that count.

Choose 768 coordinates per embedding and four bytes per coordinate. Raw vector payload is 40,000 × 768 × 4 = 122,880,000 bytes, or 122.88 MB. This excludes text, metadata, graph structures, quantization choices, replicas and index overhead. It is not a complete vector-store sizing result.

For one answer, choose six selected chunks of 500 tokens each: 6 × 500 = 3,000 evidence tokens. Add a chosen 1,000 tokens for instructions, question and retained conversation, plus a 1,000-token output allowance. The planned total is 3,000 + 1,000 + 1,000 = 5,000 tokens, before any additional serialization or tool content. Tokenization must be measured with the selected model's actual representation.

At a chosen 20 logical questions per second, input demand under this plan is 20 × 4,000 = 80,000 tokens per second, and maximum reserved output demand is 20 × 1,000 = 20,000 tokens per second. These are request budgets, not measured generation throughput or current provider pricing. Retries and evaluation calls add demand.

For a hypothetical 100-case review set, suppose 20 cases lack required eligible evidence, ten have adequate evidence but unsupported answers, and 70 meet the full rubric. The outcome is 70 ÷ 100 = 0.7 on this constructed set. It is not a claim of population accuracy. Overlapping failure categories would require different accounting, so these categories are explicitly disjoint.

The primary reference establishes this concrete distinction: the RAG research paper describes a specific retrieval-generation architecture, not application permission guarantees.

A revoked document can remain in an old index or cache. Define a freshness objective for permission changes and decide whether source eligibility must be rechecked before passage expansion and answer delivery. If the permission service is unavailable, returning cached content may violate the contract even when retrieval latency looks healthy.

A useful answer cache includes identity, permitted scope, source versions and model or prompt version as relevant to its correctness. Semantic similarity between questions does not establish equivalent answers or equivalent access. Prefer an explicit miss over cross-scope reuse.

Rebuilding an embedding space requires compatible query and document representations. Run the new collection alongside the old, compare retrieval failures and switch atomically at the collection-routing boundary. Do not mix old and new vectors and assume their numerical dimensions make them comparable.

Layer 3 · Internals

Trade-offs and limits

ApproachProvidesRequires
Lexical retrievalMatches explicit terms and structured constraints.Vocabulary mismatch can miss relevant evidence.
Dense retrieval plus rerankingCan recover semantically related candidates and refine ranking.Representation, permission filtering and evidence quality must be evaluated together.

Recovery decision

Hypothetical scenario: A deleted source survives in an old index generation. Bind entries to source lifecycle and enforce current eligibility at retrieval/answer boundaries.

No. Relevance, authority, current permission and entailment are distinct checks. Preserve source provenance and evaluate the answer against an explicit acceptance rule.

Write your design before revealing the review

Does high similarity establish that a passage supports the answer?

Evidence you can explain in your own design

Drafts and self-review are stored only in this browser. They are separate from reading completion.

Compare your decision

No. Relevance, authority, current permission and entailment are distinct checks. Preserve source provenance and evaluate the answer against an explicit acceptance rule.

A deleted source survives in an old index generation. Bind entries to source lifecycle and enforce current eligibility at retrieval/answer boundaries.

Check your understanding

Does high similarity establish that a passage supports the answer?

No. Relevance, authority, current permission and entailment are distinct checks. Preserve source provenance and evaluate the answer against an explicit acceptance rule.

How would you recover from this failure: A deleted source survives in an old index generation. Bind entries to source lifecycle and enforce current eligibility at retrieval/answer boundaries.

Start with the exact boundary that failed. Authorize and version the source. Build chunks/index entries tied to that version. Publish a coherent searchable generation. Then recover evidence through the observation path: Constrain retrieval by authorized source scope. Collect relevant evidence with provenance. Accept an answer only under explicit grounding and uncertainty rules. Preserve the distinction between a confirmed state change and an unavailable response.

Which assumption in the worked calculation would a burst or concentrated tenant invalidate first?

Choose 200 documents with 50 chunks each: 10,000 chunks. At 768 float32 values/vector, raw vectors use 10,000 × 768 × 4 = 30,720,000 bytes before index/text overhead. Retrieving ten chunks of 500 tokens adds 5,000 input tokens, not the whole corpus. Recompute the affected resource rather than multiplying unrelated storage and network budgets by the same factor. Retrieve authorized evidence for a bounded question-answering task. Separate source revision, chunk generation, retrieval and answer acceptance; similarity is not permission or factual support.

Which component in this topology could be removed from a smaller first deployment?

Source revisions, Scoped index, Retriever, Answer validator name responsibilities, not a requirement for separate processes. Co-locate responsibilities when their transaction, trust and capacity boundaries permit it. Authorize and version the source.

What evidence must a caller have before relying on the observation path?

Constrain retrieval by authorized source scope. Collect relevant evidence with provenance. Accept an answer only under explicit grounding and uncertainty rules. No. Relevance, authority, current permission and entailment are distinct checks. Preserve source provenance and evaluate the answer against an explicit acceptance rule.

45-minute interview rubric

  1. 00–05: scope retrieved chunk and document and permission versions.
  2. 05–12: identify the limiting resource and derive the domain workload above, retaining units and assumptions.
  3. 12–28: draw document and permission versions, numbered writes and reads.
  4. 28–40: challenge recovery: Bind retrieval and answer claims to a current evidence scope.
  5. 40–45: defend document_id placement, observations and remaining assumptions.

Go deeper

Decision log

Bind retrieval and answer claims to a current evidence scope.

Preserve retrieved chunk identity and document and permission versions ownership.

Revisit changed workload, observations or recovery objectives.