Scratch
Beginner
40 mins
Teacher/Student led
+145 XP

What AI Models Are, from Chatbots to Agents

Teacher Class Feed

Load previous activity

    1 - Start: What We're Building ~4 mins

    Illustration for Start: what we're buildingSoftware decides things for you all day: what appears at the top of a feed, whether a photo has your face in it, what word you meant when you mistyped. The part of a program that decides is called an AI model.

    Today you meet the main kinds, then you build one yourself in Scratch: a guesser made of rules that tells a cat from a dog. It works on the easy cases and falls apart on the awkward ones, and that is exactly the problem you solve next lesson.

    2 - Guess the Model ~4 mins

    Teams compete. Five real things software does are revealed one at a time. For each one, call out the kind of model behind it.

    1. It recommends the next video you should watch.
    2. It turns a sentence you typed into a picture.
    3. It finishes the line of code you started.
    4. It spots a face in a photo.
    5. It books a table at a restaurant for you, on its own.

    The answers: 1 is a recommendation system, 2 and 3 are generative models, 4 is a classifier, and 5 is an agent: it is given a goal, then plans, uses tools and acts in a loop.

    3 - Four Kinds, and What Each Is for ~2 mins

    KindWhat it doesWhere you meet it when coding
    GenerativeProduces something new: text, an image, codeAn assistant that drafts a function or explains code
    RecommendationRanks options for one personWhat a shop or a feed shows a given user
    ClassifierSorts an input into categoriesCat or dog, spam or not, rock or paper
    AgentTakes a goal, plans, uses tools, acts in a loopSoftware that carries out a multi-step task

    The one you are about to build is a classifier. It takes something in and puts a label on it, and it is the simplest of the four to build by hand.

    4 - Create a New Scratch Project ~2 mins

    Go to scratch.mit.edu and click Create to start a new project. Call it Cat or Dog.

    You will write all of today's code on the cat sprite that is already there, so you do not need to add anything.

    5 - Your First Rule: Does It Bark? ~3 mins

    Your guesser asks yes-or-no questions. The player presses y for yes or n for no.

    Build this from Events (gold), Looks (purple), Control (gold) and Sensing (light blue). The wait until block holds the script until a key goes down.

    Read it and predict: if you answer n, what will the cat do?

    when green flag clicked say [Think of a pet: a cat or a dog. Answer with y or n.] for (3) seconds say [Rule 1. Does it bark?] wait until <<key [y v] pressed?> or <key [n v] pressed?>> if <key [y v] pressed?> then say [I think it is a DOG.] for (4) seconds stop [this script] end
    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2025. Unauthorised use, copying or distribution is not allowed.

    Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more