Why Prediction Learns Structure

Next-token prediction sounds small. In practice, it creates pressure to learn structure.

To predict well, a model must use patterns from the context. Some patterns are local. Others require knowledge of format, syntax, facts written in text, or relationships across many tokens.

Three Small Contexts

Consider:

The capital of France is

Many continuations are syntactically possible, but Paris is much more likely in ordinary text than most alternatives. A model that predicts well must connect the phrase with factual associations in its training data.

Now consider code:

for i in range(

The next useful token depends on programming syntax. Ordinary English word frequency is not enough.

Now consider a question-answer format:

Question: What is 2 + 3?
Answer:

The format suggests that a short answer should follow. The arithmetic pattern suggests 5.

What "Structure" Means Here

Prediction pressure can teach many kinds of structure:

  • spelling and morphology;
  • phrase patterns;
  • syntax;
  • factual associations in text;
  • code conventions;
  • question-answer formats;
  • style and genre;
  • local arithmetic or symbolic patterns.

This does not mean the model understands everything the way a person does. It means the training objective rewards internal representations that reduce prediction error.

A Useful Caution

Prediction can produce structure, but it does not guarantee truth, reasoning, or reliability. It creates pressure. The architecture, data, training method, scale, and evaluation determine what the model actually learns.

LM-C01-T05-001Exercise: Name the needed structure

For the context for i in range(, enter 1 if ordinary word frequency is enough, or 2 if programming structure matters.

Compute it first, then check your number.

Hint

Ask whether this context is ordinary prose or code.

Solution

The correct answer is 2. The context is code. A useful continuation depends on Python syntax and programming patterns, not only ordinary English frequency.

Before Moving On

Language modeling deserves careful study because the prediction problem gives the model real work to do. Transformers matter later, but the objective already explains why a model may learn structure from text.