Skip to main content

Pre-trained Model Generation

  • Audience years 5 and up
  • Duration 20 min
  • Runs on booklet

Key idea: You can generate from a model you didn't train: follow its lookup rules and sample next words.

Used in My First Language Model and Under the hood — the lessons that include this module.

Use a pre-trained model booklet to generate new text through Weighted random sampling Choosing the next token with probability proportional to its count. A d10 roll against the counts does this, and so does letting your eye land on one of the matching cutouts, because common words appear on more of them. View in glossary .

You will need

  • a pre-trained model Booklet A printed dice lookup table for a text: one entry per previous word (or pair of words, in a trigram booklet), listing the possible next words with the d10 range that selects each. A booklet is a pre-trained model you can generate from without having trained it. View in glossary
  • a d10 for weighted sampling
  • pen and paper for your generated text

Your goal

Generate text from a pre-trained Language model A system that predicts what text comes next, using patterns learned from training data. Your hand-built grid, a cutouts spread, a booklet, and a room holding search sheets are all language models. View in glossary without training it yourself. Stretch goal: try to guess the training text before checking the booklet title.

Key idea

Pre-trained models capture patterns from larger datasets. You can use them just like your hand-built Bigram model A model that predicts the next word from one previous word. It's what you build in the fundamental modules: each row of your grid says what can follow a single word. View in glossary : look up the current word, roll dice, choose the next word, and repeat.

Algorithm (quick recap)

  1. Choose a starting word (any bold word in the booklet) and write it down.
  2. Look up that word’s entry to see possible next words and their thresholds.
  3. Roll your d10(s):
    • If the entry shows diamonds (e.g. ♦♦), roll one d10 per diamond and read the digits as one number.
    • Otherwise, roll one d10.
  4. Scan down the options; the first threshold greater than or equal to your roll gives the next word. Write it down.
  5. Repeat from step 2 using the new word until you reach a natural stopping point or your desired length.

Example

  • Single d10: Current word cat with options 4|sat, 7|ran, 10|slept. Roll once; a 6 lands you on ran.
  • Multiple d10s: Current word the with two diamonds (♦♦) and options 33|cat, 66|dog, 99|end. Roll twice; a 5 and 8 combine to 58, so you choose dog.

Instructor notes

Discussion questions

  • can you guess what text the model was trained on from the generated output?
  • how does using a pre-trained model differ from training your own?
  • what Vocabulary All the distinct tokens a model knows. The words down the side and across the top of your grid, or the set of previous-word labels on a cutouts spread, form your vocabulary. A model can only ever produce a token from its vocabulary. View in glossary size does the booklet model have compared to your hand-built model?
  • why might some word combinations feel more natural than others?
  • without looking at the title: can you identify the training text’s genre or style?

Troubleshooting

  • “Which die is the tens digit?” With multiple d10s (the multiple-diamond entries), pick an order before you roll and stick to it, such as reading the red die before the blue one. Even if you mix them up occasionally, the activity still works.

Connection to current LLMs

Most people use modern LLMs without training them:

  • Pre-training The first, expensive training phase, where a model learns the general patterns of language from a huge corpus. Most people who use an LLM never train one; they use a pre-trained model, the way you generate from a booklet somebody else made. View in glossary : companies train models on huge text Training data The text a model is trained on. In our activities this is the passage you tally, or the book a set of cutouts, a booklet or a set of search sheets was generated from. Modern LLMs are trained on trillions of words from books, websites and other sources. View in glossary (like your booklet model, scaled to trillions of words)
  • LLM-as-a-service: users generate text without seeing or modifying the underlying model
  • model distribution: the booklet format packages a model for sharing; current LLMs are distributed as parameter files
  • deterministic generation: given the same starting word and dice rolls, you get the same output

Training and generation are separate steps. Your hand-built model from Training shows what is inside the booklet, but you don’t need to have built the model to run it. AI companies do the expensive training once, then host or distribute the resulting weights for millions of users to sample from.

Interactive widget

Step through the booklet lookup process at your own pace. The model is displayed in the same format as the printed booklets: each entry shows a bold previous word, diamond symbols indicating how many d10s to roll, and the possible next words with their thresholds.

Training text
Model
the ♦ 4|cat9|mat
cat sat
sat on
on the
mat .
Output