Do not use RAG merely because an application contains documents and an LLM. RAG is useful when a model must synthesize answers from a changing or private corpus that cannot fit directly in the request. It also creates an ingestion pipeline, retrieval failure modes, access-control surface, latency, evaluation work, and a document lifecycle you must operate.
Start with the smallest architecture that can satisfy the task.
The decision tree
Does the output need external or private facts?no -> prompt/model baseline; evaluate before adding retrievalyesCan the necessary context fit reliably in the request?yes -> supply direct, versioned contextnoDoes the user mainly need documents or exact records?yes -> search/filter and show resultsnoIs the source a live structured system or action API?yes -> query a typed tool/APInoIs the need primarily behavior/style rather than facts?yes -> prompting or fine-tuningno -> evaluate RAG against the simpler baseline
These options can be combined. The point is to assign each need to the right mechanism rather than making vector retrieval the universal middle layer.
Use direct context when the source is small
If the relevant policy, schema, or document set fits comfortably in the model request, pass it directly with a version identifier. This removes chunking and retrieval uncertainty and makes reproduction easier.
Direct context fits:
- one contract or short policy selected by the application;
- a bounded code diff and its surrounding files;
- a small product catalog already filtered by deterministic logic;
- structured records converted into a compact representation.
Measure token cost and the model's ability to use long context. “It fits” does not guarantee it will be attended to correctly, but adding retrieval cannot help if it frequently omits required evidence.
Use search when the user needs sources, not synthesis
If a user wants to find documents, exact clauses, tickets, or records, return ranked results with snippets and filters. Generation can hide missing evidence or merge distinct records into a fluent answer.
Prefer search for:
- legal or compliance discovery where the source text must be inspected;
- exact identifiers, error messages, product codes, and names;
- exploratory browsing with facets and sorting;
- high-risk decisions where synthesis is not independently verified.
You can add an optional summary after showing the evidence. Keep search quality measurable on its own.
Use tools for live structured truth
A vector index is a poor authority for account balance, inventory, shipment state, access permissions, or appointment availability. Query the system of record through a typed API. The tool should validate identity, inputs, authorization, and freshness outside the model.
For a support assistant:
policy explanation -> retrieve approved policy textcurrent order state -> call order APIrefund action -> propose, authorize, approve, execute idempotently
Do not embed database snapshots and call them real time. Use RAG for explanatory documents and tools for current records and actions.
Use deterministic code for known rules
If the business can state the rule precisely, implement and test it as code. Tax calculations, permission checks, eligibility thresholds, routing tables, and irreversible approval rules should not depend on approximate semantic retrieval or generated interpretation.
An LLM may extract candidate fields from unstructured text. Deterministic code should validate and decide when the rule itself is known.
Use prompting or fine-tuning for behavior
Retrieval supplies information at inference time. It is not the direct solution for consistent tone, output structure, classification boundaries, or specialized behavior.
- Use instructions and examples for format, tone, and task procedure.
- Use structured outputs and validators for machine-consumed contracts.
- Consider fine-tuning when a stable, narrow behavior remains weak after prompting and you have a representative training and evaluation set.
- Keep RAG when the answer must cite changing external knowledge.
AWS's current comparison notes that RAG can incorporate changing documents and references, while fine-tuning is slower to update and is more appropriate for other behavior changes such as specialized output or summarization. Neither technique removes the need for evaluation.
Avoid RAG when the corpus cannot support the task
Retrieval cannot recover facts that are absent, inaccessible, obsolete, or too ambiguous in the source collection. Before building an index, sample the corpus and label representative questions as answerable, partially answerable, conflicting, or unanswerable.
Stop and repair the source when:
- documents contradict without authority or effective dates;
- access rules cannot be represented and tested;
- deletion and revocation cannot propagate;
- scans, tables, or layout lose critical meaning during extraction;
- the task requires data the organization does not possess;
- no owner is accountable for source quality.
The RAG failure-mode decision tree helps separate source, ingestion, retrieval, context, and generation failures.
Avoid RAG when the economics do not close
RAG adds ingestion compute, embeddings, storage, retrieval, possible reranking, context tokens, monitoring, and reindexing. For a small low-volume corpus, direct context or conventional search may be cheaper and easier to operate. For a frequently changing corpus, indexing lag and update load may dominate.
Create a per-success budget:
monthly ingestion and indexing+ retrieval/reranking per request+ extra model input tokens+ evaluation and operations--------------------------------/ successful supported tasks
Compare it with the simplest baseline, not with an imagined system that has no maintenance cost.
Architecture selection matrix
| Need | Default starting point | Evidence to move beyond it |
|---|---|---|
| General reasoning with no private facts | Prompt/model baseline | Repeatable missing-knowledge failures |
| One small known document | Direct context | Context limit or selection failures |
| Find exact documents or records | Lexical/hybrid search | Users need measured synthesis |
| Current structured facts | Typed API/tool | Source lacks query interface |
| Deterministic policy or calculation | Code/rules | Rule cannot be represented deterministically |
| Changing private corpus with citations | RAG | Baseline already satisfies quality/cost |
| Corpus-wide themes or relationships | Graph/structured analysis | Conventional retrieval succeeds on target queries |
| Stable specialized behavior or style | Prompting, then fine-tuning experiment | Prompt baseline misses measured target behavior |
Run a baseline experiment
Build 30–100 representative cases with expected sources and task outcomes. Compare:
- model without external context;
- direct context or search-only baseline;
- typed tools for structured facts;
- the proposed RAG pipeline.
Measure answer correctness, source/citation correctness, refusal behavior, latency, cost, and permission failures. Segment by exact lookup, synthesis, multi-document, current-record, and unanswerable questions. Choose RAG only for slices where its additional machinery produces meaningful value.
Microsoft's RAG guidance recommends gathering representative documents and queries before choosing chunking, embedding, retrieval, and end-to-end evaluation strategies. Follow that order. Architecture should answer an observed task distribution.
If RAG wins, use the production RAG architecture guide and the RAG evaluation metrics guide to build the release gate. If the task needs corpus-wide relationships, compare the additional graph pipeline with GraphRAG versus conventional RAG.




