Retrieval-Augmented Generation
Retrieval-augmented generation (RAG) combines a large language model with an external knowledge retrieval step: relevant documents are fetched from a corpus and injected into the prompt so the model can answer with up-to-date, grounded information rather than relying solely on its training data.
itArtificial intelligence and machine learning | OpenSkills.info
Intro
Retrieval-Augmented Generation
Retrieval-augmented generation (RAG) is an architecture pattern that connects a language model to external knowledge at inference time. Instead of relying solely on what the model learned during training, you retrieve relevant documents from your own data and include them in the prompt. The model generates its answer grounded in that retrieved context.
The pattern exists because language models have a fixed knowledge cutoff, hallucinate when they lack information, and know nothing about your proprietary data. RAG addresses all three by giving the model access to current, authoritative, domain-specific content exactly when it needs it.
The core idea
A RAG system has two stages that run on every request:
- Retrieve. Given the user's question, search a knowledge base for the most relevant documents or passages.
- Generate. Pass the retrieved content into the prompt alongside the question. The model generates an answer grounded in that context.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://learn.microsoft.com/en-us/azure/search/retrieval-augmented-generation-overview
Supports
- RAG is a pattern that extends LLM capabilities by grounding responses in proprietary content
- Challenges of RAG include query understanding, multi-source data access, token constraints, response time, and security
- Hybrid search combines keyword and vector search for better recall
- Semantic ranking re-scores results based on meaning not just keywords
- Document-level security trimming and access control at query time
- Agentic retrieval decomposes complex questions into focused subqueries executed in parallel
- Content preparation involves chunking, vectorization, and language analysis
- Maximize relevance with hybrid queries and semantic ranking
- https://docs.aws.amazon.com/prescriptive-guidance/latest/retrieval-augmented-generation-options/introduction.html
Supports
- With RAG the foundation model references an authoritative data source outside its training data before generating a response
- RAG addresses challenges of using generative AI models to answer questions from custom documents
- Options include fully managed services and custom RAG architectures
- https://www.ibm.com/think/architectures/patterns/genai-rag
Supports
- RAG is an architectural pattern enabling foundation models to produce factually correct outputs for specialized or proprietary topics not in training data
- RAG connects language models to external knowledge at inference time
- https://arxiv.org/abs/2005.11401
Supports
- RAG combines parametric memory (the pre-trained model) with non-parametric memory (retrieved documents)
- The retrieve-then-generate approach for knowledge-intensive NLP tasks
- RAG models generate responses conditioned on retrieved documents rather than relying solely on parameters
