Abstract
Modern Large Language Models (LLMs) primarily rely on next-token prediction (NTP) and teacher forcing, which can lead to a lack of long-term planning and "exposure bias" during inference. We introduce TRELAWNEY, a data-centric training methodology that improves LLM planning by interleaving future tokens into training sequences. By requiring models to predict future goals before generating intermediate steps, TRELAWNEY effectively teaches models to "think ahead." Our experiments across pathfinding, algorithmic reasoning, and story generation demonstrate that TRELAWNEY significantly outperforms standard NTP baselines without requiring architectural modifications or degrading general language capabilities.
Introduction
The success of LLMs is largely built on Next-Token Prediction (NTP). However, this paradigm has inherent limitations. During training, models are "spoon-fed" the ground truth for every preceding token (teacher forcing), which can prevent them from learning the underlying logic of a task. This often results in the "Clever Hans" effect, where models exploit local surface patterns, and "exposure bias," where small errors during autonomous generation (inference) compound into total failure.
Crucially, standard NTP does not encourage planning. In tasks like navigating a maze or writing a coherent story, humans typically have a goal in mind before they begin. Standard LLMs, by contrast, generate one token at a time, hoping the sequence eventually reaches a sensible conclusion.
Methodology: The TRELAWNEY Approach
TRELAWNEY (named after the seer from Harry Potter) addresses these issues by modifying the training data rather than the model architecture. The core idea is to change the joint probability factorization the model learns by reordering information.
Instead of a standard sequence $(y_1, y_2, \dots, y_T)$, TRELAWNEY augments the data by inserting a "lookahead" sequence $z$—representing a future state or goal—earlier in the string, delimited by special tags: $$(y_1, y_2, \dots, y_d, <T>, z, </T>, y_{d+1}, \dots, y_T)$$
This approach decouples the training objective from the data-generating process. By forcing the model to predict the content of the future goal $z$ before the intermediate tokens, the model learns to "pre-cache" global information that guides its local generation. During training, the loss function is masked for the special start token <T> to avoid penalizing the model for not predicting when a plan starts, focusing instead on the content of the plan and the subsequent path.
Experimental Evaluation
We evaluated TRELAWNEY across several domains requiring different levels of reasoning and planning:
- Star Graph Pathfinding: A synthetic task where a model must navigate from a start node to a goal. The first step is critical; choosing the wrong branch at the start makes the goal unreachable.
- Algorithmic Reasoning (CLRS-Text): Specifically Tarjan’s algorithm for finding Strongly Connected Components (SCC), which requires maintaining complex internal states over long sequences.
- Tiny Stories: A natural language task testing "goal-conditioned" generation, where the model must reach a specific sentence at a specific point in a story.
Key Results
TRELAWNEY demonstrated substantial performance gains across all benchmarks:
- Pathfinding: On Star Graphs where standard NTP models dropped to 5% accuracy as complexity increased, TRELAWNEY models maintained 100% accuracy.
- Algorithmic Tasks: In the SCC task, TRELAWNEY-Random significantly outperformed the baseline, achieving 51.2% accuracy on the most difficult variants compared to 27% for standard training.
- Controllable Generation: In the Tiny Stories task, TRELAWNEY achieved a 76.5% win rate over few-shot prompting when judged by GPT-4 for its ability to reach specified goals.
- General Capability: Testing on WikiText confirmed that TRELAWNEY does not impose a "tax" on general language modeling; perplexity remained virtually identical to standard models.
Conclusion and Future Directions
TRELAWNEY demonstrates that planning in LLMs can be treated as a data-ordering problem rather than an architectural one. By simply rearranging how information is presented during training, we can induce "lookahead" behavior that makes models more robust and controllable.
Future work will explore scaling these methods to larger pre-trained models and developing mechanisms for models to autonomously decide when to "stop and plan" during inference. Additionally, the structured nature of the lookahead tokens provides a promising interface for further refinement via Reinforcement Learning from Human Feedback (RLHF).
Summary updated