Causal Evidence of Stack Representations in Modeling Counter Languages Using Transformers
2026-06-02 • Computation and Language
Computation and LanguageArtificial Intelligence
AI summaryⓘ
The authors studied how transformer models, used in language tasks, internally keep track of information like a stack. They trained simple tools to find signals related to stack depth inside the model's memory. When they removed these signals, the model's ability to process sequences dropped dramatically. This shows the stack-like information is not just stored but crucial for the model to work well.
transformersformal languagesstack structurelinear probeshidden statesrepresentation learningablation studynext token predictioncausal rolesequential accuracy
Authors
Nishit Singh
Abstract
Formal languages have proven to be effective conduits to understand the inner mechanisms of transformers. Past work has shown that transformers trained on next token prediction over counter languages learn representations consistent with an underlying stack structure. Beyond representational analysis, this paper investigates the causal role of these representations. Linear probes are trained to predict the stack depth at each token from the model's hidden states, and a principal representation direction is extracted from the probe. Ablation of this direction from the model causes sequential accuracy to collapse to near 0%, providing strong empirical evidence that the stack representation is not just learned, but is causally necessary for model performance.