Léxico / TÉCNICA
RAG (Retrieval-Augmented Generation)
A technique that enhances AI responses by retrieving relevant information from external sources before generating an answer.
RAG combines a retrieval step with text generation. Instead of relying solely on what the model memorized during training, RAG fetches up-to-date, relevant documents and feeds them into the prompt.
How RAG Works
- Your query is converted into an embedding
- Similar documents are retrieved from a vector database
- The retrieved context is injected into the prompt
- The model generates an answer grounded in real data
Why RAG Matters
- Reduces hallucinations — answers are backed by actual sources
- Stays current — no need to retrain the model for new information
- Respects context windows — only the most relevant chunks are included