Is RAG better than fine-tuning?
For giving a model facts or documents, usually yes: it is cheaper, updates instantly and can cite sources. Fine-tuning is better for teaching a consistent style, format or narrow skill. Many systems use both.
Looking up relevant documents first and giving them to the model, so its answer is grounded in real sources.
RAG stands for retrieval-augmented generation. Before the AI model answers, the application retrieves relevant information, such as help articles, code files or database rows, and puts it into the prompt. The model then writes its answer from that material instead of relying only on what it learned in training. Retrieval can use keyword search, embedding-based search by meaning, or both. RAG is how many AI apps answer questions about private or recent information the model was never trained on, and it lets them show which sources an answer came from.
RAG is usually the right first tool when a model needs your specific knowledge, because updating documents is instant and cheap compared with retraining. The answer can only be as good as what was retrieved, so most RAG problems are search problems: wrong chunks, too many chunks, or missing documents. Coding agents do a version of RAG when they search the repository and read files before editing.
A user asks an internal assistant "what is our refund window?" The app searches the policy documents, finds the paragraph saying "30 days from delivery," and sends it with the question to the model, which answers "30 days from delivery" and links the policy page. Without retrieval, the model might guess a common number instead. When the policy changes, updating the document is enough; nothing needs retraining.
RAG does not guarantee correct answers. The model can still misread or ignore the retrieved text, and if retrieval returns the wrong document, the answer will be confidently wrong. Showing sources lets users check.
All 28 terms are in the AI glossary. For models side by side, see frontier vs open-weight.
For giving a model facts or documents, usually yes: it is cheaper, updates instantly and can cite sources. Fine-tuning is better for teaching a consistent style, format or narrow skill. Many systems use both.
No. Plain keyword search works well for many cases, and small collections can be searched in memory. Vector search helps when questions use different words from the documents.
In a broad sense, yes. They search the codebase, read relevant files and put them in context before writing code. Some tools also index the repository with embeddings for faster lookup.