Text & documents
Numbers & maths
Data & formats
Security
Development & DevOps
Artificial Intelligence
Finance
Health & Wellness
Productivity
Games & Entertainment
Multimedia & design
Business
How to use
What is RAG?

RAG (Retrieval-Augmented Generation) combines information retrieval with text generation. It works in three steps: index, retrieve and generate. This tool demonstrates steps 1 and 2.

1. Index

Split the corpus into chunks (separated by a blank line) and compute the embedding of each one: a numeric vector that captures its meaning.

2. Retrieve

When a query arrives, its embedding is computed and compared against those of the corpus using cosine similarity. The K most similar chunks are returned.

The model

In a full RAG system, an LLM receives the retrieved chunks as context and generates the answer. The embedding model is all-MiniLM-L6-v2 (~22 MB), the same one used in the semantic similarity tool.

EmbeddingsSimilarity, 2D map and RAG
Semantic similarityCosine similarity with local AI · How RAG works