提出在Transformer中插入扩散层的位置影响模型性能,早插有效、晚插有害。
Where to Add PDE Diffusion in Transformers
- 用热方程离散步建模局部扩散,分析其与注意力的非交换性
- 早期插入使准确率提升4.1个百分点,后期插入则下降2.5个百分点
- 理论框架可指导局部-全局模块的结构设计,适合模型优化研究者
Transformer通过自注意力实现内容驱动的全局路由,但缺乏序列轴上的显式局部几何先验。因此,混合架构中局部模块的位置多依赖经验。本文研究一种基于一维热平滑的确定性偏微分方程(PDE)扩散层,采用离散诺伊曼拉普拉斯算子的一次欧拉步,并在谱稳定性约束下进行分析,核心问题是:扩散应置于注意力之前还是之后?我们发现扩散与注意力通常不满足交换律,前置与后置导致行为本质不同。为此构建三层算子理论框架:(1)对扩散子系统建立无条件保证,包括当步长小于1/2时的谱非扩张性和单调狄利克雷能量耗散;(2)推导组合扰动界,将插入位置的影响与表示粗糙度及下游放大效应关联;(3)利用扩散-注意力非交换性诊断结构双重混杂冲突。基于理论,在长序列基准(Long Range Arena)上评估七种插入位置。早期扩散作为有效预正则化,嵌入后应用可使平均准确率提升4.1个百分点;而注意力后插入则使性能下降2.5个百分点,与预测一致。多尺度扩散变体在相同全局稳定性约束下持续获得增益。本分析为序列模型中局部-全局组合提供了通用推理模板,包含可证明保证、组合边界和机制诊断。
原文摘要 · Abstract (English)
Transformers enable powerful content-based global routing via self-attention, but they lack an explicit local geometric prior along the sequence axis. As a result, the placement of locality-inducing modules in hybrid architectures has largely been empirical. We study a simple deterministic PDE diffusion layer implemented as one explicit Euler step of one-dimensional heat smoothing using a discrete Neumann Laplacian under a spectral stability constraint, and ask a structural question: where should diffusion be inserted relative to attention? Our central claim is that diffusion and attention generally do not commute, so inserting the same local operator before versus after attention leads to qualitatively different behaviors. We develop a three-layer operator-theoretic framework that (1) establishes unconditional guarantees for the diffusion subsystem, including spectral non-expansiveness and monotone Dirichlet-energy dissipation when the diffusion step size is smaller than one half, (2) derives compositional perturbation bounds linking insertion effects to representation roughness and downstream amplification, and (3) uses diffusion-attention non-commutativity as a diagnostic for structural double-mixing conflicts. Guided by theory, we evaluate seven insertion positions on the Long Range Arena benchmark. Early diffusion acts as effective pre-regularization, improving average accuracy by 4.1 percentage points when applied after embedding, while post-attention diffusion degrades performance by 2.5 percentage points, consistent with the predicted conflict. A multi-scale diffusion variant yields consistent gains under the same global stability constraint. Our analysis provides a general template for reasoning about local-global compositions in sequence models by separating provable guarantees, compositional bounds, and mechanistic diagnostics.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。