Overview
Query → embed → top-k → stuff into prompt → generate — the five-step pattern behind every RAG tutorial.
Why it matters
Strip away the tooling and every basic RAG system runs the same five-step loop:
- Query — the user asks a question in natural language.
- Embed — the query is converted into the same vector space as the stored chunks, using the same embedding model that indexed the documents (mixing models here silently breaks retrieval).
- Top-k retrieval — the vector store returns the k chunks whose vectors are closest to the query vector (k is often 3-10; too small and you miss context, too large and you drown the LLM in noise and cost).
- Augment — this is the step people underestimate: the retrieved chunks are literally pasted into the prompt, usually with instructions like 'answer only using the context below.' The LLM never touches your database directly — it only ever sees whatever text got stuffed into this prompt.
- Generate — the LLM produces an answer conditioned on that augmented prompt.
This loop is called naïve precisely because retrieval is a single, flat, one-shot vector search: there's no re-ranking, no query rewriting, no traversal of relationships between chunks, and no verification that the top-k chunks actually contain the answer. Every advanced pattern you'll see later — hybrid retrieval, re-ranking, GraphRAG — is a targeted upgrade to exactly one of these five steps, most often step 3.
