AI Origins · Lesson 03

Build a Next-Word Robot

See how a computer can sound clever without understanding a story: it remembers nearby words, counts what came next, and makes a guess.

  1. 1
    Give it examplesChoose a short story for the robot to study.
  2. 2
    Give it a clueStart a sentence with words from the story.
  3. 3
    Study its guessUse the probability bars to explain its choice.

Quick start: The Animal Story is ready. Teach the robot, then continue our class.

Pick a story to get started.

Step 3 · Result

See the Pattern

The starter phrase stays plain. Generated words change color when the robot is less confident.

Pick a sample, teach the robot, and generate from a starter phrase.

Why That Word?

Longer bars mean the word followed this pattern more often. Click one to extend your clue.

    What It Learned

    The big idea

    From Early AI To Google To Today

    N-grams are one of the oldest honest ways to explain how a machine can guess what word might come next.

    1900s

    Markov

    Andrey Markov studied how one item in a sequence can help predict the next. That idea still powers this lesson.

    1948

    Shannon

    Claude Shannon showed that language could be modeled statistically, which helped launch information theory and early language prediction.

    2010

    Google Books Ngram Viewer

    Google made n-gram history visible by letting people explore how words and phrases rise and fall across millions of books.

    Today

    Modern AI

    Newer AI systems go far beyond n-grams, but this is still a great first model for understanding next-word prediction.

    A Communications Primer (Charles & Ray Eames for IBM, 1953): Explaining Claude Shannon's mathematical theory of communication, noise, and probabilistic symbol prediction.

    Challenge Cards

    Change one thing at a time and see how the robot responds.

    Make It Smarter

    • Challenge 1Build with bigrams, then switch to trigrams and compare the robot's top guesses.
    • Challenge 2Keep the same story, but change the starter phrase and watch how quickly the predictions change.
    • Challenge 3Try a very small corpus and then a larger one. Which one sounds more confident?

    Break It On Purpose

    • Challenge 4Turn up randomness and see when the writing becomes silly, messy, or surprising.
    • Challenge 5Turn on fairness boost and test what happens when the robot sees an unfamiliar word pattern.
    • Challenge 6Ask the robot to continue a phrase that does not match the story. What clues show that it is guessing?

    Reflection + Teacher Notes

    Use these prompts for discussion, notebooks, or a fast exit ticket.

    Reflection Prompts

    • Prompt 1When did the robot make a smart guess, and what pattern do you think it noticed?
    • Prompt 2How did a larger memory window change the writing?
    • Prompt 3Why can an n-gram model feel clever even though it does not understand meaning like a person?

    Teacher Moves

    • VocabularyPattern, context, probability, corpus, prediction.
    • DiscussionConnect this lesson to autocomplete, phone keyboards, search, and the Google Books Ngram Viewer.
    • ExtensionHave students compare this tiny predictor with modern AI and explain what both systems still share.