What is next-token prediction?

Next-token prediction is the task in which a language model computes the probability distribution of the next token from the preceding token sequence and being trained on that prediction; it is the pre-training objective and generation method of large language models.

Unlike masked language modelling, where hidden tokens inside a sentence are predicted from context on both sides, next-token prediction uses only the left context. Multi-token prediction extends it by predicting several future tokens at once.

Topic
Machine learning, models and training
Also known as
Causal language modelling
Origin
In neural language modelling, Bengio et al., 2003

How next-token prediction works

  1. Training text is split into tokens; at each position the model sees only earlier tokens.
  2. The model outputs a probability for every vocabulary token and is trained with cross-entropy loss to raise the true next token's probability.
  3. In training it receives the real previous tokens at each step, known as teacher forcing.
  4. In generation it appends its chosen token to the input and moves along the sequence.

Commonly confused terms

TermHow it differs
Decoding strategiesNext-token prediction is the training objective and probability modelling step, whereas decoding strategies (greedy, temperature, top-k, top-p, beam search) are inference-time rules that pick the actual token from that distribution.

Why next-token prediction matters for on-premises AI

Needing no labels, next-token prediction scales to huge text corpora and teaches a wide range of skills from grammar to facts; an early neural language modelling study combined this objective with distributed word representations. Its limits are debated: one study argues teacher-forced training can fail to learn an accurate predictor on some planning tasks. For organisations, the model produces a likely continuation rather than the truth, so grounding is needed.

ON-PREMISES EXAMPLE

Seeing its policy assistant sometimes produce fluent but wrong clause numbers, an insurer grounds answers in sections retrieved from policy texts and requires each answer to cite its source section.

Common questions

How does next-token prediction differ from masked language modelling?

Next-token prediction uses only earlier context and suits generation. Masked modelling predicts hidden tokens from both sides.

Why can next-token prediction lead to hallucination?

The model predicts the most likely continuation, not the truth. Without grounding it can produce fluent but wrong text.

Sources

In the glossary: Glossary, M to Q

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.