M07 · Retrieval-augmented generation (RAG)07-0936 min read
Lesson 49 of 106 · Module 8 of 14 · Week 4
Threads:The measurement threadThe weights threadThe infrastructure threadThe control thread
The complete RAG pipeline, stage by stage
A complete retrieval-augmented generation pipeline is nine stages — parse, chunk, embed, index, query, retrieve, rerank, assemble, generate-and-cite — split across an offline ingestion path and an online query path. NVIDIA states the query path as query, embedding model, vector match against an indexed knowledge base, retrieve and decode, then the LLM synthesises and cites sources. The property that governs every design decision is that the pipeline's end-to-end quality equals its single worst stage: a flawless reranker cannot repair a parser that silently dropped every table.
What the complete RAG pipeline is
Nine stages, two paths, one shared artefact — the index — that connects them:
════════════ OFFLINE: INGESTION (runs on corpus change) ════════════
source documents
│
[1] PARSE ──────────► text + structure + metadata (06-01)
│ PDFs, tables, scans; failures are SILENT
│
[2] CHUNK ──────────► retrievable units with overlap (06-02)
│ + dedup and boilerplate strip (06-04)
│ + metadata attached (06-03, 07-05)
│
[3] EMBED ──────────► one vector per chunk (07-02)
│ model + version + prefix convention PINNED
│
[4] INDEX ──────────► sparse inverted index (07-01)
+ dense ANN index (07-04)
+ metadata store, filterable
│
▼
┌──────────────────┐
│ THE INDEX │ ← the only shared state
└──────────────────┘
│
════════════ ONLINE: QUERY (runs per request) ══════════════════════
│
[5] QUERY PREP ◄─── user question + conversation history (12-11)
│ rewrite to a self-contained query
│ resolve the caller's entitlements (07-05)
│
[6] RETRIEVE ───────► sparse leg + dense leg, both filtered
│ fuse with RRF (07-06)
│ → N candidates
│
[7] RERANK ─────────► cross-encoder scores each candidate (07-07)
│ → reordered, thresholded
│
[8] ASSEMBLE ───────► edge-loaded context with headers (07-08)
│ token budget respected (04-06)
│
[9] GENERATE ───────► answer grounded in context, WITH (07-11)
CITATIONS — or an honest decline
Why nine and not five. Most published diagrams show four or five boxes: embed, store, retrieve, generate. That compression is exactly why RAG systems fail in ways their builders cannot explain. Parsing is not part of chunking. Reranking is not part of retrieval. Assembly is not part of generation. Each of the nine has its own failure mode, its own measurable output, and its own owner. A stage you have not named is a stage you cannot attribute a failure to, and attribution is the whole game (07-10).
Mapping to NVIDIA's stated pipeline. The [NVIDIA-DOC] description covers the query path at a coarser granularity, and the mapping is exact:
NVIDIA's stated stage [NVIDIA-DOC] | Stages here |
|---|---|
| query | [5] query prep |
| embedding model | part of [6] — the dense leg encodes the query |
| vector match against indexed knowledge base | [6] retrieve, over the [4] index |
| retrieve and decode | [6] and [7] — candidates fetched and scored |
| LLM synthesises and cites sources | [8] assemble and [9] generate-and-cite |
Learn the NVIDIA ordering as an ordering; component-order questions are an explicit drill emphasis. Learn the nine-stage decomposition as your debugging vocabulary.
The NVIDIA products that sit on this pipeline [NVIDIA-DOC]:
| Product | Where it sits |
|---|---|
| NeMo Retriever | retrieval accuracy at scale — stages [3], [4], [6], [7] |
| NVIDIA AI Blueprint for RAG | a reference workflow for the whole pipeline; the shape, not a stage |
| NeMo Curator | data curation — stages [1] and [2] |
| NeMo Guardrails | keeps applications accurate, appropriate, on-topic, and secure — wraps stage [9] |
| NIM | pre-optimised inference microservices; how the embedding model, reranker, and LLM are served |
| Triton Inference Server | serving many models — the same layer as NIM, different framing |
Note carefully: NIM and Triton are deployment for the models this pipeline calls, not pipeline stages. 12-13 covers them properly, and confusing "how a model is served" with "what stage it serves" is a real distractor family.
How the RAG pipeline works, stage by stage
L1 — The intuition you can carry into an exam
Two paths. Offline you turn documents into a searchable index. Online you turn a question into a search, narrow the results, arrange them, and answer with citations. The quality of the whole thing is the quality of its worst stage.
Three facts to carry:
- Nine stages: parse, chunk, embed, index, query-prep, retrieve, rerank, assemble, generate-and-cite.
- NVIDIA's query path: query → embedding model → vector match → retrieve and decode → synthesise and cite
[NVIDIA-DOC]. - Chain, not sum. Find the worst stage.
L2 — What each stage takes in, puts out, and how it fails
This table is the lesson's core asset. Every row is a stage you can measure independently, and the "silent?" column is the one that decides how much monitoring each deserves.
| # | Stage | Input | Output | Characteristic failure | Silent? | Lesson |
|---|---|---|---|---|---|---|
| 1 | Parse | source files | text + structure + metadata | tables flattened, columns interleaved, scans yielding nothing, headers lost | Yes — always | 06-01 |
| 2 | Chunk | parsed text | retrievable units | answer split across a boundary; chunks too long to be specific; boilerplate dominating | Yes | 06-02, 06-04 |
| 3 | Embed | chunk text | one vector per chunk | wrong model version, missing instruction prefix, wrong pooling | Yes — and dangerous | 07-02 |
| 4 | Index | vectors + metadata | searchable indexes | ANN recall too low; metadata unfilterable; stale after corpus change | Partly | 07-04, 12-12 |
| 5 | Query prep | question + history + identity | a self-contained, entitlement-scoped query | ambiguous follow-ups unresolved; identity not propagated | Partly | 12-11, 07-05 |
| 6 | Retrieve | prepared query | N fused candidates | recall miss — the answer is not in the pool | No, if you look at the pool | 07-01, 07-02, 07-06 |
| 7 | Rerank | N candidates | reordered, thresholded list | near-miss left at the top; the good chunk left mid-list | No, if you look | 07-07 |
| 8 | Assemble | ranked chunks | the literal prompt | naive ordering; too many chunks; metadata not rendered; output budget not reserved | Partly | 07-08 |
| 9 | Generate + cite | prompt | answer with citations | unsupported claims; citations that do not match; no decline path | No — visible in the answer | 07-11, 09-12 |
Read the "silent?" column as a monitoring budget. Stages 1, 2, and 3 fail without any error, anywhere, ever. A parser that drops a table returns text. A chunker that splits an answer returns chunks. An embedder with the wrong prefix returns vectors. These three stages need assertions, because they will never volunteer a problem — and they are also the three that sit earliest, which means their failures propagate through everything downstream and get misattributed to whatever stage the team happens to be looking at.
The corresponding assertions, each cheap:
| Stage | Assertion that catches its silent failure |
|---|---|
| 1 Parse | For a sample of documents, assert extracted character count is within a plausible band of the source; assert known table cell values appear in the output |
| 2 Chunk | Assert no chunk exceeds the embedding model's or reranker's input limit; assert a known answer sentence is wholly inside exactly one chunk |
| 3 Embed | Self-retrieval: embed a known chunk's own text as a query; it must return that chunk at rank 1 with similarity near 1.0 |
| 4 Index | Compare ANN top-k against brute-force top-k on a sample; assert index recall above a threshold you chose |
| 5 Query prep | Assert a follow-up query resolves to a self-contained question; assert the entitlement predicate is non-empty |
| 6 Retrieve | recall@N on the frozen eval set |
| 7 Rerank | MRR / nDCG@k on the frozen eval set |
| 8 Assemble | Assert the assembled token count is within budget and output space is reserved; log ordered chunk ids |
| 9 Generate | Faithfulness and citation-accuracy checks (09-07) |
The self-retrieval assertion at stage 3 is the highest-value single test in the entire pipeline. It is one embedding call and one search, it catches nearly every encoder-consistency failure, and it belongs in CI.
L3 — The two paths' different lifecycles, and where they couple
The ingestion path and the query path run on completely different schedules, and most operational RAG problems live in the seam between them.
| Ingestion path (1–4) | Query path (5–9) | |
|---|---|---|
| Trigger | corpus change | user request |
| Frequency | hourly to weekly | continuous |
| Latency budget | minutes to hours | milliseconds |
| Cost profile | batch, parallel, throughput-bound | per-request, latency-bound |
| Failure visibility | none by default | immediate |
| Idempotent | should be | yes |
| Who notices a failure | nobody, for weeks | users, in minutes |
Where they couple, and what breaks:
The embedding model is shared state. Stage 3 encoded the corpus; stage 6's dense leg encodes the query. They must use the same model, version, prefix convention, and pooling. This is the coupling that produces the module's signature failure: mismatched encoders yielding plausible nonsense with high scores and no error (07-02). The engineering answer is a single module owning the embedding convention, imported by both paths.
Changing the embedding model invalidates the whole index. Vectors from two models are not comparable even at equal dimensionality. A model upgrade is therefore a full re-embed and re-index — a migration project, not a config change (12-12).
Metadata schema is shared state. Stage 2 attaches it; stages 6 and 8 depend on it. Adding a filterable field means re-ingesting, which is precisely why permission metadata has to be designed in before the pipeline is built (07-05) and why this module put access control at 07-05 rather than later.
Index freshness is a correctness property, not a performance one. Between a document changing and the index reflecting it, the pipeline confidently serves stale content (07-03). Permissions changing is the acute version of the same problem, and it is why ACL sync must be decoupled from content re-embedding (07-05).
Two things must be versioned together. The corpus snapshot and the embedding-model version form one logical unit. If you cannot say "this index is corpus snapshot X embedded with model Y at settings Z", you cannot reproduce a result, roll back, or explain a regression.
The RAG pipeline compared: full pipeline vs minimal RAG vs long-context vs fine-tuning
| Full 9-stage RAG | Minimal RAG (embed, store, retrieve, generate) | Long-context stuffing | Fine-tuning | |
|---|---|---|---|---|
| Stages you can attribute a failure to | 9 | 4 | 1 | 0 — the weights are opaque |
| Handles exact identifiers | yes (sparse leg) | usually not | yes | not reliably |
| Handles paraphrase | yes | yes | yes | yes |
| Freshness | index update | index update | resend the document | retrain |
| Provenance / citations | yes, by design | possible | possible | no |
| Per-query cost | moderate | low | high — scales with document size | low |
| Scales to a large corpus | yes | yes | no | yes, at training cost |
| Setup complexity | high | low | lowest | high |
| Changes model style/format | no | no | no | yes |
| Adds new facts | yes | yes | yes | unreliably |
| Access control feasible | yes, at retrieval | if designed in | per-request only | no — weights cannot forget (13-05) |
| Lost-in-the-middle exposure | low (small k) | moderate | high | n/a |
| Right when | production system, real corpus, real users | prototype, or genuinely simple corpus | small corpus that fits the window | behaviour/format change, not fact injection |
Four readings that exam items probe.
RAG and fine-tuning solve different problems. RAG injects facts with provenance and freshness; fine-tuning changes behaviour, style, and format. The confusable pair is on the study guide's explicit list and 11-08 owns the full decision rule. The one-line version: if the answer changes when the documents change, that is RAG; if the answer changes when you want a different kind of answer, that is fine-tuning.
Minimal RAG is a legitimate starting point and a bad ending point. Four stages is the right shape for a prototype. Its problem is not that it is wrong but that it is unattributable: when quality disappoints, there are four boxes and the real cause is usually in a stage the diagram does not name.
Long-context stuffing is a real alternative at small scale. If the corpus fits in the window, sending it whole eliminates every retrieval failure in this module. It does not scale, it is expensive per query, and it maximises lost-in-the-middle exposure (07-08). Considering it seriously is part of not over-applying RAG (07-12).
Only RAG gives you citations and access control. These are the two properties that most often make RAG the right architecture in an enterprise, and neither is available from a fine-tuned model — model weights cannot forget a fact, cannot cite a source, and cannot be filtered per user (13-05).
Worked example: tracing one query through all nine stages
This is a constructed end-to-end trace with invented numbers, built so every stage boundary is inspectable. It is not a measurement of any real system.
The system. An internal support assistant over 12,000 chunks drawn from product documentation, release notes, and an archived support forum. Because 12,000 chunks is small, the dense index is exact in-memory search rather than an ANN index — the 07-04 argument applied.
The question. A support engineer authenticated as u_4417 (groups: support-tier2, all-staff) asks:
"customer on 4.2 is hitting ERR_CERT_AUTHORITY_INVALID after we rotated their CA — is this expected?"
Stage 1 — Parse
Source: 340 PDFs, 1,100 HTML pages, one CSV of release notes.
Extracted: 1,441 documents
Empty output: 3 documents ← scanned PDFs with no OCR layer
Table-bearing: 61 documents ← extracted as pipe-delimited text, not flattened prose
Assertion: character count within 0.8×–1.2× of source estimate → 3 failures, flagged
The three empty documents are the stage's silent failure caught by an assertion. Without that assertion they would simply be absent from every future answer, and nobody would ever know why the certificate-rotation runbook could not be found.
Stage 2 — Chunk
Recursive chunking at ~400 tokens with 50-token overlap (06-02), boilerplate stripped and near-duplicates removed (06-04), metadata attached (06-03, 07-05).
Chunks before dedup: 13,884
Near-duplicate removed: 1,412 ← mostly a repeated legal footer
Boilerplate-only removed: 472 ← nav blocks
Final chunks: 12,000
Max chunk length: 487 tokens ← under both the embedder's and the reranker's limits ✓
Assertion: known answer sentence wholly inside exactly one chunk → pass
That 1,412-chunk dedup is doing more work than it looks. A footer repeated across thousands of pages becomes the nearest neighbour of every query, because its vector sits at the centroid of the corpus. Removing it is a retrieval-quality intervention disguised as a hygiene task.
Stage 3 — Embed
Model: pinned by name AND version
Prefix: "passage: " for chunks, "query: " for queries ← ONE module owns this
Pooling: mean, as the model requires
Normalise: L2, so cosine == dot product
Output: 12,000 × 768 float32 = 30.7 MB (M0.4)
SELF-RETRIEVAL ASSERTION:
embed chunk_0041's own text as a query
→ returns chunk_0041 at rank 1, similarity 0.998 ✓
That assertion is the pipeline's single highest-value test. Had the prefix been omitted on the query side, this check would have returned rank 1 at similarity ~0.72 or a different chunk entirely — and every downstream stage would have continued reporting success.
Stage 4 — Index
Sparse: inverted index, one analyser shared by index and query paths (07-01)
Dense: exact in-memory NumPy matrix — 12,000 rows, recall 1.0 by construction (07-04)
Meta: acl_groups, classification, product_version, doc_date, status, source_type, doc_id, chunk_pos
Index identity recorded: corpus snapshot 2026-07-28 + embedding model vX.Y + prefix convention A
No vector database. At 30.7 MB and 7.7 million multiply-adds per query, one is unnecessary — and exact search means index recall is not a variable that can confound anything downstream.
Stage 5 — Query prep
Raw: "customer on 4.2 is hitting ERR_CERT_AUTHORITY_INVALID after we rotated their CA
— is this expected?"
History: none (first turn) → no rewrite needed (12-11)
Identity: u_4417 → groups [support-tier2, all-staff] (07-05)
Filter: acl_groups ∈ {support-tier2, all-staff}
AND status = 'current' ← recency, per 07-03
Eligible: 9,120 of 12,000 chunks
Two filters, two different jobs. The ACL filter is a security boundary and must be inside the retrieval query (07-05). The status = current filter is a quality control addressing recency blindness (07-03). Both are pre-filters; with exact search both are a boolean mask applied before the dot product.
Stage 6 — Retrieve and fuse
Both legs run over the eligible 9,120, in parallel, top-50 each.
Sparse leg (BM25). ERR_CERT_AUTHORITY_INVALID is maximally rare, so it dominates:
rank 1 c8801 11.42 "ERR_CERT_AUTHORITY_INVALID: the presented chain terminates in an untrusted root"
rank 2 c2170 9.88 release note 4.2: "ERR_CERT_AUTHORITY_INVALID now includes the chain in the log"
rank 3 c5512 3.10 "certificate rotation checklist"
...
Dense leg (cosine). Recovers the mechanistic and procedural chunks that share no rare terms:
rank 1 c5512 0.81 "certificate rotation checklist"
rank 2 c8801 0.78 the direct explanation
rank 3 c6033 0.76 "after replacing a CA, clients must be restarted to reload the trust store"
...
Fusion (RRF, k_rrf = 60). For the four documents that matter:
c8801: sparse 1 → 1/61 = 0.016393 + dense 2 → 1/62 = 0.016129 = 0.032522
c5512: sparse 3 → 1/63 = 0.015873 + dense 1 → 1/61 = 0.016393 = 0.032266
c2170: sparse 2 → 1/62 = 0.016129 + absent = 0 = 0.016129
c6033: absent = 0 + dense 3 → 1/63 = 0.015873 = 0.015873
Fused: c8801 > c5512 > c2170 > c6033. Note the defect already familiar from 07-06: c6033 — the chunk stating that clients must be restarted to reload the trust store, which is the actual answer to the user's real problem — sits fourth, because only one leg found it.
Stage 7 — Rerank
The fused pool of 74 unique candidates goes to the cross-encoder. Scores for our four:
c6033 0.93 "after replacing a CA, clients must be restarted to reload the trust store" ← the answer
c8801 0.91 the error's meaning
c5512 0.62 rotation checklist
c2170 0.28 a release note about log formatting
Reranked: c6033 > c8801 > c5512 > c2170. The reranker promoted c6033 from rank 4 to rank 1, because joint encoding let it see that "after replacing a CA, clients must be restarted" answers "we rotated their CA and now they get this error" — a connection with almost no lexical overlap and only one leg's vote. It also collapsed c2170 from rank 3 to last: a release note that mentions the error string in the context of log formatting is not an answer, which is the mention-versus-explanation distinction from 07-07.
Relevance floor of 0.5 keeps three candidates and drops c2170 and the other 70.
Stage 8 — Assemble
Edge-loaded, best first and second-best last, with rendered headers (07-08):
[SYSTEM] Answer using only the numbered sources below. Cite the source id after
each claim. If the sources do not contain the answer, say so.
[SOURCE 1 · doc:ops-118#c14 · 2026-05-02 · current · official]
after replacing a CA, clients must be restarted to reload the trust store …
[SOURCE 2 · doc:ref-441#c07 · 2026-03-11 · current · official]
certificate rotation checklist …
[SOURCE 3 · doc:err-009#c01 · 2026-01-20 · current · official]
ERR_CERT_AUTHORITY_INVALID: the presented chain terminates in an untrusted root …
[QUESTION] customer on 4.2 is hitting ERR_CERT_AUTHORITY_INVALID after we rotated their CA
— is this expected?
Token accounting:
instructions 120
3 chunks + headers 430
question 35
─────────────────────────
input 585
reserved for output 500
total 1,085 ≪ context window ✓ (02-03, 04-06)
Three chunks, not fifty. 585 input tokens, not 8,000. The two strongest chunks at the two strong positions. Every chunk carries a date, a status, a source tier, and a citable id.
Stage 9 — Generate and cite
Yes, this is expected. Replacing a certificate authority does not take effect on a
client until the client is restarted so it reloads its trust store [SOURCE 1].
ERR_CERT_AUTHORITY_INVALID specifically indicates the presented chain terminates in
a root the client does not trust [SOURCE 3], which is what happens while the old
trust store is still loaded. The rotation checklist [SOURCE 2] lists the restart as
a required step.
Every claim cites a source. Every source is current, official, and one this user is entitled to read. The answer addresses the user's real question — is this expected — rather than merely defining the error code.
What the trace proves
| Stage | Its specific contribution to this answer |
|---|---|
| 1 Parse | Caught 3 empty documents that would otherwise have been silently missing |
| 2 Chunk | Removed 1,412 near-duplicate footers that would have crowded every result |
| 3 Embed | Self-retrieval at 0.998 proved the encoder convention was consistent |
| 4 Index | Exact search removed ANN recall as a confounder entirely |
| 5 Query prep | Applied the ACL boundary and the currency filter, narrowing 12,000 to 9,120 |
| 6 Retrieve | Sparse found the exact error string; dense found the procedural chunk; fusion ranked the agreed one first |
| 7 Rerank | Promoted the actual answer from rank 4 to rank 1 |
| 8 Assemble | 3 chunks, 585 input tokens, both best chunks at strong positions, headers rendered |
| 9 Generate | Cited every claim; the answer addresses the question asked |
Now remove one stage and watch the whole thing fail:
| Remove | Result |
|---|---|
| Stage 1's assertion | 3 documents silently absent from every answer forever |
| Stage 2's dedup | Footer chunks crowd the top-50; real candidates pushed out |
| Stage 3's prefix convention | Every dense score becomes noise; nothing errors |
| Stage 5's ACL filter | Restricted chunks eligible for retrieval — a breach (07-05) |
| Stage 5's currency filter | A superseded 4.1 document may contradict the 4.2 answer (07-03) |
| Stage 6's sparse leg | The exact error string is not found reliably |
| Stage 6's dense leg | c6033 and c5512 are never retrieved at all |
| Stage 7 rerank | The real answer sits at rank 4 and never enters a 3-chunk context |
| Stage 8's edge-loading | The best chunk lands mid-context and is under-used |
| Stage 9's citation instruction | The answer is unverifiable and hallucination is undetectable |
Nine stages, and removing any one of them degrades or breaks the answer. That is what "quality equals the worst stage" means concretely — and it is why a diagram with four boxes cannot support a debugging conversation.
Decision table: designing each pipeline stage under real constraints
| Stage | Cheap default that works | Upgrade when | Do not bother if |
|---|---|---|---|
| 1 Parse | text extraction + an extracted-length assertion | tables or scans matter → structured extraction, OCR (06-01) | corpus is already clean markdown |
| 2 Chunk | recursive, ~300–600 tokens, ~10% overlap | answers span boundaries → semantic chunking (06-02) | documents are already short, self-contained units |
| 2b Dedup | exact-hash dedup + boilerplate strip | near-duplicates persist → near-dup detection (06-04) | corpus is genuinely unique content |
| 3 Embed | one pinned model, one convention, self-retrieval assertion | eval set shows the model is the bottleneck (03-03) | never skip the assertion |
| 4 Index | exact in-memory search | corpus > ~10⁵ chunks or concurrency demands it → HNSW/IVF (07-04) | corpus is small — a vector DB is over-engineering |
| 5 Query prep | pass the query through; apply ACL + currency filters | multi-turn chat → query rewriting (12-11) | single-turn, public corpus → filters may be unnecessary |
| 6 Retrieve | measure BM25 first, then dense, then fuse (07-01, 07-06) | one leg's blind spot shows in the eval set | one modality genuinely covers your queries |
| 7 Rerank | add it early — it is the cheapest experiment (07-07) | quality plateaus on ordering | hard latency floor with no GPU budget |
| 8 Assemble | edge-load, relevance floor, rendered headers, reserved output space | multi-part questions need per-part chunks | never skip the token accounting |
| 9 Generate | grounding instruction + citations + a decline path (07-11) | faithfulness metrics show drift (09-07) | never skip citations if provenance matters |
The build order that avoids wasted work, which is not the same as the pipeline order:
- Eval set first (
01-08). Twenty real questions with labelled answer chunks. Without this every later decision is a guess. - Parse and chunk with assertions. Silent stages first, because their failures masquerade as everyone else's.
- BM25 baseline (
07-01). Free, and the denominator for every later claim. - Dense retrieval with the self-retrieval assertion (
07-02). - Exact index (
07-04). Do not adopt infrastructure yet. - Fuse (
07-06), measure. - Rerank (
07-07), measure. Often the largest single gain. - Assemble properly (
07-08). Often the largest gain per line of code. - Ground and cite (
07-11). - Only now consider a vector database, a bigger model, or fine-tuning.
Teams routinely invert steps 1 and 10, and that inversion is the most expensive mistake in applied RAG.
Why the complete RAG pipeline is on the NCA-GENL exam
This is the highest-yield lesson in the module by objective coverage. The blueprint mentions RAG three times across its objectives [OFFICIAL], and this lesson serves:
- 1.3 / 4.2 — Build LLM use cases such as retrieval-augmented generation (RAG), chatbots, and summarizers. The pipeline is the build.
- 1.4 — Curate and embed content datasets for RAGs. Stages 1–3.
- 1.6 / 4.3 — Familiarity with the capabilities of Python natural language packages (spaCy, NumPy, vector databases, etc.). Stage 4.
- 1.8 — Select and use models to create text embeddings. Stage 3.
- 1.9 — Use prompt engineering principles to create prompts to achieve desired results. Stages 8 and 9.
- 4.4 — Identify system data, hardware, or software components required to meet user needs. The component inventory is this lesson's §1.
- 4.1 / 1.1 — Assist in deployment and evaluation of model scalability, performance, and reliability. Two paths with different latency and cost profiles.
- 4.5 — Monitor functioning of data collection, experiments, and other software processes. The silent-stage assertions.
- 5.1 / 5.2 / 5.3 — Trustworthy AI. Citations serve Transparency; retrieval filtering serves Privacy and Safety and Security; grounding is a hallucination control
[NVIDIA-DOC], and13-01covers the four named pillars.
Memorise NVIDIA's stated pipeline order [NVIDIA-DOC]: query → embedding model → vector match against indexed knowledge base → retrieve and decode → LLM synthesises and cites sources. Component-order questions are an explicit drill emphasis, and this sequence is the most likely thing to be asked about RAG.
Also memorise the product-to-stage map: NeMo Retriever for retrieval, NeMo Curator for curation, NeMo Guardrails for safety rails, the AI Blueprint for RAG as the reference workflow, NIM and Triton for serving [NVIDIA-DOC]. The [FIELD] calibration that NVIDIA-branded options tend to be keyed when two answers are technically defensible makes this map worth knowing cold; 12-13 and 13-02 go deeper.
Question phrasings you should recognise:
| Phrasing | Testing | Answer shape |
|---|---|---|
| "Place the RAG pipeline stages in order." | the canonical sequence | query → embedding model → vector match against the index → retrieve and decode → synthesise and cite |
| "Which stage of a RAG pipeline runs offline?" | the two paths | parse, chunk, embed, index |
| "A RAG answer is wrong. What should be checked first?" | attribution | whether the correct chunk was retrieved — retrieval vs generation (07-10) |
| "Which NVIDIA product provides retrieval accuracy at scale?" | the stack map | NeMo Retriever |
| "What is the NVIDIA AI Blueprint for RAG?" | the stack map | a reference workflow for building a RAG application |
| "Which pipeline stages fail without producing an error?" | silent stages | parsing, chunking, embedding |
| "Why does improving the reranker not fix a parsing failure?" | chain not sum | end-to-end quality is bounded by the worst stage |
| "What must be redone when the embedding model changes?" | shared state | re-embed and re-index the whole corpus |
| "Which stage adds provenance to a RAG answer?" | citations | generation, using ids rendered during assembly |
| "Where is per-user access control enforced?" | the boundary | inside the retrieval query (07-05) |
Distractor families:
- Stages out of order — most commonly retrieval before embedding the query, or reranking before retrieval.
- NIM or Triton offered as a pipeline stage. They are how models are served (
12-13). - "Fine-tuning is required to add new documents." No — RAG's whole value is that adding facts does not require retraining (
11-08). - "RAG eliminates hallucination." It reduces it by grounding and makes it detectable via citations. It does not eliminate it (
09-12,07-11). - The embedding model conflated with the generator. Different models, different stages.
- The vector database credited with embedding. It stores and searches; the embedding model encodes.
- A four-box pipeline offered as complete. Parsing, reranking, and assembly are the omissions that matter.
- "Improve the LLM to fix retrieval." Wrong stage.
One calibration note to carry as uncertainty: candidate reports converge on a heuristic that in scenario questions, when one option proposes building a RAG solution, it is usually the keyed answer [FIELD]. This is field calibration, not official NVIDIA guidance. Use it only as a tie-breaker on genuinely ambiguous items, and check the counter-cases first — no corpus to retrieve from, a need to change style or format rather than facts, and a hard latency floor. 07-12 is entirely about those counter-cases.
Common mistakes with the complete RAG pipeline
| # | Symptom | Cause | Fix |
|---|---|---|---|
| 1 | Quality is poor and nobody can say which stage is responsible | The pipeline is conceived as four boxes, so six failure modes have no home | Name all nine stages; instrument each boundary (07-10) |
| 2 | Weeks spent improving retrieval; the parser was dropping every table | Effort was spent on the interesting stage, not the worst one | Assert on parse output first; silent early stages dominate |
| 3 | Everything reports success and answers are still wrong | The three silent stages have no assertions | Self-retrieval for embedding, length checks for parsing, boundary checks for chunking |
| 4 | The system was fine, then degraded with no deploy | Embedding endpoint updated its model behind a stable name; or the index went stale | Pin the model version as part of index identity (12-12) |
| 5 | Vector database deployed for 8,000 chunks; retrieval quality never measured | Infrastructure adopted before measurement | Exact in-memory search plus an eval set (07-04, 01-08) |
| 6 | Users see documents they cannot access | Permission filter absent, applied post-retrieval, or applied to only one leg | Pre-filter inside every retrieval leg (07-05) |
| 7 | Answers cite superseded documents | No currency filter; superseded content indexed | Status metadata plus a pre-filter; ideally do not index superseded content (07-03) |
| 8 | Answer quality varies run to run for the same question | The answer-bearing chunk sits mid-context; or ANN traversal is non-deterministic | Edge-load (07-08); check index recall (07-04, 09-11) |
| 9 | A model upgrade was treated as a config change and broke retrieval | Embedding-model change requires re-embedding the corpus | Treat it as a migration with a re-index and an eval re-run (12-12) |
| 10 | Cost per query is far above forecast | k was never revisited after prototyping | Count assembled tokens; set k from a measured curve (07-08, 12-09) |
| 11 | Nobody can reproduce a past result | Corpus snapshot and model version not recorded together | Record index identity: snapshot + model + version + settings |
| 12 | Latency regressed after adding a reranker | Pool size N set by default, not measurement | Sweep N against quality and pick the knee (07-07) |
| 13 | Answers are fluent, confident, and unsupported | No grounding instruction, no citations, no decline path | Stage 9 is a designed stage, not a default (07-11) |
| 14 | Four changes shipped together; the gain cannot be attributed | No isolation | One change at a time against a frozen eval set (03-04) |
Mistakes 1, 2, and 3 are the same mistake at three levels of severity, and they share one root: the earliest stages are the silent ones, and the interesting stages are the late ones. Human attention flows to the reranker and the LLM; the failures live in the parser and the embedder. Instrumenting the boundary of every stage is what breaks that pattern, and it is the practice that separates a RAG system you can operate from one you can only hope about.
Which RAG pipeline stage is most often the bottleneck?
In practice, the earliest ones — and that is exactly why they get the least attention.
I am offering this as a reasoned ordering rather than a measured ranking; I have no sourced distribution of RAG failure causes to quote. The reasoning is structural and I think it holds:
| Stage | Why it is so often the bottleneck |
|---|---|
| 1 Parse | Fails silently and totally. A table extracted as word salad cannot be retrieved by any retriever, ranked by any reranker, or cited by any model. Nothing downstream can recover it |
| 2 Chunk | An answer split across a boundary is unretrievable as a unit; a 3,000-token chunk's vector is an average of eight topics and matches nothing specifically |
| 3 Embed | The prefix/pooling/version failure produces confident nonsense with no error, and is invisible without the self-retrieval assertion |
| 8 Assemble | The cheapest fix in the pipeline and the most commonly left at its tutorial default — naive order, fixed k, no headers |
| 9 Generate | Missing grounding instructions and citations turn a retrieval failure into a hallucination |
| 6 Retrieve | Genuinely often a problem, but visible: look at the candidate pool |
| 7 Rerank | Rarely the bottleneck because it is usually absent; adding it is often the largest single gain |
| 4 Index | Rarely the bottleneck, and frequently the stage teams optimise first |
| 5 Query prep | Matters mainly in multi-turn systems (12-11) |
The pattern: the stages that fail silently and early dominate, and the stages that are fun to tune are usually fine. The corrective is mechanical rather than intuitive — instrument every boundary, assert the silent stages, and measure the eval set at each boundary rather than only end to end.
The single most valuable diagnostic remains the one 07-07 and 07-10 both point at: for a failing question, retrieve the top-50 and find where the correct chunk actually is.
| Where it is | Bottleneck | Fix |
|---|---|---|
| Not in the corpus | 1 or 2 | parsing, chunking, curation (06-01, 06-02, 08-01) |
| In the corpus, absent from top-50 | 3, 4, or 6 | encoder convention, index recall, hybrid coverage |
| In the top-50 but below the cutoff | 7 | reranking |
| In the context but the answer is wrong | 8 or 9 | assembly order, grounding, citations |
Four questions, ten minutes, and a stage name. That is the whole method, and 07-10 formalises it.
How do I evaluate a complete RAG pipeline rather than just its answers?
By measuring at stage boundaries, not only at the end. An end-to-end score tells you whether the system is good; boundary metrics tell you which stage to fix.
| Boundary | Metric | What it isolates |
|---|---|---|
| After 1 Parse | extracted-length ratio vs source; known-value presence | did the text survive |
| After 2 Chunk | max/median chunk length; answer-sentence containment | are the units retrievable |
| After 3 Embed | self-retrieval rank and similarity | is the encoder convention consistent |
| After 4 Index | index recall@k vs brute force | is approximation costing you (07-04) |
| After 6 Retrieve | recall@N on the frozen eval set | is the answer in the pool |
| After 7 Rerank | MRR, nDCG@k, recall@3 | is the answer at the top |
| After 8 Assemble | token count, chunk order, header presence | is the prompt well formed |
| After 9 Generate | faithfulness, answer relevance, citation accuracy (09-07) | did the model use what it was given |
Two metrics matter most, and they must be reported separately. Retrieval recall answers "was the evidence available?" Faithfulness answers "did the model use the evidence?" A system with high recall and low faithfulness has a generation problem. A system with low recall and high faithfulness is faithfully answering from bad evidence. Collapsing them into one score makes both diagnoses impossible — this is the decomposition 07-10 and 09-07 are built on.
Re-run the eval set at every stage change. The evalRerun discipline (01-08, 03-04) exists because a change that improves one stage can degrade another: shorter chunks improve retrieval precision and may split answers; a deeper reranker pool improves ordering and raises latency; a stricter currency filter improves accuracy and may cause empty results.
Two things beyond quality metrics.
Cost and latency are pipeline metrics too. Track tokens sent per query, embedding calls, reranker calls, and p95 end-to-end latency (12-09, 12-10). A quality gain that triples cost is a decision someone must make explicitly.
Put it in CI. A retrieval-recall threshold and a self-retrieval assertion that fail the build are worth more than a dashboard nobody reads (10-04). The week-5 deliverable of this course is exactly that: an eval set, four RAG metrics, and a CI gate that fails the build.
Where do NeMo Retriever and the NVIDIA AI Blueprint for RAG fit?
They sit at two different levels: NeMo Retriever is a component family for the retrieval stages, and the AI Blueprint for RAG is a reference workflow for the whole pipeline [NVIDIA-DOC].
| NeMo Retriever | NVIDIA AI Blueprint for RAG | |
|---|---|---|
| What it is | NVIDIA's retrieval offering, aimed at retrieval accuracy at scale | A reference workflow for building a RAG application |
| Level | component — stages 3, 4, 6, 7 | architecture — all nine stages |
| Answers | "how do I get good retrieval?" | "what does a complete RAG system look like?" |
| Part of | the NeMo family | the AI Blueprints family |
The rest of the NeMo family maps onto the pipeline cleanly, and this mapping is worth memorising as a table because it is exactly the kind of tool-to-problem matching the exam rewards:
NVIDIA component [NVIDIA-DOC] | Pipeline role |
|---|---|
| NeMo Curator | data curation and deduplication — stages 1–2 |
| NeMo Retriever | embedding, indexing, retrieval, reranking — stages 3, 4, 6, 7 |
| NeMo (platform) | building, customising, and monitoring models |
| NeMo Guardrails | topical, safety, and security rails around stage 9 |
| NIM | pre-optimised inference microservices — how the embedder, reranker, and LLM are served |
| Triton Inference Server | serving many models with dynamic batching — same layer as NIM |
| TensorRT / TensorRT-LLM | compiling models for fast inference — beneath NIM |
| AI Blueprints | reference workflows, including the one for RAG |
| AI Enterprise | the governed platform these ship within |
Two distinctions the exam cares about, both flagged as reported confusables:
NIM is packaged deployment, not a training tool [NVIDIA-DOC]. It is how a model becomes a stable, secure, low-latency API. It is not a pipeline stage and it does not train anything (12-13).
TensorRT and TensorRT-LLM are different products. TensorRT is a general-purpose inference compiler; TensorRT-LLM adds LLM-specific machinery — KV cache, paged attention, in-flight batching, speculative decoding (12-08, 12-05, 12-07). Both sit beneath serving, not inside the RAG pipeline's logic.
The value of the Blueprint framing for a course like this one: it is an explicit acknowledgement that RAG is a workflow with named stages rather than a library call. That is the same claim this lesson makes, and it is the claim that makes debugging possible.
Glossary recap: the terms this lesson introduced
| Term | Definition |
|---|---|
| RAG pipeline | The nine-stage system that turns documents into an index and a question into a cited answer |
| Ingestion path (offline) | Stages 1–4: parse, chunk, embed, index — runs on corpus change |
| Query path (online) | Stages 5–9: query prep, retrieve, rerank, assemble, generate-and-cite — runs per request |
| NVIDIA's stated RAG pipeline | query → embedding model → vector match against indexed knowledge base → retrieve and decode → LLM synthesises and cites sources [NVIDIA-DOC] |
| Worst-stage property | End-to-end quality is bounded by the pipeline's weakest stage; it is a chain, not a sum |
| Silent stage | A stage whose failures produce no error — parsing, chunking, embedding |
| Self-retrieval assertion | Embedding a known chunk's own text as a query and requiring it back at rank 1 near 1.0 |
| Index identity | The recorded triple of corpus snapshot, embedding-model version, and settings that makes a result reproducible |
| Stage boundary metric | A measurement taken between two stages, enabling attribution rather than just scoring |
| Attribution | Determining which stage caused an observed failure — the purpose of the nine-stage decomposition |
| NeMo Retriever | NVIDIA's retrieval component family, for retrieval accuracy at scale [NVIDIA-DOC] |
| NVIDIA AI Blueprint for RAG | NVIDIA's reference workflow for a complete RAG application [NVIDIA-DOC] |
| NeMo Curator | NVIDIA's data-curation tooling, serving the parse and chunk stages [NVIDIA-DOC] |
| NeMo Guardrails | Rails keeping an LLM application accurate, appropriate, on-topic, and secure [NVIDIA-DOC] |
Key takeaways on the complete RAG pipeline
- Nine stages, two paths. Offline: parse, chunk, embed, index. Online: query prep, retrieve, rerank, assemble, generate-and-cite.
- NVIDIA's stated query path, in order
[NVIDIA-DOC]: query → embedding model → vector match against the indexed knowledge base → retrieve and decode → the LLM synthesises and cites sources. Memorise the sequence. - Quality equals the worst stage. A flawless reranker cannot repair a parser that dropped every table. Find the worst stage, not the interesting one.
- Parsing, chunking, and embedding fail silently. They are also the earliest, so their failures get misattributed downstream. Assert on all three.
- The worked example's headline result: the reranker promoted the chunk that actually answered the question from fused rank 4 to rank 1, and the assembled context was 3 chunks and 585 input tokens — not 50 chunks and 8,000.
- The self-retrieval assertion is the single highest-value test in the pipeline. One embed, one search, catches nearly every encoder-consistency failure.
- The embedding model is shared state between the two paths. Changing it invalidates the entire index and requires a full re-embed (
12-12). - Build in a different order than you run: eval set, assertions on silent stages, BM25 baseline, dense, exact index, fuse, rerank, assemble, ground — infrastructure last.
- Measure at stage boundaries, not only end to end. Retrieval recall and faithfulness must be reported separately or neither diagnosis is possible.
- The NVIDIA map: NeMo Curator curates, NeMo Retriever retrieves, NeMo Guardrails guards, the AI Blueprint for RAG is the reference workflow, and NIM and Triton serve the models rather than being stages
[NVIDIA-DOC].
Next: debugging RAG by separating retrieval failure from generation failure
You now have a nine-stage object and a set of boundary metrics. What you do not yet have is the procedure — the specific sequence of questions that turns "the answer was wrong" into "stage 7 is the problem" in under ten minutes. There is one question that resolves roughly half of all RAG debugging time on its own, and it must be asked before any other. Next: 07-10 names it — was the correct passage retrieved, or was it retrieved and misused? — and builds the full decision tree from that single split, because asking anything else first means you may spend a week improving a stage that was never at fault.