AILevel 1 · AI ExplorerLesson 18

L1 · 18

How Chatbots Talk — Next-Word Prediction

A chatbot sounds clever, but its trick is simple: it guesses the next word, again and again, until a whole answer appears.

⏱ 1.5 hours🤖 Concept lesson · no coding📚 After AI-L1-17💬 Discussion + worksheet
01

Learning Goals

5 min

By the end of this lesson you can:

  • Explain that a chatbot builds a reply by predicting the next word.
  • Explain that it does not "understand" the way people do.
  • Explain why a chatbot can sound sure but be wrong.
02

Warm-Up · Finish the Sentence

8 min

Last lesson we met generative AI. Chatbots are a star example. Quick game — say the next word:

  • "Nasi …"
  • "The cat sat on the …"
  • "Twinkle, twinkle, little …"
Reveal

You probably said lemak, mat, star. You just did next-word prediction — exactly what a chatbot does, over and over.

03

New Concept · One Word at a Time

18 min

The simple trick

A chatbot is a large language model — an AI trained on a huge amount of text. To reply, it predicts the most likely next word, adds it, then predicts the next, and the next, until the answer is complete.

It's like phone autocomplete with superpowers — guessing not one word, but a whole paragraph, one word at a time.

The cat sat on the …matpredict the next word, then repeat
Predict a word, add it, predict again — that's how a whole reply is built.

No real understanding

The chatbot doesn't know what a cat is. It has learned which words usually follow which. That's why it can write smoothly yet still get facts wrong — we call a confident mistake a hallucination.

Golden rule

A chatbot predicts words; it does not check truth. Always fact-check anything important it tells you.

04

Worked Example · Built Word by Word

18 min

Watch a tiny exchange. The reply wasn't looked up whole — it was predicted one word at a time.

You

Finish this sentence nicely: "After school, Aisyah likes to..."

🤖 AI

After school, Aisyah likes to ride her bicycle around the kampung, then help her mother cook dinner before doing her homework.

Each word was the chatbot's best guess for what should come next, given everything before it. String enough good guesses together and you get a natural-sounding sentence.

The takeaway

Fluent does not mean knowledgeable. The chatbot is brilliant at sounding right — checking if it is right is still our job.

05

Try It Yourself

20 min

Use your worksheet.

01 🟢 Be the chatbot

With a partner, take turns adding one word to build a silly sentence about a trip to Penang. Notice how each word depends on the words before.

Hint

Start with "We" and keep adding one likely word each turn.

02 🟡 Why sure but wrong?

In two sentences, explain why a chatbot can sound completely sure and still be wrong.

Hint

It predicts likely words; it never checks whether the facts are true.

06

Mini-Challenge · Predict Like a Chatbot

12 min

Write a sentence start of your own. Then list the three most likely next words a chatbot might pick — and one unlikely one.

It works if your three likely words really do fit, and you can say why the unlikely one doesn't.

Show an example

Start: "On a hot day I like to drink a cold …". Likely: milo, sirap, drink. Unlikely: elephant — it doesn't fit the pattern of the sentence at all.

07

Recap

5 min

A chatbot builds replies by predicting the next word, over and over. It learned from huge amounts of text, but it doesn't truly understand — so it can be fluent and still wrong. That's why we fact-check.

Vocabulary Card

chatbot
An AI you talk to in writing that replies in natural language.
large language model (LLM)
The kind of AI behind a chatbot, trained on a huge amount of text.
hallucination
When an AI states something false while sounding completely sure.
08

Homework · Likely Next Words

≤ 20 min

Write three different sentence starts. For each, list the three words you think a chatbot would most likely predict next. Then circle the one start where you feel most sure of the next word, and say why.