PHASE 2 — CONTINUES FROM: SOURCE → SEARCHABLE INDEX

RAG in Production — Phase 2
Query, Retrieval & Generation

A query enters, a validated response leaves. Every branch below now runs inside a live request — latency is a first-class force alongside scalability, resilience, and cost.

SCALABILITY RESILIENCE COST LATENCY
Phase 1's triangle gains a fourth force here: every layer below sits inside a live user request, not a batch job.
6

Query Processing

route by query type → rewrite / decompose / HyDE → embed
7

Retrieval

vector / BM25 / hybrid → filter (ACL) → re-rank
8

Context Assembly

dedupe → trim → order (lost-in-middle) → compress → template
9

Generation

adapter → LLM call → parse / validate → repair loop
Query Processing
Retrieval
Context Assembly
Generation
⋯ dashed = conditional / routed path
◆ diamond = decision point
⚡ = routing decision (Phase 1 principle)
Hover any box for its role. Moving dots trace the direction of data flow through each layer. This picks up directly where the Phase 1 diagram's Storage & Indexing layer ends.