A Causal World Model Underlying Next Token Prediction: Exploring GPT in a Controlled Environment

R. Y. Rohekar, Yaniv Gurwicz, Sungduk Yu, Estelle Aflalo, Vasudev Lal
2/12/2026

No official code found. Best implementation: IntelLabs/causality-lab (250 stars, Apache-2.0, last commit 2025-07-10).

Abstract

Are generative pre-trained transformer (GPT) models, trained only to predict the next token, implicitly learning a world model from which sequences are generated one token at a time? We address this question by deriving a causal interpretation of the attention mechanism in GPT and presenting a causal world model that arises from this interpretation. Furthermore, we propose that GPT models, at inference time, can be utilized for zero-shot causal structure learning for input sequences, and introduce a corresponding confidence score. Empirical tests were conducted in controlled environments using the setups of the Othello and Chess strategy games. A GPT, pre-trained on real-world games played with the intention of winning, was tested on out-of-distribution synthetic data consisting of sequences of random legal moves. We find that the GPT model is likely to generate legal next moves for out-of-distribution sequences for which a causal structure is encoded in the attention mechanism with high confidence. In cases where it generates illegal moves, it also fails to capture a causal structure.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Causal discovery algorithms and tools for implementing new ones

25031Python, Jupyter NotebookNov 25, 20211 years agoApache-2.0
causal-discoverycausal-reasoningcausality-algorithmsconstraint-based-causalityexplainable-ai+1 more

Similar Papers

Cite this paper

@article{rohekar2026causal,
  title  = {A Causal World Model Underlying Next Token Prediction: Exploring GPT in a Controlled Environment},
  author = {R. Y. Rohekar and Yaniv Gurwicz and Sungduk Yu and Estelle Aflalo and Vasudev Lal},
  year   = {2026},
  eprint = {2412.07446},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2412.07446},
  journal = {ICML 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2412.07446.svg)](https://codeofpaper.com/paper/2412.07446)

Discussion