Retrieval-augmented generation is the technique that lets a language model answer with fresh, cited facts instead of hallucinating from its training data. It runs in five distinct stages, and each stage is a filter you can pass or fail.
Step 1 — Chunking. Somewhere before your page ever enters an AI search product, it has been crawled by a web-scale spider (BingBot for ChatGPT/Copilot, PerplexityBot for Perplexity, Googlebot for Google AI Overviews, and so on). The HTML gets stripped, structured content is extracted, and the page is split into chunks — usually 200-500 tokens (roughly 150-380 words) each. Different vendors chunk differently: some by heading, some by fixed token count, some by semantic paragraph. What matters for you: the chunk boundary decides what gets embedded as a unit. A 900-word section with no subheadings will be arbitrarily split — and the split may cut across your answer.
Step 2 — Embedding. Each chunk is passed through an embedding model, which converts the text into a 768- or 1536-dimension vector. Semantically similar chunks land near each other in this vector space — a chunk about "customer acquisition cost" ends up near "CAC" and "cost per new customer" even without shared keywords. Every chunk in the vendor's index is embedded and stored, indexed for fast nearest-neighbour search.
Step 3 — Retrieval. When a user query arrives, the query is embedded using the same model, and the vector store returns the top-k most similar chunks. K is usually 20-100. Modern production RAG systems run this in parallel with BM25 (keyword) search and fuse the results — a pattern called hybrid retrieval — because pure vector search misses exact-match queries and pure keyword search misses semantic matches. Reciprocal Rank Fusion is the most common fusion method.
Step 4 — Reranking. The top-k candidates from retrieval are passed through a cross-encoder reranker — a more expensive model that scores each candidate against the query with full attention. This is where a lot of the ranking work actually happens. Reranking catches relevance that embedding similarity misses: a chunk that mentions the query terms but doesn't answer the question gets down-ranked; a chunk that directly answers gets promoted. The output is a shortlist of maybe 5-15 chunks that will be shown to the language model.
Step 5 — Generation and citation. The shortlisted chunks are injected into the language model's context along with the query, and the model writes the answer, citing sources it used. This is where the last drop-off happens: AirOps' 2026 analysis of ChatGPT retrieval (548,534 pages retrieved across roughly 15,000 prompts, as reported by Search Engine Land) found only about 15% of retrieved pages actually appear as citations in the final answer. The model reads them all, but attributes only what it actually pulled from.