1.  [](/)
2.  [Glossary](/glossary)
3.  RAG

[Back to Glossary](/glossary)

# What is RAG

## RAG - Retrieval-Augmented Generation

Combines retrieval systems (structured or unstructured) with generative models for answering complex multimodal queries.

![Retrieval-augmented generation (RAG): a user asks a question, search retrieves the few most relevant passages from your indexed data, and the model answers from those passages placed in its prompt. The quality ceiling is retrieval, not the model: most hallucinations are retrieval failures, because the model can only answer with what it was fed.](/diagrams/foundations/rag.webp)

In RAG, retrieval sets the quality ceiling: the model answers from the passages you feed it. [See the full diagram →](/diagrams/rag)

### How It Works

RAG enhances large language models by retrieving relevant information from external knowledge sources before generating responses. This approach combines the strengths of knowledge retrieval and text generation to produce more accurate, up-to-date, and verifiable outputs.

### Technical Details

RAG architectures typically involve three components: a retriever that finds relevant documents using vector embeddings, a context builder that formats retrieved information appropriately, and a generator (usually an LLM) that produces final responses incorporating the retrieved knowledge.

### Best Practices

*   Index source materials with high-quality embeddings
*   Implement hybrid retrieval combining semantic and keyword search
*   Optimize context window usage with careful prompt engineering
*   Use chunking strategies appropriate to your content
*   Include metadata and citations in retrieved contexts

### Common Pitfalls

*   Poor chunking strategies leading to context fragmentation
*   Over-retrieval causing context dilution or LLM confusion
*   Under-retrieval resulting in knowledge gaps
*   Ignoring the recency and relevance of knowledge sources
*   Not implementing proper evaluation metrics for RAG performance

### Advanced Tips

*   Implement multi-stage retrieval pipelines (coarse to fine)
*   Use query rewriting to improve retrieval effectiveness
*   Incorporate structured knowledge alongside unstructured text
*   Explore multi-modal RAG combining text, images, and other data types
*   Implement retrieval feedback loops to refine search results

[One-click templatesStart from a templateEach template deploys a working search app on your own files.Browse templates](/templates)

[Put it to work: search your own files](https://studio.mixpeek.com/namespaces/create?mode=managed&utm_source=homepage&utm_medium=glossary_onramp&utm_campaign=mvs_onramp)

### Related Terms

[ACID](/glossary/acid)[API](/glossary/api)[Blob Storage](/glossary/blob-storage)[CLIP](/glossary/clip)[Embedding](/glossary/embedding)