Lesson 5 8 min

Words before the blank

Use two sentence starts to show how earlier words change likely continuations.

Learning goal

I can explain how context changes two likely next words.

How it works

The surrounding words give a language model context. Many language models predict a next piece of text from patterns in that context. More than one continuation can make sense. The activity uses whole words to make the choices easy to see.

Think of it like this

Imagine a comic panel with the last speech bubble covered. The earlier panels help you guess what kind of line belongs next. A reader also sees faces and scenes. A text-only model uses the text it receives.

Worked example

“Micah put the bat in the …” could lead to “bag” after a line about baseball. After a line about a bat rescue, “carrier” could be more likely. The word bat stays the same. The earlier lines tell us which kind of bat is meant, which changes the kinds of words that fit after it.

What to remember

Read the words around the blank. Changing the context can change the guess.

  1. Paint context“Mika dipped the brush in the …”
  2. Tooth context“Mika squeezed paste onto the brush by the …”
  3. Likely piecesFirst: paint. Second: sink.
The same word can point to different meanings when other words change.

Key words

Language model
A model that learns patterns in language. Many text-generating language models use earlier text to predict likely next pieces of text.
Token
A piece of text a language model works with, often a word, part of a word, punctuation, or a space together with other characters.
Prediction
A guess based on information, such as guessing how many people will visit a booth next week.
More Language Models lessons

Activity

Trade the sentence clues

Materials Paper and a pencil or a partner who can read the lines.

  1. Finish “The coach put the ball in the …” with two likely words.
  2. Finish “The baker put the dough in the …” with two likely words. Circle the earlier words that made your choices change.
  3. Try changing only “baker” to “robot”. Predict whether that one edit changes your guesses and explain your reasoning.

Talk it through Some options may fit more than one sentence. Your reasons show how the extra words make an option more likely.

Quick check

1. What helps a language model guess a next piece of text?
Answer and explanation

Earlier text and patterns learned from examples. Earlier text gives context. Learned patterns help the model decide which pieces are likely.

2. Why might “sink” fit the paste sentence better?
Answer and explanation

The words paste and brush together suggest brushing teeth. Several words together give a better clue about which kind of brush the sentence means.