Grokking AI: 50 Questions Every Engineer Asks
Vote

0% completed

​

Does an LLM Understand My Question or Only Predict the Next Word?

Part 1: The Output Is Only a Prediction

Part 2: Prediction Without Meaning Fails

Part 3: What a Model Learns During Training

Part 4: Where the Ability Fails

Part 5: What "Understand" Means Here

Common Wrong Beliefs

What This Means for Your Work

Try It Yourself

Check Your Understanding

Key Takeaways

Short answer: Both descriptions are partly correct. The only output of a model is a prediction of the next small piece of text (the next token). However, to predict well, the model had to learn grammar, facts, and the relations between ideas from a very large amount of text (its training). Its calculation uses all of them. The result is a real ability that is uneven: a model can solve a problem it has never seen and then fail at a simple one.

The output of a model is only a prediction, but the calculation that produces it uses what the model learned during training
The output of a model is only a prediction, but the calculation that produces it uses what the model learned during training

Look at the box in the middle. The statement "it only predicts the next word" describes the box on the right. It says nothing about the calculation in the middle box, which produces that output. The two numbers in the box on the right are illustrative, which means that they are invented for this example.

This lesson uses one small example. Two servers have the invented names Zorb and Quil, and the input is this unfinished text:

Zorb and Quil are servers. Zorb is down. Send the next request to

A person completes this text with "Quil". The parts below explain what a program needs before it can do the same.

Part 1: The Output Is Only a Prediction

What Happens Inside an LLM When I Ask a Question? showed that a large language model (LLM) produces an answer one token at a time. In every run of the model (a pass), the model gives each possible next token a chance between 0 and 1, and the program chooses one token. The model has no other output, so everything it writes, including any reasoning, is produced by this loop.

The statement "it only predicts the next word" is therefore accurate as a description of the output. The statement becomes wrong when a person uses it to mean that the model cannot use the meaning of the text.

Part 2: Prediction Without Meaning Fails

A program can predict the next word without using any meaning. Older phone keyboards worked in a similar way: they counted which word most often followed the last one or two words, and they suggested that word.

Apply the counting method to the example. The last word is "to". In the text that the program counted, the word that most often follows "to" is "the", so the program suggests "the". The words "Zorb is down" have no effect, because the program never uses them.

A program that counts word pairs uses only the last word. An LLM uses every word of the input
A program that counts word pairs uses only the last word. An LLM uses every word of the input

Notice the highlighted words in each row. The counting program uses one word and suggests "the", but the LLM uses every word of the input and gives "Quil" the highest chance.

Copying cannot explain the second result. The names are invented, so this text was almost certainly not in the training text of the model. To give "Quil" a high chance, the calculation has to connect three facts: there are two servers, one of them is down, and a request needs a working server. These are connections between meanings and not between neighboring words.

Part 3: What a Model Learns During Training

Nobody programs these connections into a model. During training, the model predicts the next token in a very large amount of text. After every wrong prediction, the training program adjusts the stored numbers of the model (its parameters). Training keeps and strengthens every internal pattern that improves the predictions, including patterns of grammar, facts, and the relations between things.

Researchers have tested this idea directly. One team trained a small model only on lists of moves from the board game Othello. The model never received the rules or a picture of the board, and its only task was to predict the next legal move (a move that the rules allow). The researchers then examined the numbers inside the model and found that those numbers held the position of every piece on the board.

A model trained only on lists of Othello moves held the position of the pieces in its internal numbers
A model trained only on lists of Othello moves held the position of the pieces in its internal numbers

Look at the right side of the diagram. No board exists in the training data. The board position appeared inside the model because a program that tracks the board predicts the next move better than a program that does not.

Studies of large language models report similar findings, although each study describes one model and one kind of task. Researchers at Anthropic examined one of their models while it answered a question that needs two facts: the capital of the state that contains Dallas. The two facts are that Dallas is in Texas and that the capital of Texas is Austin. They reported that the model first formed an internal signal for "Texas" and then used that signal to produce "Austin".

Part 4: Where the Ability Fails

By themselves, these findings would support the answer "yes, it understands," but the failures of the same models show that this answer is too simple.

The ability of a model is uneven. It is often strong on the tasks on the left and often weak on the tasks on the right
The ability of a model is uneven. It is often strong on the tasks on the left and often weak on the tasks on the right

Notice that a person who can do the tasks on the left can also do the tasks on the right. A model often cannot, and three kinds of failure appear often:

  • A small change in a problem can change the result. Researchers at Apple took school math problems and changed only the names and the numbers. The tested models solved fewer of the changed problems. The scores became even lower when the researchers added one sentence that had no effect on the answer.
  • Models fail at some simple tasks. Many models have counted the letters in a word incorrectly, because a model receives tokens and not letters. Many models also multiply two large numbers incorrectly when they have no calculator tool.
  • A model is weaker on rare topics than on common topics. For a rare topic, the model had little training text to learn from, and it often produces a statement that looks correct but is false.

A person who understands a topic does not usually lose that understanding when a name changes. The ability of a model is real, and it is also less stable than human understanding.

Part 5: What "Understand" Means Here

The answer depends on the meaning of the word, and experts do not agree on one meaning.

  • If "understand" means using the meaning of the input to produce correct output for new cases, then tests show that models do this often, although they do it unevenly.
  • If "understand" means having the experience of knowing, as a person does, then no current test answers the question. Engineering work does not depend on that answer.

For an engineer, a practical question is more useful. How often is the model correct on this kind of task, and how will you detect a wrong answer?

Common Wrong Beliefs

BeliefWhat actually happens
The model is only autocomplete, so it cannot solve a problem it has never seen.The model solves many new problems, because its calculation uses the relations between the parts of the input. The example with invented names shows this.
The model answered correctly, so it understands the topic as an expert does.One correct answer shows little. The same model can fail when the wording, the names, or the numbers change.
The model explained its reasoning, so that is how it found the answer.The explanation is also produced one token at a time. Studies have found cases where the written explanation did not match the internal calculation.
The model stores its training text and copies from it.The model stores parameters and not documents. It can repeat some passages that appeared many times in its training text, but most of its output is newly produced.

What This Means for Your Work

  • Judge the model on your own cases. One impressive answer is weak evidence. Collect 10 to 20 real inputs from your task and check every result.
  • Ask twice in different words. If two versions of one question receive different answers, check the answer before you use it.
  • Expect weaker results on unusual input. Internal service names, private APIs, and new libraries are rare or absent in training text, so put the relevant material into the input.
  • Verify the result and not the explanation. A convincing explanation does not show that the code is correct. Run the code and its tests.

Try It Yourself

The program below predicts the next word by counting word pairs, as Part 2 described. It is not an LLM. Run it and read the last line of the output.

Python3
Python3

. . . .

The program prints "Prediction: the". Now change "zorb is down" to "quil is down" in PROMPT and run the program again. The prediction does not change, because the program uses only the last word.

The box below sends its text to a real LLM. Run it once. Then change "Zorb" to "Quil" in the second sentence, so that Quil is the server that stopped, and run it again.

AI Prompt

The answer should be Quil in the first run and Zorb in the second run. You can also replace both names with invented words of your own, and the model should still name the server that is working.

Check Your Understanding

Quiz

A model receives a question about two servers with invented names, and it answers correctly. Which conclusion does this result support?

Click an option to answer

Key Takeaways

  • The output of a model is only a prediction. Every token of every answer comes from the same loop.
  • Good prediction requires more than counting words. The calculation uses the meaning of the words and the relations between the parts of the input.
  • Training gives the model this ability. Nobody programs it, and researchers have found internal structures such as the Othello board.
  • The ability is real and uneven. Test the model on your own task, and verify the results that matter.

The next lesson, Why Do LLMs Hallucinate?, explains one of these failures: a model that states false things with confidence.

Reading Progress

0%


Vote for new content

On This Page

Part 1: The Output Is Only a Prediction

Part 2: Prediction Without Meaning Fails

Part 3: What a Model Learns During Training

Part 4: Where the Ability Fails

Part 5: What "Understand" Means Here

Common Wrong Beliefs

What This Means for Your Work

Try It Yourself

Check Your Understanding

Key Takeaways