Causal Evidence of Stack Representations in Modeling Counter Languages Using Transformers

Nishit Singh
6/2/2026
cs.CLcs.AI
transformer-attention

No confident code implementation found for this paper.

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{singh2026causal,
  title  = {Causal Evidence of Stack Representations in Modeling Counter Languages Using Transformers},
  author = {Nishit Singh},
  year   = {2026},
  eprint = {2606.03398},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.03398v1}
}

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/2606.03398.svg)](https://codeofpaper.com/paper/2606.03398)

Discussion