AI engineering

Stage 1 · Lesson 6 of 8

Why models hallucinate

How LLMs work: tokens and context

A is a confident answer that is false. Think of a made-up citation, an method that does not exist, or a company policy that was never written. It comes from how models work.

They predict likely text, and a plausible-sounding answer is often more likely than "I do not know". This is especially true for rare facts, or anything after the (the date the model's training data ends). You cannot prompt it away entirely, but you can shrink it.

Give the model the source text. Ask it to answer only from that text and to cite it. Give it an explicit way to refuse.

Check claims in code where you can. This is the problem and exist to manage.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Keep handy

Also worth your time

Mark this stage as not done?