用形式化方法证明深度Transformer能线性表示语法层次结构。
An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars
- 基于有限深度无递归文法,构建可线性扩展的Transformer模型。
- 模型深度与语法深度成线性关系,神经元数随规则数平方增长。
- 揭示了深层变换器在残差流中线性分离抽象语法状态的能力。
深度神经网络被认为通过形成层次化表示来获得表达能力,逐步捕捉更抽象、组合性的特征。在语言建模中,Transformer已成为主流架构,早期层捕获局部句法模式,后期层编码复杂的从句级依赖。尽管这一直觉影响了模型设计,但缺乏严谨的理论工作阐明深度Transformer如何表征此类层次结构。本文通过有限深度、非递归上下文无关文法的形式化视角分析深度Transformer的表达能力。我们显式构造了具有位置注意力的Transformer,其深度随文法深度线性增长,神经元数量与推导树形状数成正比,且随产生式规则数的平方增长。理论结果支持线性表示假说,表明这些架构具备将抽象语法状态编码到残差流低维线性可分子空间中的结构能力。
原文摘要 · Abstract (English)
Deep neural networks are widely believed to derive their expressive power from their ability to form \textbf{hierarchical representations}, capturing progressively more abstract and compositional features across layers. In language modeling, \textbf{transformers} have emerged as the dominant architecture, with early layers capturing local syntactic patterns and later layers encoding more complex clause-level dependencies. While this intuition has shaped model design, there remains a lack of rigorous theoretical work demonstrating \textbf{how} deep transformers represent such hierarchical structures. In this work, we analyze the expressiveness of deep transformer models through the formal lens of bounded-depth, non-recursive context-free grammars. For this class of grammars, we explicitly construct transformers with positional attention whose depth grows linearly with grammar depth, while the neuron count scales with the number of derivation-tree shapes and quadratically with the number of production rules. Our theoretical results support the linear representation hypothesis by demonstrating that these architectures possess the structural capacity to encode abstract grammatical states into low-dimensional, linearly separable subspaces within the residual stream.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。