Skip to content
Minute Campus.

How AI actually worksLesson 071 min

How can a chatbot answer from documents it was never trained on?

A model on its own knows only its training data, so an app can hand it the right pages. It stores documents as short passages with their embeddings, finds the passages closest in meaning to your question, and pastes them into the prompt. This is retrieval-augmented generation, or RAG. The model is not retrained, and a wrong search result gives a wrong answer.

Remember

With RAG, an answer is only as good as the passages the search finds.

Transcript

The lesson, word for word.

Read it at your own pace, or search the page for a term.

How can a chatbot answer from documents it was never trained on? It sits an open-book exam. A model on its own only knows its training data. It has never seen your company handbook, or yesterday's news. So the app around it does three things. One. It cuts the documents into short passages and stores each one with its embedding, its place on the meaning map. Two. When you ask a question, it finds the passages closest in meaning to it. Three. It pastes those passages into the prompt, above your question, and says: answer using this. This is called retrieval-augmented generation, or RAG. The model was not retrained. It was handed the right page at the right moment. And if the search brings back the wrong page, the answer will be wrong too. Next: does ChatGPT learn from your chats?

Questions? Comment on the lesson on YouTube

New lessons every day.

Follow Minute Campus where you already scroll.