Retrieval-augmented generation (RAG) automatically finds relevant text in databases, documents, or knowledge bases and injects it into a language model’s prompt. It is automated context injection: external information can improve factual accuracy and supply knowledge unavailable during training without changing the model’s parameters. section 1.2.2 section 1.5.1
Figure 1.3 RAG process. It requires preprocessing the documents and storing them in a vector store, where chunks are paired with their vector representations and other metadata. The answering process is split into two phases: retrieval and generation. The first searches for chunks like the question; the second generates an answer by passing the retrieved documents to the LLM.

A RAG workflow has a preparation path and an answering path. Documents are split into retrievable chunks, stored with vector representations and metadata, then searched against a question; retrieved chunks are passed to the LLM for generation. section 1.2.2
Use RAG when current or external information is essential, while accounting for its boundary conditions:
- Choose RAG for knowledge-intensive tasks with acceptable standard response formats, because it provides information access without parameter updates. section 1.5.1
- Combine RAG with fine-tuning when external knowledge and personalized style, tone, or format are both required and sufficient high-quality examples are available. section 1.5.1
- Use RAG with few-shot learning when external knowledge is needed but training data for fine-tuning is limited. section 1.5.1
- Do not treat retrieval as specialized reasoning: accurate retrieved facts may still be insufficient for patient-specific judgment or other deep domain decisions. section 1.2.2
Drug-interaction question
A system may retrieve accurate drug-interaction information, yet a general-purpose model may not weigh age, comorbidities, and individual risk tolerance as a clinician would. Retrieval improves information access; it does not itself create specialized reasoning patterns. section 1.2.2
RAG is an alternative to relying only on prompt engineering, not a universal replacement for specialization. Where domain reasoning depth is required, fine-tuning is presented as the stronger choice; where knowledge access and behavior adaptation are both needed, a combined approach can separate those roles. section 1.2 section 1.5.1













































