Theoretical Analysis of Hierarchical Language Recognition and Generation by Transformers without Positional Encoding
Abstract
In this study, we provide constructive proof that Transformers can recognize and generate hierarchical language efficiently with respect to model size, even without the need for a specific positional encoding. Specifically, we show that causal masking and a starting token enable Transformers to compute positional information and depth within hierarchical structures. We demonstrate that Transformers without positional encoding can generate hierarchical languages. Furthermore, we suggest that explicit positional encoding might have a detrimental effect on generalization with respect to sequence length.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
1 top-tier paper has cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Transformers are uninterpretable with myopic methods: a case study with bounded Dyck grammars cites Self-Attention Networks Can Process Bounded Hierarchical Languages
- Transformers are uninterpretable with myopic methods: a case study with bounded Dyck grammars cites On Layer Normalization in the Transformer Architecture
Cited by top-tier papers1
Builds on4
- Efficient Streaming Language Models with Attention SinksGuangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han et al.ICLR 2024 · 1,714 citations
- On Layer Normalization in the Transformer ArchitectureRuibin Xiong, Yunchang Yang, Di He, Kai Zheng et al.ICML 2020 · 1,388 citations
- Transformers are uninterpretable with myopic methods: a case study with bounded Dyck grammarsKaiyue Wen, Yuchen Li, Bingbin Liu, Andrej RisteskiNeurIPS 2023 · 32 citations
- Self-Attention Networks Can Process Bounded Hierarchical LanguagesShunyu Yao, Binghui Peng, Christos H. Papadimitriou, Karthik NarasimhanACL 2021
Related papers
- Transformer Language Models without Positional Encodings Still Learn Positional InformationAdi Haviv, Ori Ram, Ofir Press, Peter Izsak et al.EMNLP Findings 2022 · 61 citations
- Why Are Positional Encodings Nonessential for Deep Autoregressive Transformers? A Petroglyph RevisitedKazuki IrieACL Findings 2025
- A Formal Framework for Understanding Length Generalization in TransformersXinting Huang, Andy Yang, Satwik Bhattamishra, Yash Raj Sarrof et al.ICLR 2025
- The Curious Case of Absolute Position EmbeddingsKoustuv Sinha, Amirhossein Kazemnejad, Siva Reddy, Joelle Pineau et al.EMNLP Findings 2022 · 7 citations
- How Transformers Represent Hierarchies: A Local-to-Global MechanismZhiling Zhou, Tianhao Wang, Zhuoran YangICML 2026
