Week 12 · 12.2 · Tue, Oct 20 · I Do reading
Retrieving and Generating
This section explains two ways a computer can answer a question, and why one of them sometimes produces false details.
How Search Engines and Catalogs Retrieve
A search engine and a library catalog both answer a question by finding something stored earlier. These systems retrieve information, which means they find a stored item and return it unchanged. Google stores information about web pages in its index, which Google describes as a large database. When a person types a query, the search engine finds matching pages in the index and returns links to them. A library catalog works the same way. A search for a book the library owns will retrieve the record for that book. If the library does not own the book, there is no record to find, so the search comes back empty. A library catalog cannot generate a record for a book it does not hold.
A note on Google. In this reading, a Google search means the list of actual websites below the search box. It does not mean the AI Overview that Google sometimes shows automatically at the top.
How a Language Model Generates
As the previous lesson explained, a language model is made of two files: a large file of numbers called parameters and a smaller program called a runtime. Researchers have shown that large language models store factual knowledge in their parameters. A language model can generate text, which means it produces new text by predicting it one token at a time. A token can be a whole word, part of a word or a single character. First, the runtime uses the parameters to calculate how likely each possible next token is. Next, it selects one token and adds it to the text. Then it repeats the calculation until the answer is complete. For example, when a person asks a chatbot to explain how a battery works, the model will generate the explanation token by token. A chatbot answering from its parameters does not retrieve anything, because no stored copy of the answer exists for it to find. The writer Ted Chiang notes that a chatbot cannot reproduce an exact quote from a web page, because the model keeps only an approximation of the text.
How Hallucinations Happen
A model will generate text for almost any prompt, even when its parameters hold nothing reliable about the question. A hallucination is generated text that sounds correct but contains a false detail. In a 2025 paper, researchers asked a model for the birthday of one of the authors and requested an answer only if the date was known. Across three attempts, the model generated three different dates, and all three were wrong. The model is not broken when this happens. It is still predicting the next token in the usual way, and this time the prediction is wrong. The same paper explains that a birthday follows no pattern. A model often cannot predict such a fact correctly when it appeared rarely in the training text. A typo in a stored record is not an example of a hallucination, because a person made that mistake when typing the record. The system will retrieve the record exactly as it was stored.
Chiang compares a language model to a blurry JPEG, a photo saved with lossy compression. In his comparison, a hallucination is like a compression artifact, a detail filled in where the original was not kept. Lossy compression is one useful way to think about a model, although it is a comparison and leaves out parts of how a model works.
Tools That Retrieve and Generate
Some tools do both. They search first, and then they generate an answer from what they found. The AI summary at the top of a Google search page works this way. Google states that its AI Overviews come from a language model connected to its ranking systems, which find relevant pages in its index. In this tool, the search step retrieves pages, and the language model step generates the summary. The summary can still contain errors, and Google reported that some AI Overviews misread a question or treated a satirical web page as fact. Figure 1 shows both paths side by side, with a dotted path for a tool that does both.
A common mistake is copying an AI answer without checking it. The fix is to ask the same question every time, "What source can I check this answer against?", before using the answer.
Summary
A search engine or a library catalog retrieves stored items and returns them unchanged, or it returns nothing. A language model generates new text from its parameters one token at a time, and a hallucination is generated text with a false detail. Some tools search first and then generate, and any generated answer needs a source to check it against.
Sources: Google, In-depth guide to how Google Search works (2025); Google, Introduction to Large Language Models (2026); Library of Congress, Library of Congress Catalog (n.d.); Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (2020); Kalai et al., Why Language Models Hallucinate (2025); Chiang, ChatGPT Is a Blurry JPEG of the Web (2023); Reid, AI Overviews: About last week (2024).
Read the passage, then answer each question in your notebook.
You search a library catalog for a book the library does not own. What comes back?
You ask a chatbot about a book that does not exist. What comes back, and why is that different from the catalog?
A chatbot gives a confident, wrong birthday for a real person. Using the two files, where did that date come from?