AI Expert

Guides/Retrieval architecture

Retrieval architecture cheat sheet

Retrieval quality dominates many RAG launches: if you fetch the wrong chunks, the generator confidently rehearses the wrong facts. Use this page to align with engineers on pipeline stages, pattern upgrades, and when extra complexity pays off.

End-to-end pipeline (canonical mental model)

Offline indexing runs batch or streaming; online path executes per query. Bottlenecks usually appear around chunk boundaries, embedding mismatch, and rerank latency — call those out explicitly in PRDs.

Ingest
Chunk
Embed
Index
Query
Retrieve
Rerank
Assemble
Generate
Offline path through dashed boundary (often batched); query path runs at request time — rerank and assembly are common upgrade points.

Pattern menu & tradeoffs

Start simple, measure recall@k and grounded answer rate, then layer hybrid search or reranking where queries fail — not before you have a labeled failure set.

PatternCore ideaUpsideWatch-outs
Naive vectorEmbed chunks; nearest neighbors to queryFast to ship; few moving partsLexical mismatch; duplicate chunks hurt recall
Hybrid (sparse + dense)BM25-style + vectors fused or rerankedBetter recall on keywords & SKUsMore infra; tuning fusion weights
+ Cross-encoder rerankRetrieve wide, rerank top-K with heavier modelPrecision jump on ambiguous queriesLatency & cost at query time
Agentic retrievalModel plans sub-queries, tools, iterative fetchHandles multi-hop reasoningFragile loops; hardest to eval

Complexity vs illustrative quality uplift

Bars encode engineering + ops burden versus expected retrieval lift — agentic retrieval breaks this curve when tool loops mis-fire, so budget eval harnesses before chasing autonomy.

Complexity vs illustrative quality uplift

Quality uplift assumes tuned baselines — agentic can regress if loops go wrong.

Use to sequence investments — ship readable baseline, then hybrid, then rerank where precision hurts.

PM checkpoints

  • Define freshness SLAs for corpora that feed customer-visible answers.
  • Instrument citation coverage — percent of answers that reference retrieved passages when policy demands it.
  • Pair retrieval upgrades with regression suites so embedding or reranker swaps do not silently regress recall.