AI Engineer DojoAll lessons  Courses
Free lesson · The AI Evaluation Engineer · Lesson 6

Did the Model Make That Up?

Your company's assistant answers questions from documents it retrieves, the setup called retrieval-augmented generation (RAG). The pitch is that it only says what the sources say. You've been asked to check that promise, compare models, and decide whether a cheap automatic check could catch the answers that go beyond their sources before customers see them.

How this lesson works

You'll check five real answers against their sources yourself, predict how often six models make things up, measure it on nearly 18,000 answers, and test two automatic checks. Plan on about an hour.

The data

RAGTruth is a research dataset of 17,790 answers from six language models: GPT-3.5, GPT-4, three sizes of Llama 2, and Mistral 7B. Every model was given source documents and asked to work only from them, on three kinds of task: answering a question from web passages, summarizing a news article, and describing a business from its listing data. Annotators then marked, word by word, anything an answer said that the sources don't support or that contradicts them, and wrote a note explaining each mark.

In this lesson, "made up" means exactly that: not supported by the sources the model was given. A statement can be true in the world and still count, and you'll see why that definition matters.

Source: Niu et al., 2024, "RAGTruth: A Hallucination Corpus for Developing Trustworthy Retrieval-Augmented Language Models." Dataset: github.com/ParticleMedia/RAGTruth, MIT license. Answers and sources are shown unedited.

Step 1

Check five answers against their sources

For each answer, read the question and the sources, then the answer. Decide whether it says anything the sources don't support, and if so, copy the phrase. Take your time: this is exactly the work the annotators did, and it's slower than it looks.

Data: RAGTruth, Niu, C. et al. (2024). RAGTruth: A Hallucination Corpus for Developing Trustworthy Retrieval-Augmented Language Models. ACL. github.com/ParticleMedia/RAGTruth, MIT license.