RAG vs Semantic Search
People often think RAG is just semantic search. Semantic search only finds the passages that match a question by meaning. RAG is the whole system: a search finds the passages, then a language model reads them and writes the answer. The search inside RAG can be semantic, keyword or both.
Retrieval-Augmented Generation (RAG)
First find the right pages, then let the model answer from them.
Retrieval-augmented generation is a way to make a language model answer from your own documents. When a question comes in, a search finds the most relevant passages. Those passages are put into the prompt next to the question. The model then answers from that text and can point to its sources. It lets a model use private or fresh facts without any new training. The name comes from a 2020 research paper.
Semantic Search
Search that finds text by what it means, not by its exact words.
Semantic search finds text by its meaning rather than by matching the exact words. The question and every stored text are turned into embeddings. The texts whose embeddings sit closest to the question come back first. So a search for 'fix a flat tyre' can find a page about 'mending a punctured wheel'. It is weaker on exact names, codes and rare terms, which is where keyword search does better.
In one line
- Retrieval-Augmented Generation (RAG)
- First find the right pages, then let the model answer from them.
- Semantic Search
- Search that finds text by what it means, not by its exact words.