Codiqo

Understanding AI · lesson 48 of 60 · about 5 minutes

Why Chatbots Make Things Up

Chatbots sometimes state false things with total confidence. Understand why, so you know when to check.

What you'll learn

  • Explain what a hallucination is
  • Explain why next-word prediction can produce false facts
  • Know which answers need checking most

Likely, not true

A chatbot predicts text that sounds likely. Most of the time likely and true line up. But when it doesn't really know, it still produces something that sounds right: a made-up quote, a book that doesn't exist, a wrong date.

This is called a hallucination. The chatbot isn't lying on purpose; it's doing what it was trained to do: produce plausible text.

When to be extra careful

Be most careful with exact details: names, numbers, dates, quotes, links and references, and anything rare or very recent. Those are where plausible-sounding guesses go wrong most often.

The chances for the next word don't know true from false. A wrong year can win if it looks likely.

next_word_chances = {"1999": 0.4, "2001": 0.35, "2003": 0.25}
true_answer = "2001"
guess = max(next_word_chances, key=next_word_chances.get)
print(guess, guess == true_answer)

Output

1999 False

Tip

Sounding sure and being right are different things. Check the details that matter.

Now try it yourself

This lesson is free in Codiqo, with 6 questions on what you just read. You can only learn to code by writing code, so it ends with a short program you write yourself, which we run and check straight away.