Loading…
Glossary term
Retrieval-augmented generation: fetching relevant documents and giving them to a model to ground its answer.
Retrieval-augmented generation connects a model to a document collection. When a question arrives, the system searches for the most relevant passages, adds them to the prompt and asks the model to answer using them.
That gives the model fresh or private knowledge and a source to cite, without retraining.
A minimal RAG loop
query_vec = embed(question)
passages = vector_db.search(query_vec, top_k=3) # retrieve
prompt = "Answer using only these sources:\n" + "\n".join(passages) + f"\nQ: {question}"
answer = model(prompt) # generateRAG is the most common way to make AI answer from a company's own data and to reduce made-up answers.