Skip to content

Guessing the Next Word

A language model scores likely next tokens from patterns in training data. Many guesses in a row become a full answer.

Class 9 to 10beginner18 min3 lessons1 interactive lab
By the end you will be able to
  • Describe reply generation as repeated next-token choice
  • Explain that probabilities pick among likely words
  • Use the next-word lab to see top guesses change with context

Lesson 1 of 3

Autocomplete at scale

Phone keyboards suggest the next word while you type. Language models do something similar, but with billions of patterns learned from text.

Given tokens so far, the model scores what token might come next. It picks one, appends it, and repeats until a stop condition.

Try the next-word lab. Change the sentence start and watch which words rise to the top of the list.

Interactive lab

Next word

Edit the sentence so far and see ranked guesses for the next token. Context shifts the list.

Next word guess

Probabilities, not facts

The capital of France is ___

  • Paris62%
  • Lyon8%
  • located6%
  • famous4%
1 / 2

Guess

The model scores likely next words from patterns in its training data. It does not look up facts like a search engine.

Continue

Lesson 2 of 3

Not magic, just very fast pattern use

The model does not look up facts in a single table like a dictionary. It blends patterns: after Paris capital of people often write France.

That works well for common knowledge and grammar. It fails when patterns are wrong, rare or missing.

Temperature is a setting that controls randomness. Low temperature picks safe likely words. Higher temperature tries less common words for creative writing.

Continue

Lesson 3 of 3

You shape the guess

Clear prompts steer probabilities. If you ask for three bullet steps, likely continuations include list markers.

Asking the model to say I do not know when unsure can reduce confident nonsense on hard facts.

Next you will see where those patterns came from: training on huge text collections.

Continue

Practice

Work these out yourself

No answer key here on purpose: these are the questions worth thinking through before you move on. Open one and work it out.

0/3 attempted

Assessment

Check your understanding

Answer each question, then read the explanation. That is where the learning is.

0/4
  1. Question 1: A language model reply is built how?
    Question 1 / 4

    A language model reply is built how?

    Select an option first
  2. Question 2: Higher temperature usually does what?
    Question 2 / 4

    Higher temperature usually does what?

    Select an option first
  3. Question 3: Why does context change top guesses?
    Question 3 / 4

    Why does context change top guesses?

    Select an option first
  4. Question 4: Phone keyboard suggestions resemble what?
    Question 4 / 4

    Phone keyboard suggestions resemble what?

    Select an option first
4 of 4 questions left.

Finished this topic?

0 of 3 lessons marked done. Marking the topic complete ticks the rest.