Skip to main content

How AI writes stories with a cup of counters

  • Audience ages 10-16 (years 5-10)
  • Duration 90 minutes
  • Flavour ledger

A sibling of How AI writes stories that swaps the paper Cutouts Printed cards, one per word pair in the text, each showing a previous word in a box and the word that followed it. Spread on a table they are the model: to generate, find a card whose boxed word matches your current word and read off its next word. Common pairs appear on more cards, so picking by eye samples in proportion. View in glossary for Ledger A sheet with one row per word, tally marks for each word that followed it, and a coloured box around each tally column. Generation uses a cup of coloured counters, one per tally mark: draw a counter, read the word beside its colour. The cup does the weighted sampling. View in glossary : a table with one row per word, tally marks beside each word that followed it, and a coloured box around every tally. Generation Using a trained model to produce new text by repeatedly predicting and choosing the next token. Look up the current word, pick a next word in proportion to the counts, write it down, repeat. View in glossary is a cup of coloured counters—one counter per tally mark, in the box’s colour, draw one and read the word beside that colour—so the maths of “more common means more likely” is done by the cup. Training Building a model by counting patterns in text. When you read through a passage and tally which word follows which, you are training a model. The cutouts, booklets and search sheets are models that the generator has already trained for you from a text. View in glossary is tallying by hand from a printed text.

The order is flipped on purpose. Groups start with a finished model and generate from it, so when they train their own from a new text they already know what every mark is for. Every group’s finished model is a different picture book, so the shareback can hear the book in each group’s story.

Lesson plan

Allow five minutes for arrival and settling before part 1. Part 6 is designed to be dropped if you’re running over.

PartWhat happensTime
1What is AI? — discussion, plus an AI writes the class a story12 min
2Warm-up — predict the next word, then four key words8 min
3Read the sheet — one row read aloud as a sentence5 min
4Generation — stories from the pre-tallied sheets, then shareback20 min
5Training — tally a new text onto blank sheets16 min
6One story, all together — the class pools its models (optional)10 min
7Wrap-up — what did we learn? Q&A5 min

Part 3 is the beat the cutouts lesson doesn’t have: before anyone touches a counter, a whole sheet goes up on the screen, then one row of it is read aloud as a sentence (“after the, this book said magpie five times”). Every group then finds a row of their own and does the same. The colours are explained last: a box’s colour names its place in the row, and the counters come in those four colours.

Part 4 runs the Generation module with the cup. The slides walk through one book (The magpie) draw by draw, then every group generates from its own. The shareback asks the room to guess each group’s book from its first sentence, and asks two groups holding the same book why their stories differ.

Part 5 answers “where did the marks come from?” by having each group make their own. Every group gets a different short text (the five outdoors texts in data/originals/) and blank sheets; one person reads the text two words at a time from the numbered printout, and the group writes each new word into a spare row and tallies beside it. Nothing is printed on the sheets, so agree first that a new word is claimed out loud — two people keeping counts of the same word is the one mistake that breaks a group’s model.

Part 6 pools the models, on butchers paper up the front. Call out the word the class story is on; every group whose sheets have a row for it puts a hand up; pick one, and that group reads out the colours and tallies on its row. The draw happens up the front — one cup, counted in and drawn while the room watches, rather than every table filling and emptying its own — and the group whose row it is reads out the word beside the colour drawn. The class story can contain words only one group’s text had, so it says things no single group’s model could.

You will need

  • one pre-tallied picture-book set per group, five sheets and four colours, a different book per group: the-magpie (a short story written for this lesson, and the book the slides walk through), green-eggs-and-ham, the-very-hungry-caterpillar, were-going-on-a-bear-hunt and the-cat-in-the-hat
  • blank sheets, one per person, and a different data/originals/outdoors-*.txt text page per group
  • counters in four colours (red, blue, green, yellow), at least ten of each per group (the largest tally in any set), a paper cup per group, and a tub per group to tip the cup back into between draws
  • butchers paper for the class story
  • pen and paper per group, a whiteboard, a projector, and access to a Chatbot (ChatGPT, Claude, Gemini) A product that wraps an LLM in a conversation. ChatGPT is OpenAI's, Claude is Anthropic's, Gemini is Google's, and there are many others. On this site we often name ChatGPT or Claude as shorthand for any of them: the concepts apply equally to every modern LLM chatbot, whichever one you use. View in glossary for part 1

Printing it

make pack-how-ai-writes-stories-ledger in the repo zips five PDFs into out/packs/: the five picture-book models one after another, one blank sheet, the five numbered text pages, the counters page, and a one-page instruction sheet. The README that comes with them says what to print and which pages go to which group. The Makefile holds the exact commands, so the sets are the same every delivery rather than rebuilt from memory.

Every picture-book set is built with --max-followers 4, which drops each word’s rarest continuations so that every word fits a single row however long the text. Four followers and four counter colours mean one palette per row, so every row on every sheet is red, blue, green, yellow in that order. The token budget is then free to be chosen for the model rather than for the widest row: 140 for all five books. Change it and re-run ops/ledger-sweep.py — its dead column is the one that matters, since a group that draws a word with no row of its own stalls with nothing to look up — and re-read the slides’ walkthrough rows off the new The magpie sheets.

Before you deliver

  • with more than five groups, books and outdoors texts repeat; spread the repeats so that groups sharing a book aren’t side by side
  • the story slide in part 1 has fill-in boxes for the teacher’s name, the year level, and the three class words

Using the slides

Open the slides in your browser — there's nothing to install or download. There's also a presenter guide (PDF) — every slide followed by a page of its speaker notes — if you'd rather prepare away from the browser.

The slides run in your browser, and every slide carries full presenter notes—what to say, what to watch for, and how long each part should take. A few keys worth knowing:

  • f toggles fullscreen—do this before you start presenting
  • s opens the speaker view in a separate window, with the presenter notes, a timer, and a preview of the next slide (drag it to your laptop screen and put the slides on the projector)
  • o shows an overview of all slides, handy for skipping ahead if you're running short on time