Do Transformers Grok Succinct Algorithms? Mechanistic Evidence for Counting Circuits

Yizheng Zhao


Abstract
Recent theory suggests Transformers are inherently succinct, capable of representing recursive algorithms like binary counting over exponential state spaces using constant-size circuits, unlike the exponential bottleneck of RNNs. However, it remains unclear under what conditions gradient-trained Transformers converge to these predicted succinct circuits, or whether they settle for heuristics. We bridge this gap by rigorously testing the Succinctness Hypothesis via mechanistic interpretability on the LargeCounter task. We report a striking dichotomy: shallow Transformers (d=64) generalize perfectly, whereas massive LSTM baselines (d=2048) fail completely (<6% accuracy), empirically validating the succinctness gap. This dichotomy extends to modern state-space models: Mamba and Mamba-2 fail even more catastrophically (<1.1%), confirming the hierarchy Transformer LSTM > SSM predicted by formal complexity results. We show this capability is acquired via a grokking phase transition driven by a weight-norm "complexity collapse". Mechanistic analysis reveals the learned circuit aligns precisely with Boolean RASP theory: attention heads utilize Rotary Positional Embeddings (RoPE) for "Same-Bit Lookup", while MLPs act as exact XOR/AND logic gates. Furthermore, we detect analogous "Arithmetic Heads" in pre-trained LLMs (Pythia), suggesting that succinctness is a representational inductive bias that, when activated by sufficient regularization, governs how models learn algorithmic reasoning.
Anthology ID:
2026.findings-acl.1301
Volume:
Findings of the Association for Computational Linguistics: ACL 2026
Month:
July
Year:
2026
Address:
San Diego, California, United States
Editors:
Maria Liakata, Viviane P. Moreira, Jiajun Zhang, David Jurgens
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
26114–26130
Language:
URL:
https://aclanthology.org/2026.findings-acl.1301/
DOI:
10.18653/v1/2026.findings-acl.1301
Bibkey:
Cite (ACL):
Yizheng Zhao. 2026. Do Transformers Grok Succinct Algorithms? Mechanistic Evidence for Counting Circuits. In Findings of the Association for Computational Linguistics: ACL 2026, pages 26114–26130, San Diego, California, United States. Association for Computational Linguistics.
Cite (Informal):
Do Transformers Grok Succinct Algorithms? Mechanistic Evidence for Counting Circuits (Zhao, Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-acl.1301.pdf
Checklist:
 2026.findings-acl.1301.checklist.pdf