Next-token prediction is the core training objective behind today's LLMs. Given the text so far, the model assigns a probability to every possible next token, picks one, appends it, and predicts again. Generation is just that loop run thousands of times.
Where you meet it
- Every chat model — ChatGPT, Claude, Gemini — produces its answer one token at a time.
- Autocomplete, code completion (Copilot), and "smart compose" in email.
- The pre-training stage of essentially all GPT-style models, before any fine-tuning.
What it does
It turns language into a sequence-prediction problem. The model never sees a "question" and an "answer" — it only ever learns one skill: what comes next? Everything else (answering, translating, coding) emerges from being extremely good at that one skill on enough text.
The model is only ever rewarded for the likeliest next token — never the factually correct one. Hallucination isn't a bug, it's the objective.
How it works
The model factorises the probability of a whole sequence into a product of next-token steps — this is what autoregressive means:
P(x₁ … x_T) = ∏ₜ P(xₜ | x₁ … xₜ₋₁)
At each step it computes a distribution over the vocabulary, then decodes one token from it — argmax (greedy) or sampling (with temperature / top-k / top-p). The chosen token is appended, the context grows by one, and the model runs again. Predict, append, predict.
Training is self-supervised: take a giant pile of text, and at every position make the model predict the token that actually came next. The loss is cross-entropy — the negative log-probability the model assigned to the true token:
L = −(1/T) ∑ₜ log P(xₜ | x₁ … xₜ₋₁)
Minimising this over trillions of tokens forces the model to encode grammar, facts, and reasoning patterns — not because it was told to, but because they help predict the next token. "Understanding" is a by-product of compression.
Watch out
- Plausible ≠ true. The objective rewards the likeliest continuation, not the correct one. Confident, well-formed nonsense (hallucination) is a direct consequence.
- No lookahead. The model commits token by token with no plan for the sentence as a whole — it can paint itself into a corner.
- Exposure bias. Training always conditions on the true prefix; at generation time it conditions on its own output, so early mistakes compound downstream.
- Perplexity (≈
exp(loss)) measures how surprised the model is by held-out text — lower is better, but it's only a proxy for usefulness.
Go deeper
Next-Token Prediction ist das zentrale Trainingsziel heutiger LLMs. Aus dem Text bisher vergibt das Modell eine Wahrscheinlichkeit für jedes mögliche nächste Token, wählt eins, hängt es an und sagt erneut voraus. Textgenerierung ist nichts als diese Schleife, tausendfach wiederholt.
Wo es vorkommt
- Jedes Chat-Modell — ChatGPT, Claude, Gemini — erzeugt seine Antwort Token für Token.
- Autovervollständigung, Code-Completion (Copilot), "Smart Compose" in E-Mails.
- Die Pre-Training-Phase praktisch aller GPT-artigen Modelle, vor jedem Fine-Tuning.
Was es tut
Es verwandelt Sprache in ein Sequenz-Vorhersageproblem. Das Modell sieht nie "Frage" und "Antwort" — es lernt immer nur eine Fähigkeit: Was kommt als Nächstes? Alles andere (Antworten, Übersetzen, Programmieren) entsteht daraus, in genau dieser einen Aufgabe auf genug Text extrem gut zu werden.
Belohnt wird immer nur das wahrscheinlichste nächste Token — nie das faktisch richtige. Halluzination ist kein Bug, sondern das Ziel.
Wie es funktioniert
Das Modell zerlegt die Wahrscheinlichkeit einer ganzen Sequenz in ein Produkt von Einzelschritten — genau das heißt autoregressiv:
P(x₁ … x_T) = ∏ₜ P(xₜ | x₁ … xₜ₋₁)
In jedem Schritt berechnet es eine Verteilung über das Vokabular und dekodiert daraus ein Token — argmax (greedy) oder Sampling (mit Temperatur / Top-k / Top-p). Das gewählte Token wird angehängt, der Kontext wächst um eins, das Modell läuft erneut. Vorhersagen, anhängen, vorhersagen.
Das Training ist selbstüberwacht: Man nimmt einen riesigen Textberg und lässt das Modell an jeder Position das Token vorhersagen, das tatsächlich folgte. Der Loss ist Cross-Entropy — die negative Log-Wahrscheinlichkeit, die das Modell dem wahren Token zuwies:
L = −(1/T) ∑ₜ log P(xₜ | x₁ … xₜ₋₁)
Diesen Loss über Billionen Token zu minimieren zwingt das Modell, Grammatik, Fakten und Schlussmuster zu kodieren — nicht weil man es ihm sagte, sondern weil sie helfen, das nächste Token vorherzusagen. "Verstehen" ist ein Nebenprodukt von Kompression.
Worauf achten
- Plausibel ≠ wahr. Das Ziel belohnt die wahrscheinlichste Fortsetzung, nicht die richtige. Selbstbewusster, formvollendeter Unsinn (Halluzination) ist die direkte Folge.
- Kein Vorausschauen. Das Modell legt sich Token für Token fest, ohne Plan für den ganzen Satz — es kann sich in eine Sackgasse schreiben.
- Exposure Bias. Im Training konditioniert es immer auf den echten Präfix; beim Generieren auf die eigene Ausgabe — frühe Fehler propagieren und schaukeln sich auf.
- Perplexity (≈
exp(loss)) misst, wie überrascht das Modell von ungesehenem Text ist — niedriger ist besser, aber nur ein Proxy für Nützlichkeit.