Learn / AI Literacy Bridge / Unit 3: Working with generative AI

How a language model writes

Lesson 1 of 3 · 15 min read

A large language model (LLM) is trained on an enormous amount of text to do one thing: predict the next piece of text (a token — roughly a word or part of a word) given everything before it.

To write a sentence, it predicts a probability for every possible next token, picks one, adds it to the text, and repeats. That's all generation is — but done with a model so large that the predictions capture grammar, facts, styles, reasoning patterns and much more.

The activity shows a toy version. Given a prompt, the bars show how likely each next word is. The temperature slider controls how adventurous the choice is:

  • Low temperature: almost always pick the most likely word. Predictable, consistent, sometimes dull.
  • High temperature: less likely words get a real chance. More varied and creative — and more likely to go off the rails.

Two consequences matter for everyday use. First, the model produces what is likely, which is usually but not always what is true. Second, the same prompt can give different answers on different runs. When consistency matters, ask for structure, give examples, and check the result.

This lesson includes a hands-on interactive. Open the interactive version to try it and save your progress.