AI Anatomy Class · Part 10 · The world after ChatGPT
88. Look it up, then answer
Q. How do you ask an AI about something it never learned, like the date of your school festival?
- Let's ask the model when our school festival is. A model only knows text it saw in training. It has never seen our school's notices.
- But it still continues with the next piece, so it can make up a plausible date. That's the hallucination from chapter 84.
- The fix is simple: look it up before answering! Search the pile of school documents for ones related to the question.
- Turn the question and documents into vectors and pick the closest (chapter 8). The festival notice is the closest.
- Put the found document and the question into the model as one text, along with the request 'Answer using the document.'
- Now the model just copies the date written in the document. It can even cite which document it used as its source.
- This is retrieval-augmented generation, or RAG, a name from 2020. It uses new information without retraining the model.
- But if the document is wrong, so is the answer. Find last year's notice and you get last year's date. So check the source yourself.
Chapter summary
- A model only knows text it saw in training. Ask it something else, and it may make things up (hallucination, ch. 84).
- RAG: search for documents close to the question, put them in the prompt with it, and have the model answer.
- An answer with a source is still wrong if the document is wrong. Check the source yourself.