RAG Terminology
RAG Terminology
1. What does each term actually mean?
The trick to these 8 terms: some are processes (actions), some are components (the "who" that does the action), and some are just data (the "things" flowing through the pipeline). Sorting them into these 3 buckets makes everything click.
| Term | Category | Simple Meaning |
|---|---|---|
| Retrieval | Process | Searching for and finding the most relevant chunks for a question |
| Retriever | Component | The system that performs retrieval — usually an embedding model + a search index, working together |
| Augmentation | Process | Combining the retrieved chunks with the user's question into one final prompt |
| Generation | Process | The AI writing the final answer, based on the augmented prompt |
| Generator | Component | The system that performs generation — this is the LLM itself (GPT, Claude, Llama, etc.) |
| Documents | Data | The original, full-length source files, before any processing — a whole PDF, webpage, or article |
| Chunks | Data | Small pieces a document gets cut into — these (not whole documents) are what actually get stored and searched |
| Context | Data | The specific chunks retrieved for this question, inserted into the prompt |
Interesting gap: Retrieval has a Retriever, and Generation has a Generator — but Augmentation has no widely-used "Augmenter." That's because augmentation is usually just prompt-template code (string-building), not a trained model. Good one to remember for interviews.
2. Why does precise terminology matter?
- Interviewers test this directly — "what's the difference between a document and a chunk?" is a real, common question
- Mixing up Retrieval (the action) with Retriever (the component) makes bug reports and design discussions confusing ("retrieval failed" vs "the retriever crashed" mean different things)
- "Context" has two different common meanings — knowing which one is meant avoids miscommunication (especially when discussing RAG vs Long Context, from the earlier notes)
- Clear vocabulary makes RAG papers, blogs, and documentation much easier to follow
3. Comparison — Commonly Confused Pairs
| Confusing Pair | How to tell them apart |
|---|---|
| Retrieval vs Retriever | Retrieval = the action. Retriever = the system that performs that action. |
| Generation vs Generator | Same pattern: Generation = the action of writing the answer. Generator = the LLM that does it. |
| Document vs Chunk | A Document is the whole original file. A Chunk is a small piece cut from it. |
| Chunk vs Context | A Chunk just sits in storage until needed. It becomes Context only once it's been retrieved for a specific question and placed into the prompt. |
| Context vs Context Window | "Context" (RAG sense) = the specific retrieved info for one question. "Context window" = the model's total input capacity — this exists whether or not RAG is even used. |
Simple rule: if a word ends in "-al" or "-ion" (Retrieval, Generation, Augmentation), it's an action. If it ends in "-er/-or" (Retriever, Generator), it's the thing doing the action.
4. Diagrams
Where each term fits in the pipeline:
flowchart LR
DOC[Documents] -->|cut into| CH[Chunks]
CH -->|stored and searched by| RET((Retriever))
Q[User Question] --> RET
RET -->|Retrieval| CTX[Context - the retrieved chunks]
CTX -->|Augmentation| PROMPT[Final Prompt - Question plus Context]
Q --> PROMPT
PROMPT --> GEN((Generator))
GEN -->|Generation| ANS[Answer](Circles = components that do the work. Rectangles = data flowing through.)
Zooming into Documents vs Chunks — one becomes many:
flowchart TD
D[One Document] --> C1[Chunk 1]
D --> C2[Chunk 2]
D --> C3[Chunk 3]
D --> C4[Chunk 4]5. Code Example — Terms Mapped to Actual Code
# ============================================
# DOCUMENTS: the original, full-length source text
# ============================================
documents = [
"Retrieval-Augmented Generation grounds LLM answers in real data.",
"Chunking splits large documents into smaller retrievable passages."
]
# ============================================
# CHUNKS: documents get cut into smaller pieces
# (a real document usually becomes MANY chunks — simplified to 1:1 here)
# ============================================
chunks = documents
# ============================================
# RETRIEVER: the component that performs retrieval
# = embedding model + search index, working together
# ============================================
embedder = SentenceTransformer('all-MiniLM-L6-v2')
chunk_embeddings = embedder.encode(chunks).astype('float32')
index = faiss.IndexFlatL2(chunk_embeddings.shape[1])
index.add(chunk_embeddings)
def retriever(query, k=2):
query_vec = embedder.encode([query]).astype('float32')
_, indices = index.search(query_vec, k)
return [chunks[i] for i in indices[0]]
# ============================================
# RETRIEVAL: the ACT of calling the retriever
# CONTEXT: what comes out of it — the chunks found for THIS question
# ============================================
query = "What does chunking do?"
context = retriever(query)
# ============================================
# AUGMENTATION: combining the question + context into one prompt
# (just string-building — no separate "model" involved)
# ============================================
prompt = f"Context:\n{context}\n\nQuestion: {query}\nAnswer:"
# ============================================
# GENERATOR: the LLM itself
# GENERATION: the ACT of calling it to produce the final answer
# ============================================
# answer = generator_llm.generate(prompt) # send `prompt` to any LLM here
print(prompt)`documents` → the raw text. `chunks` → what actually gets embedded (same list here, simplified). The `retriever()` function *is* the Retriever component; calling it *is* Retrieval; what it returns *is* Context. Building `prompt` *is* Augmentation — just an f-string, no ML model. The commented-out final line is where Generation happens, performed by the Generator (any LLM).
(This reuses the exact retriever mechanics already tested in the earlier notes — only names and comments changed, to map them to these terms.)
6. Common Mistakes Students Make
- Using "retrieval" and "retriever" interchangeably — one is the action, one is the system doing it; interviewers notice this mix-up
- Thinking documents get searched directly — it's chunks that get embedded and searched, not whole documents
- Using "context" without saying which kind — retrieved context (RAG) and context window (model capacity) are related but different things
- Assuming there's an "Augmenter" model — in most systems, augmentation is just prompt-template logic, not a trained component
- Calling the whole RAG pipeline "generation" — Generation is specifically just the final answer-writing step, not retrieval + augmentation too
- Forgetting a chunk can become context more than once — the same stored chunk can be retrieved (and become "context") for many different future questions
7. Interview Q&A (Simple Answers)
Q1. What's the difference between Retrieval and a Retriever?
Retrieval is the action of searching for relevant chunks. The Retriever is the actual system (embedding model + search index) that performs that action.
Q2. What's the difference between a Document and a Chunk?
A Document is the whole original file. A Chunk is a small piece cut from a document — chunks, not whole documents, are what get stored and searched.
Q3. Does "Context" always mean the same thing?
No. It usually means either (1) the retrieved chunks inserted into a prompt for this question, or (2) the "context window" — the model's total input capacity, which exists independent of RAG. Always clarify which one you mean.
Q4. Is there a separate "Augmenter" component, like there's a Retriever and a Generator?
Not usually — augmentation is typically just prompt-building code (formatting text into a template), not a trained model.
Q5. If someone says "the generation is bad," what part of the system are they talking about?
Specifically the LLM's answer-writing step — not the search step. If the retrieved chunks were fine but the final answer is still wrong, the problem is in generation, not retrieval.
Q6. Can one document produce many chunks? Can one chunk be reused as context for different questions?
Yes to both. Chunking usually splits one document into many pieces. And the same stored chunk becomes "context" again each time a new question happens to retrieve it as a close match.