Technology & AI
What is RAG (Retrieval-Augmented Generation)?
RAG is the technique of retrieving relevant information (from a DB, docs, web) before generating an LLM response — combines retrieval + generation.
LLM alone only knows what it saw in training (date cutoff, no private data). RAG fixes that: takes the question, retrieves relevant docs (via embeddings + vector DB), and injects them as context.
It's how SaaS chatbots for docs work: search doc embeddings, build prompt with found chunks, LLM answers citing them. Cheaper than training your own model.
Frequently asked questions
Does RAG replace fine-tuning?
In almost all cases. Fine-tuning is expensive, requires a dataset; RAG only needs the docs and works out-of-the-box.
Why RAG and not pass everything in context?
Cheaper (sends only the relevant), faster, and avoids "lost in the middle" in huge contexts.