AI Origins · Lesson 03

Build a Next-Word Robot

Pick a story, teach the robot, and watch a tiny language model guess the next word.

First try: Animal Story, then Generate from "our class."

Pick a story to get started.

Watch The Robot Write

When you change the controls, keep your eyes here. This is the live result.

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

Top Next-Word Guesses

Click a guess to add it to your starter phrase.

    What It Learned

    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.

    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.