Tokencito Game of the day Play

What is RAG (retrieval-augmented generation)?

RAG (retrieval-augmented generation) is a technique where, before answering, the system searches your documents for the chunks that best match the question and passes them to the model along with it. The model answers with that text in view. It makes things up less, though it can still get things wrong.

❓A question arrives🔎It searches your documents📄It adds the passages💬It answers from them

Put it to the test

A question from the app. Pick an answer.

A store's bot reads its up-to-date PDFs, yet quotes an old price. Why?

Start playing on the web

How it works, step by step

Before any question: the documents are split into chunks and each one gets its embedding, a list of numbers that represents its meaning. That gets stored.

When a question comes in: its embedding is computed, the closest chunks are found, they are placed in the context along with the question and the model answers. The model did not learn anything new: it reads those chunks on the spot, as if you had pasted them into the chat yourself.

Why not paste in every document

The context window has a limit, and every token that goes in is paid for and processed. A hundred PDFs will not fit in one question, and even if they did, sending them whole every time would be slow and expensive. RAG sends only what looks useful for that question.

The bot that answers from a business's PDFs

A small distributor uploads its catalog, shipping terms and opening hours, and connects a bot to WhatsApp. When someone asks "do you ship out of town?", the bot searches those files and answers with what they say, not with what sounds likely. For a small business it is the most direct way to get an assistant that knows its own data without training any model.

Common mistakes

"With RAG it no longer hallucinates." It makes things up less, but it can pull the wrong chunk, mix two together or fill in with what is likely when the answer is not in the documents: that is still a hallucination. "If it cites the source, it is right." It can cite a document that does not say that: open the citation. "RAG trains the model on my data." It does not change the model: your documents are read on every question, and to update them you just change the file and recompute its embeddings.