← Learn

retrieval-augmented generation

A method where AI models retrieve data from external sources to augment their response generation, commonly used to enhance context and accuracy.

Learn

When to use it

Use retrieval-augmented generation when a model's internal knowledge is insufficient for accurate or context-rich responses. This method allows models to pull in real-time data from external sources, enabling tasks like answering current events queries or providing up-to-date technical documentation.

Quick example

In ChatGPT, when a user asks for the latest stock prices, the model needs data beyond its training cut-off. By using retrieval-augmented generation, ChatGPT connects to a financial data API to fetch current prices and integrate them into its response. Here, ChatGPT is the interface, and retrieval-augmented generation is the method that enriches the response with real-time data.

user query → retrieval-augmented generation → API call → integrate data → response

Ecosystem

Retrieval-augmented generation interacts with several components in AI systems, notably APIs and memory systems, to enhance response quality.

        ┌─ API call ──┐
query →│ retrieval-augmented generation │→ response
        └─ memory ────┘

Misconceptions

MisconceptionRebuttal
It updates model weightsIt uses external data without altering the model
It replaces internal knowledgeIt supplements, not replaces, the model's data

Trade-offs

  • Accuracy — dependent on external data quality
  • Context richness — may increase latency due to data fetching
  • Real-time updates — requires reliable external connections

Seen in