Scratch
Beginner
40 mins
Teacher/Student led
+100 XP

What AI Models Are, from Chatbots to Agents

Teacher Class Feed

Load previous activity

    1 - Start: Five Decisions a Machine Made for You Today ~4 mins

    Illustration for Start: five decisions a machine made for you todayBefore you got to this room, software almost certainly decided something on your behalf. What you saw at the top of a feed. Whether a photo was of you. What word you meant when you mistyped it.

    Every one of those decisions came out of an AI model. A model is just the part of a program that decides. Today you meet the main kinds, then you build one by hand and watch it break.

    2 - Guess the Model ~6 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. Fastest correct team takes the point, scoreboard on the board.

    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, and why:

    1. Recommendation system. It ranks a list of options for one particular person, using what that person and people like them watched before.
    2. Generative model. It produces something new that did not exist before, an image built from a description.
    3. Generative model, working as a code assistant. Same idea as the picture, except what it produces is text that happens to be code.
    4. Classifier. It sorts an input into categories: face, not a face. It creates nothing, it labels.
    5. Agent. It is given a goal, then plans the steps, uses tools such as a website or a calendar, and acts in a loop until the goal is met or it gives up.

    Notice number 5 is different in kind, not just in difficulty. The first four answer a question when asked. An agent is handed a goal and goes off and does things.

    3 - Four Kinds, and What Each Is for in Coding ~4 mins

    How any model works

    Write these four down. You will use the words for the rest of the course.

    KindWhat it doesWhere you meet it when coding
    GenerativeProduces something new: text, an image, codeAn assistant that drafts a function, or explains code you did not write
    RecommendationRanks options for one personWhat a shop, a feed or a music app shows a given user
    ClassifierSorts an input into categoriesIs this a cat or a dog, is this message spam, is this hand rock or paper
    AgentTakes a goal, plans, uses tools, acts in a loopSoftware that carries out a multi-step task rather than answering one question

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

    4 - Build the Guesser: Your First Rule ~5 mins

    Start a new Scratch project. You are going to write a classifier that tries to tell a cat from a dog, using nothing but yes or no answers.

    Your first rule: if it barks, it is a dog. The person answering presses y for yes or n for no.

    Predict before you run it: if you answer n to this one question, what will the program do? Say it out loud before you click the flag.

    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

    5 - Two More Rules ~5 mins

    One rule is not a classifier, it is an opinion. Add two more so every answer leads somewhere.

    Rule 2: if it purrs, it is a cat. Rule 3: if it fetches a ball, it is a dog, otherwise call it a cat.

    The extra wait until after each rule waits for the key to come back up. Without it, one long press on n would answer all three questions at once.

    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 wait until <not <key [n v] pressed?>> say [Rule 2. Does it purr?] wait until <<key [y v] pressed?> or <key [n v] pressed?>> if <key [y v] pressed?> then say [I think it is a CAT.] for (4) seconds stop [this script] end wait until <not <key [n v] pressed?>> say [Rule 3. Does it fetch a ball?] 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 else say [I think it is a CAT.] for (4) seconds 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