LearnAI home

Under the Hood ยท Lesson 7

Hallucinations: When AI Confidently Lies

Why models make things up and how to catch them doing it.

The Confident Wrongness Problem

Ask an LLM for a fact it doesn't know, and something strange happens: instead of shrugging, it often invents an answer that is fluent, specific, formatted beautifully, and completely made up. This is a hallucination: output that sounds plausible but isn't true.

The unsettling part isn't that AI makes mistakes. It's the delivery. Hallucinations arrive with the same confident tone as correct answers. No stammering, no "I think maybe...?" Just polished, authoritative fiction.

Why Models Make Things Up

Remember Lesson 3: an LLM generates text by predicting plausible next tokens. Read that word carefully. Plausible. Not verified. Not true. Plausible.

The model learned what factual answers look like (their shape, tone, and formatting) from millions of examples. So when you ask about something it doesn't actually know, the machinery does exactly what it was built to do: produce text shaped like a correct answer. A citation-shaped citation. A statistic-shaped statistic. The prediction engine has no built-in fact-checking department; truth and truthiness feel identical from the inside.

A hallucination is not a malfunction. It's the normal text-prediction process running without ground truth to anchor it. That's why it can't be fully "patched out": it's a side effect of how generation works. Newer models hallucinate less and decline to answer more, but the risk never hits zero.

A Hallucination, Dissected

Here's a demo of the failure mode. The book below does not exist. Everything in this output is fabricated, so watch how real it looks:

DEMO: every detail below is fabricated

USER: Tell me about the 1962 novel "The Cartographer's Daughter" by Margaret Ellsworth.

AI: "The Cartographer's Daughter" (1962) is Margaret Ellsworth's acclaimed third novel, following a young mapmaker's daughter in colonial Singapore. It won the Hawthorne Prize in 1963, sold over 2 million copies, and was adapted into a 1968 film starring Julie Andrews. Critics praised its "luminous prose" (The New Yorker, March 1963).

Look at those moves: a precise year, a named prize, a sales figure, a film adaptation, a quoted review with a date. Specificity feels like credibility. That's exactly what makes hallucinations dangerous. The model wasn't lying maliciously; it was asked to complete text about a book, so it generated the most book-summary-shaped text it could.

This Has Real Consequences

In 2023, a lawyer famously submitted a legal brief written with ChatGPT's help. It cited multiple court cases as precedent. The cases did not exist, complete with realistic case numbers, judges, and quotes. The court was not amused; sanctions followed, and "lawyer cites fake AI cases" became a recurring genre of news story.

The lesson isn't "never use AI." It's "never skip verification when the stakes are real."

How to Catch a Hallucination

Your field guide:

  1. Be suspicious of specifics you can't trace. Names, numbers, dates, quotes, citations. The more precise and the less checkable, the more scrutiny it deserves.
  2. Ask for sources, then actually check them. Hallucinated sources usually crumble on contact: the link 404s, the paper doesn't exist, the book has no ISBN.
  3. Cross-check independently. Verify claims against a search engine or trusted reference, not by asking the same model "are you sure?" (it can double down politely).
  4. Know the danger zones. Obscure topics, niche people, exact statistics, legal and medical citations, and events after the model's knowledge cutoff are prime hallucination habitat.
  5. Scale your paranoia to the stakes. Brainstorming taco names? Whatever, vibes only. Legal filing, medical decision, journalism, anything with your name on it? Verify every factual claim.

There's also a better way to ask. Prompts that demand an answer get an answer, real or not. Prompts that leave room for uncertainty get honesty more often:

โŒ Weak prompt

Prompt

Give me the exact citation for the Supreme Court case about drone privacy from 2019.

Output

Certainly: Ramirez v. National Aerial Systems, 588 U.S. 214 (2019), decided 6-3, established the 'reasonable altitude' doctrine for drone surveillance.

The prompt presupposes the case exists and demands a specific citation, so the model produces one, real or not. Case-citation-shaped text is exactly what next-token prediction is great at fabricating.

โœ… Good prompt

Prompt

Are you aware of any 2019 Supreme Court case specifically about drone privacy? If you're not certain one exists, say so rather than guessing.

Output

I'm not aware of a 2019 Supreme Court case specifically about drone privacy, and I'd rather not guess at citations. For legal research, please verify against a legal database like Westlaw or CourtListener.

By making 'I don't know' an acceptable answer, you stop forcing the model to fill the gap with plausible fiction. Explicit permission to be uncertain is one of the cheapest hallucination defenses there is.

Golden rule: treat an LLM like a brilliant, well-read colleague who absolutely will not admit when they're guessing. Wonderful for drafts and ideas. Not a citation machine.

Checkpoint

Models predict plausible text, not verified truth, so verify specifics, demand checkable sources, and give the model permission to say "I don't know."

Spot-the-Fabrication Quiz

๐Ÿ“ Quiz

Question 1 of 4

Why do LLMs hallucinate?

Found this useful? Pass it on.