The pitfalls of next-token prediction

Gregor Bachmann, Vaishnavh Nagarajan

TL;DR

While planning failures in Large Language Models (LLMs) are usually blamed on errors compounding during inference, this paper reveals a deeper flaw: standard training (teacher-forcing) can completely prevent a model from learning how to plan in the first place. By exposing how models use local "cheats" in the training data to bypass global planning, the authors introduce "teacherless training"—predicting multiple tokens ahead using dummy tokens—as a promising alternative to force true lookahead learning.

What Problem Does This Paper Address?

The dominant paradigm for training modern language models is next-token prediction via teacher-forcing, where the model learns to predict the next token given the ground-truth prefix of the answer. When these models fail at complex planning or reasoning tasks, critics typically point to "snowballing errors" during inference—the idea that a single small mistake early on exponentially derails the autoregressive generation.

The authors argue that this critique misses a more fundamental problem: for certain "lookahead tasks" (where an early decision depends entirely on a future constraint), teacher-forcing fails to learn an accurate next-token predictor at all, even on the training distribution. The paper aims to formalize this training-time failure mechanism and demonstrate it empirically on architectures like Transformers and Mamba.

Methods

The authors investigate the limitations of standard next-token prediction by comparing three distinct training objectives:

  1. Standard Teacher-Forcing: The model is trained to predict token $r_i$ given the prompt $p$ and all preceding ground-truth tokens $r_{<i}$.
  2. Reversed Training: The target sequence is inverted (right-to-left). For a path-finding task, this means predicting the path starting from the goal back to the start, transforming a complex lookahead problem into a simpler step-by-step tracking problem.
  3. Teacherless Training: To eliminate the crutch of the ground-truth prefix, the authors replace $r_{<i}$ with uninformative dummy tokens (`$`). The model must predict multiple future tokens simultaneously based solely on the prompt $p$, forcing it to look ahead and formulate an internal plan.

These methods were evaluated across different architectures: a from-scratch Transformer (GPT-Mini), a pretrained Transformer (GPT2-Large), and a structured state-space model (Mamba).

Datasets

The paper introduces a minimal, synthetic lookahead benchmark: Path-Finding on Path-Star Graphs.

Illustration of a path-star graph and the three training formulations.

As shown in Figure 1, the graph consists of a central start node with multiple branches ($d$), only one of which successfully terminates at a designated goal node. The input prompt $p$ contains a randomized adjacency list, the start node, and the goal node. The target response $r$ is the exact sequence of vertices from start to goal. The authors also evaluate their approach on a standard 3-digit addition task to demonstrate its relevance to arithmetic reasoning.

Key Insights and Ideas

The authors break down the training failure into two distinct, sequential mechanisms:

  • The Clever Hans Cheat: When given the ground-truth prefix during training, the model discovers a shortcut. For later tokens in the path, it doesn't need to plan from the start node; it can simply look at the immediately preceding token in the prefix and find its outward edge in the adjacency list. The model "cheats" to get low training loss without learning the global structure of the task.
  • The Indecipherable Token: Because the model easily fits later tokens using this local shortcut, it experiences "gradient starvation." The first token (the critical choice at the initial fork) receives no architectural or optimization support from the rest of the sequence. It becomes an "indecipherable token" that the model cannot learn to predict, defaulting to random guessing ($1/d$).
Figure 2. Illustration of the failure of teacher-forcing on a path-star graph. The left image marks the “easy tokens” which can be fit by the Clever Hans cheat (Failure 2a), while the “difficult token” cannot be learned (Failure 2b) due to lost supervision. The right image shows how the model would behave during autoregressive inference, under the absence of the “teacher”.
  • Voluntary Right-to-Left Learning: When trained using the teacherless objective, the model cannot rely on the ground-truth prefix. Interestingly, the authors found that the model naturally chooses to learn the problem backwards—mastering the tokens closest to the goal first, and then sequentially working its way back to the start node.
Figure 4. Acc1st(LMθ) (in percent %, Eq 7) for path-star graphs of various degrees d ∈{2, 3, 5, 10} for fixed path length l = 5 (left). Individual token accuracies (for v1, v2, v3) for the graph G5,5 under teacherless training (Eq 4) with GPT2-large (right).

Key Results

  • Complete In-Distribution Failure: Standard teacher-forced models completely fail to solve the path-star problem. Their exact-match accuracy is strictly bounded by $1/d$ (equivalent to guessing randomly at the first fork), despite achieving 100% training accuracy. This failure occurs identically in both Transformers and Mamba architectures.
  • Reversal Solves the Task: Training the models to predict the path in reverse (goal-to-start) yields near 100% accuracy across the board. This proves that the architectures are fully capable of representing and learning the solution; the failure lies entirely in the left-to-right teacher-forcing objective.
  • Teacherless Training Success: Eliminating the training crutch via teacherless training allowed GPT2-Large and GPT-Mini to successfully generalize and solve the path-finding task on simpler graph topologies where standard teacher-forcing completely failed.
Figure 3. For different architectures, we report the accuracy of the standard teacher-forced model (Accag, Eq 5), teacherless-trained model’s accuracy (Acc$, Eq 9) and accuracy of the model trained with reversed targets (Accrev, Eq 10) evaluated on path-finding a range of graphs (with degree in the first subscript, and path length in the second).

Limitations and Future Work

  • Scale and Scope: The study's arguments are primarily conceptual and empirical, tested on smaller models and synthetic tasks. The authors acknowledge they have not demonstrated these failures on massive frontier models (like Llama 2 or Mistral).
  • Optimization Hardness: While teacherless training prevents cheating, it makes the optimization landscape significantly harder. On complex, high-degree graphs, models often struggled to fit even the training data using the teacherless objective.
  • Generalization to Natural Language: It remains unclear how heavily these lookahead failures impact standard text-generation tasks. The authors speculatively suggest that tasks requiring narrative planning (like writing a story with a complex plot twist) might suffer from similar teacher-forcing pathologies, but this has yet to be empirically verified.

Summary updated

Abstract

Can a mere next-token predictor faithfully model human intelligence? We crystallize this emerging concern and correct popular misconceptions surrounding it, and advocate a simple multi-token objective. As a starting point, we argue that the two often-conflated phases of next-token prediction -- autoregressive inference and teacher-forced training -- must be treated distinctly. The popular criticism that errors can compound during autoregressive inference, crucially assumes that teacher-forcing has learned an accurate next-token predictor. This assumption sidesteps a more deep-rooted problem we expose: in certain classes of tasks, teacher-forcing can simply fail to learn an accurate next-token predictor in the first place. We describe a general mechanism of how teacher-forcing can fail, and design a minimal planning task where both the Transformer and the Mamba architecture empirically fail in that manner -- remarkably, despite the task being straightforward to learn. Finally, we provide preliminary evidence that this failure can be resolved using _teacherless_ training, a simple modification using dummy tokens that predicts multiple tokens in advance. We hope this finding can ground future debates and inspire explorations beyond the next-token prediction paradigm. We make our code available under https://github.com/gregorbachmann/Next-Token-Failures
BibTeX
@inproceedings{bachmann2024pitfalls,
  author = {Gregor Bachmann and Vaishnavh Nagarajan},
  title = {{The pitfalls of next-token prediction}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=76zq8Wkl6Z},
}
Figure