Causal World Representation in the GPT Model

Raanan Y. Rohekar, Yaniv Gurwicz, Sungduk Yu, Vasudev Lal · DOI

Are Large Language Models (LLMs) merely "stochastic parrots" or do they develop internal representations of the world's rules? This research, presented at ICML 2025, investigates this by deriving a causal interpretation of the Transformer's attention mechanism. The authors demonstrate that GPT models implicitly learn a Structural Causal Model (SCM) during pre-training, which allows them to generalize to out-of-distribution tasks.

Theoretical Framework: The ABCD Algorithm

The core contribution is the ABCD framework, which bridges the gap between Transformers and causal discovery. The researchers map GPT components to SCM variables: the "Values" matrix represents exogenous noise, while the attention matrix is interpreted as the transitive closure of a causal graph. By "undoing" the softmax normalization in masked self-attention, the authors recover a covariance matrix of tokens, enabling recursive causal discovery through conditional independence (CI) tests.

To quantify the model's internal clarity, they introduced the Structural Confidence Score ($R$), derived from the entropy of p-values in these CI tests. A high $R$ score indicates the model has a "certain" grasp of the underlying causal structure.

Datasets and Generalization

The study utilized two controlled environments: Othello (trained on 132,000 human games) and Chess (trained on 2.9 million human games). To distinguish between statistical pattern matching and causal understanding, the models were tested on out-of-distribution (OOD) data consisting of random legal moves rather than strategic human play.

Initial state of the Othello board used for causal world model evaluation.

Key Results: Causal Discovery and Accuracy

The model successfully recovered causal graphs in a zero-shot manner. For instance, in Chess, the attention mechanism correctly identified how early moves constrained or enabled later ones without any explicit supervision or board-state probes.

Learned causal graph and corresponding chess board states after successive moves.

The Structural Confidence Score ($R$) proved to be a robust predictor of performance. In both games, the model's ability to generate legal moves correlated linearly with its internal causal confidence. Furthermore, the researchers found that multi-head attention contains "causally smarter" heads; pruning heads with low structural confidence actually improved the model's accuracy on OOD tasks.

Conclusion

This work suggests that causal world models are a compact, efficient representation that LLMs naturally learn to minimize prediction error. While currently limited to discrete, rule-based environments, this framework provides a path toward detecting hallucinations by monitoring the "causal health" of a model's internal states during inference.

Summary updated

BibTeX
@inproceedings{rohekar2025causal,
  author = {Raanan Y. Rohekar and Yaniv Gurwicz and Sungduk Yu and Vasudev Lal},
  title = {{Causal World Representation in the GPT Model}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=qA3xHJzF6B},
}
Figure