Learning to Achieve Goals with Belief State Transformers

Edward S. Hu, Kwangjun Ahn, Qinghua Liu, Haoran Xu, Manan Tomar, Ada Langford, Dinesh Jayaraman, Alex Lamb, John Langford · OpenReview

Abstract: We introduce the "Belief State Transformer", a next-token predictor that takes both a prefix and suffix as inputs, with a novel objective of predicting both the next token for the prefix and the previous token for the suffix. The Belief State Transformer effectively learns to solve challenging problems that conventional forward-only transformers struggle with, in a domain-independent fashion. Key to this success is learning a compact belief state that captures all relevant information necessary for accurate predictions. Empirical ablations show that each component of the model is essential in difficult scenarios where standard Transformers fall short. For the task of story writing with known prefixes and suffixes, our approach outperforms the Fill-in-the-Middle method for reaching known goals and demonstrates improved performance even when the goals are unknown. Altogether, the Belief State Transformer enables more efficient goal-conditioned decoding, better test-time inference, and high-quality text representations on small scale problems.

Introduction

Standard autoregressive language models, while powerful, often struggle with tasks requiring long-term planning and goal-conditioned reasoning. A primary reason is their reliance on next-token prediction, which can lead models to adopt "flawed cheats"—local heuristics that fail to account for global objectives. For instance, in navigation tasks like the Star Graph problem, standard transformers often learn to pick any valid neighbor rather than the specific one leading to a goal node. Once trapped in such a local minimum, correcting the error requires solving complex optimization problems that are difficult for gradient-based methods. The Belief State Transformer (BST) addresses this by forcing the model to learn a compact "belief state" that bridges the gap between past prefixes and future goals.

Methodology: The BST Architecture

The BST introduces a bidirectional training objective supported by a dual-encoder architecture. Unlike standard models that only look forward, the BST processes both a Forward Encoder for the prefix and a Backward Encoder for the suffix (the goal state).

The Belief State Transformer architecture uses dual encoders to process prefix and suffix information simultaneously to predict bridging tokens.

The Bidirectional Objective

Instead of simple next-token prediction, the model is trained to simultaneously predict:

  1. The token immediately following the prefix ($x_{t+1}$).
  2. The token immediately preceding the suffix ($x_{t+k-1}$).

By conditioning the output on both encodings, the model must "coalesce" information into a latent belief state. This state represents a summary of the past that is sufficient to predict the bridge to the future. To maintain efficiency, the authors found that subsampling just 2% of possible prefix-suffix pairs during training was sufficient to achieve high performance without the $O(T^2)$ complexity of exhaustive pairing.

Experimental Results

The model was evaluated on two primary benchmarks: synthetic Star Graphs ($G(d, l)$) to test planning limits, and the TinyStories dataset for goal-conditioned narrative generation.

Star Graph Mastery

In the Star Graph stress test, standard GPT and "Fill-in-the-Middle" (FIM) models fail as the graph complexity increases. The BST, however, maintains a near-perfect success rate by avoiding the optimization traps that plague forward-only models.

Success rates on Star Graph tasks show the Belief State Transformer significantly outperforming standard next-token and Fill-in-the-Middle (FIM) baselines as task difficulty increases.

Narrative Generation

On the TinyStories benchmark, the BST was used to fill in the middle of stories given a beginning and an ending. In evaluations using a GPT-4 judge, BST-generated stories were preferred 64% of the time over FIM baselines. The BST demonstrated superior narrative coherence and smoother transitions to required endings, avoiding the abrupt "teleportation" to the goal often seen in standard models.

Conclusion and Future Work

The Belief State Transformer demonstrates that incorporating future goals into the training objective allows models to learn more robust internal representations of world states. While currently tested at small-to-medium scales (up to 114M parameters), the BST offers a promising path for improving planning in large language models. Future research will explore scaling these benefits to larger architectures and applying the BST framework to domains like robotics and reinforcement learning, where goal-reaching is the primary metric of success.

Summary updated

BibTeX
@inproceedings{hu2025learning,
  author = {Edward S. Hu and Kwangjun Ahn and Qinghua Liu and Haoran Xu and Manan Tomar and Ada Langford and Dinesh Jayaraman and Alex Lamb and John Langford},
  title = {{Learning to Achieve Goals with Belief State Transformers}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=ThRMTCgpvo},
}
Figure