The Wider Lens logoThe Wider Lens
← All topics

Intermediate

What is RAG?

Retrieval-Augmented Generation: giving models access to your documents.

RAG connects a language model to external knowledge. When you ask a question, the system first searches a document store for relevant passages, then feeds those passages to the model along with your question.

The documents are converted into embeddings (numerical vectors) and stored in a vector database, which finds passages by semantic similarity rather than keyword matching.

RAG reduces hallucinations about facts the model wasn't trained on, keeps answers current without retraining, and lets models cite sources. It's the standard architecture for enterprise AI assistants and 'chat with your docs' products.

Key points

  • Retrieve relevant docs, then generate
  • Embeddings enable semantic search
  • Reduces hallucinations, adds citations
  • Keeps knowledge current without retraining