# Pre-trained Model Generation

> Use a provided pre-trained booklet to generate text without training your own model.

Use a pre-trained model booklet to generate new text through <GlossaryTerm id="weighted-random-sampling">weighted random sampling</GlossaryTerm>.

![](../../assets/images/hero-pretrained-generation.avif)

## You will need

- a pre-trained model <GlossaryTerm id="booklet">booklet</GlossaryTerm>
- a d10 for weighted sampling
- pen and paper for your generated text

<Callout type="tip" title="Download pre-trained model booklets">

The [Materials](https://www.llmsunplugged.org/tools/#booklets-for-dice-generation) page has ready-to-print
booklets for several texts, or you can
[generate your own](https://www.llmsunplugged.org/tools/#generate-your-own) from any text.

</Callout>

## Your goal

Generate text from a pre-trained <GlossaryTerm id="language-model">language model</GlossaryTerm> 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 <GlossaryTerm id="bigram-model">bigram model</GlossaryTerm>: 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 <GlossaryTerm id="vocabulary">vocabulary</GlossaryTerm> 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:

- **<GlossaryTerm id="pre-training">pre-training</GlossaryTerm>**: companies train models on huge text <GlossaryTerm id="training-data">corpora</GlossaryTerm> (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](https://www.llmsunplugged.org/modules/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.

<PretrainedGenerationWidget client:visible />

Source: <https://www.llmsunplugged.org/modules/pretrained-generation/>\
Licence: [CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/)\
Cite as: Swift, B. (2026). _LLMs Unplugged: Understand how AI language models work by building one yourself._ https://doi.org/10.5281/zenodo.17403824
