Skip to main content

Playground · How RAG Works

Retrieval-Augmented Generation

RAG lets language models answer questions by retrieving relevant facts from a knowledge base, then generating a grounded response. Ask a question below and watch the retrieve → augment → generate pipeline in action.

1 Retrieve

Score documents by relevance and retrieve the top matches.

Type a query to see retrieved documents.

2 Augment

Inject retrieved documents into the prompt as context.

No query yet.

3 Generate

Compose a grounded answer with citations.

No answer yet.

Why RAG?

LLMs have a knowledge cutoff and can hallucinate. RAG solves both: retrieve up-to-date facts from a trusted knowledge base and ground the model's answer in those sources. Every claim can be traced back to a document, making outputs verifiable and trustworthy.

This demo uses keyword-based retrieval (word overlap, ignoring stopwords). Real RAG systems — including the upcoming Ask bigspark assistant — use embedding-based semantic search to find documents that match the meaning of the query, not just the words. For more on embeddings, see the Embeddings playground.