Knee-Deep in C-RASP: A Transformer Depth Hierarchy
Andy Yang, Michaël Cadilhac, David Chiang
TL;DR
The paper provides a formal theory linking Transformer depth to expressivity by proving an exact equivalence between fixed-precision Transformers (with rounding inside attention) and TL With Counting / C-RASP, preserving depth. It establishes a strict depth hierarchy for TL With Counting (and related logics), implying a corresponding depth separation for fixed-precision transformers and commonly used position encodings like RoPE and ALiBi. The authors introduce Cropping and Reduction lemmas, along with affix restrictions, to show that deeper constructs can express languages that shallower ones cannot, and they validate the theory with next-token prediction experiments on a family of ${L_k}$ languages. This work provides a rigorous foundation for understanding depth-related capabilities in Transformers and offers insights into length generalization and depth-efficient architectural design.
Abstract
It has been observed that transformers with greater depth (that is, more layers) have more capabilities, but can we establish formally which capabilities are gained? We answer this question with a theoretical proof followed by an empirical study. First, we consider transformers that round to fixed precision except inside attention. We show that this subclass of transformers is expressively equivalent to the programming language C-RASP and this equivalence preserves depth. Second, we prove that deeper C-RASP programs are more expressive than shallower C-RASP programs, implying that deeper transformers are more expressive than shallower transformers (within the subclass mentioned above). The same is also proven for transformers with positional encodings (like RoPE and ALiBi). These results are established by studying a temporal logic with counting operators equivalent to C-RASP. Finally, we provide empirical evidence that our theory predicts the depth required for transformers without positional encodings to length-generalize on a family of sequential dependency tasks.
