English

Structured World Representations in Maze-Solving Transformers

Machine Learning 2023-12-06 v1 Artificial Intelligence

Abstract

Transformer models underpin many recent advances in practical machine learning applications, yet understanding their internal behavior continues to elude researchers. Given the size and complexity of these models, forming a comprehensive picture of their inner workings remains a significant challenge. To this end, we set out to understand small transformer models in a more tractable setting: that of solving mazes. In this work, we focus on the abstractions formed by these models and find evidence for the consistent emergence of structured internal representations of maze topology and valid paths. We demonstrate this by showing that the residual stream of only a single token can be linearly decoded to faithfully reconstruct the entire maze. We also find that the learned embeddings of individual tokens have spatial structure. Furthermore, we take steps towards deciphering the circuity of path-following by identifying attention heads (dubbed adjacency heads\textit{adjacency heads}), which are implicated in finding valid subsequent tokens.

Keywords

Cite

@article{arxiv.2312.02566,
  title  = {Structured World Representations in Maze-Solving Transformers},
  author = {Michael Igorevich Ivanitskiy and Alex F. Spies and Tilman Räuker and Guillaume Corlouer and Chris Mathwin and Lucia Quirke and Can Rager and Rusheb Shah and Dan Valentine and Cecilia Diniz Behn and Katsumi Inoue and Samy Wu Fung},
  journal= {arXiv preprint arXiv:2312.02566},
  year   = {2023}
}

Comments

15 pages, 18 figures, 15 tables. Corresponding author: Michael Ivanitskiy (mivanits@mines.edu). Code available at https://github.com/understanding-search/structured-representations-maze-transformers

R2 v1 2026-06-28T13:41:22.563Z