# RAG in Detail: Vectors, Retrieval and Prompt Augmentation

> RAG consists of three phases: indexing (texts into vectors), retrieval (finding the most similar texts) and augmentation (passing them to the LLM as context).

- URL: https://www.deepblue-ai.cloud/en/rag-deep-dive/
- Author: Dr. Markus Weber
- Published: 2026-03-29
- Section: Nerd Corner
- Tags: RAG, Embeddings, Vector database
- 1 min read
- Also available: [de](https://www.deepblue-ai.cloud/de/rag-deep-dive/index.html.md)

**TL;DR:** RAG consists of three phases: indexing (converting texts into vectors), retrieval (finding the most similar texts) and augmentation (passing the retrieved texts to the LLM as context).

**For everyone**

## How the pipeline works

RAG is like a research assistant: before the LLM answers, a system searches a knowledge base for the most relevant documents and hands them over as a "cheat sheet". The LLM then combines its general knowledge with the fresh information.

**For nerds**

## The three phases

### 1. Indexing

Documents are split into chunks and converted into high-dimensional vectors by an embedding model. These vectors represent the semantic meaning and are stored in a vector database (e.g. Pinecone, Weaviate, ChromaDB).

*Interactive demo: [The space of meaning](https://www.deepblue-ai.cloud/en/ai-lab/#lab-embedding-space)*

### 2. Retrieval

The user's query is converted into a vector as well. A nearest-neighbor search (cosine similarity or dot product) then fetches the most similar chunks from the database. Typically: the top 5 to top 20 results.

*Interactive demo: [Real embeddings & semantic search](https://www.deepblue-ai.cloud/en/ai-lab/#lab-semantic-search)*

### 3. Augmentation

The retrieved texts are inserted into the LLM's prompt, and the model then answers using its internal knowledge plus the external documents. Prompt template: "Based on the following sources: [CHUNKS]… Answer: [QUESTION]"

### Challenges

Chunking strategy (too large = noisy, too small = missing context), embedding quality, retrieval precision vs. recall, and costs for large knowledge bases.

## Why it matters in 2026

RAG is the enterprise standard for knowledge-based AI. The challenges are shifting from "whether to use RAG" to "how good is your RAG": better chunking strategies, hybrid search and multi-step retrieval.
