解析Transformer在动态系统中的工作机制,揭示其成功与失败的内在原因。
A Mechanistic Analysis of Transformers for Dynamical Systems
- 将自注意力视为历史依赖的线性递归,从动力系统视角分析其运作机制。
- 单头注意力受softmax凸性限制,对含正负系数的线性系统会过度平滑。
- 在非线性部分可观测系统中,注意力可自适应实现延迟嵌入,重建状态有效。
Transformer在时序建模与预测中日益广泛应用,但从动力系统角度对其内部机制的理解仍不充分。与具有成熟理论基础的经典自回归和状态空间模型不同,Transformer通常被视为黑箱。当注意力模型被用于跨多种动态范式的一般性或零样本预测时,这一差距尤为关键。本文不提出新模型,而是基于动力系统视角,研究单层Transformer在动态数据上的表征能力与局限性。我们将因果自注意力解释为一种线性、历史依赖的递归,并分析其如何处理时间信息。通过一系列线性与非线性案例研究,我们识别出不同工作模式:对于线性系统,在仅使用单头注意力时,softmax带来的凸性约束限制了可表示的自回归算子类别,导致目标动态需要混合符号滞后系数时出现过度平滑;对于部分可观测的非线性系统,注意力则表现为自适应延迟嵌入机制,当具备足够时间上下文与隐维度时,可有效实现状态重建。这些结果连接了经验观察与经典动力系统理论,揭示了Transformer作为动态系统模型在何时何地有效或失效。
原文摘要 · Abstract (English)
Transformers are increasingly adopted for modeling and forecasting time-series, yet their internal mechanisms remain poorly understood from a dynamical systems perspective. In contrast to classical autoregressive and state-space models, which benefit from well-established theoretical foundations, Transformer architectures are typically treated as black boxes. This gap becomes particularly relevant as attention-based models are considered for general-purpose or zero-shot forecasting across diverse dynamical regimes. In this work, we do not propose a new forecasting model, but instead investigate the representational capabilities and limitations of single-layer Transformers when applied to dynamical data. Building on a dynamical systems perspective, we interpret causal self-attention as a linear, history-dependent recurrence and analyze how it processes temporal information. Through a series of linear and nonlinear case studies, we identify distinct operational regimes. For linear systems, we show that in the single-head attention-only setting, the convexity constraint imposed by softmax attention restricts the class of autoregressive operators that can be represented, leading to oversmoothing when the target dynamics require mixed-sign lag coefficients. For nonlinear systems under partial observability, attention instead acts as an adaptive delay-embedding mechanism, enabling effective state reconstruction when sufficient temporal context and latent dimensionality are available. These results help bridge empirical observations with classical dynamical systems theory, providing insight into when and why Transformers succeed or fail as models of dynamical systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。