多头注意力作为集成Nadaraya-Watson估计:方差缩减、去相关与最优头多样性 Multi-Head Attention as Ensemble Nadaraya-Watson Estimation: Variance Reduction, Decorrelation, and Optimal Head Diversity 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-05-18
👁️ 预览文献
💡 AI 中文简介
这篇论文把Transformer中的多头注意力(MHA)从统计学角度解释成一组Nadaraya-Watson核回归估计器的集成。作者推导出MHA均方误差的偏差-方差-协方差分解,证明方差缩减不只取决于头数H,更取决于各头输出之间的去相关程度,并用投影子空间的主夹角来刻画。他们提出可计算的“头多样性指数”(HDI),证明MSE随HDI单调下降,从而首次从理论上解释了注意力头会专业化分工的现象。在总维度预算固定时,还求出了最优头数与每头维度的分配方案。
领域机器学习理论 / 统计学习理论(深度学习可解释性与Transformer架构理论)
适合谁读需要一定专业背景(概率统计、核回归、深度学习基础)
核心贡献1. 首次将多头注意力严格刻画为Nadaraya-Watson估计器的结构化集成,并给出MSE的偏差-方差-协方差显式分解,证明方差缩减本质上取决于头间去相关而非头数。2. 提出可计算的头多样性指数(HDI),证明MSE随HDI单调递减,并在固定总维度预算下求解最优头维度分配,导出新的架构缩放律。
关键数据在固定总维度预算D=H·d_k下,最优每头维度d_k*随训练集规模对数增长,最优头数H*随总预算D近似线性增长;MSE随头多样性指数HDI单调递减。
推荐理由如果你想搞懂多头注意力为什么有效、头数该设多少,这篇用统计学的语言把'集成+去相关'讲得明明白白,还给出了可计算的多样性指标和缩放律,理论控必读。
关键词["多头注意力", "Nadaraya-Watson估计", "集成学习", "方差缩减", "去相关", "注意力头多样性"]

原文摘要

查看英文原文摘要

We develop a rigorous statistical theory of multi-head attention (MHA) as an ensemble of Nadaraya-Watson (NW) kernel regression estimators. Building on the algebraic identity between single-head softmax attention and the NW estimator, we prove that MHA is a structured ensemble of H NW estimators, each operating in a distinct learned projection subspace of the key space. We derive an explicit Bias-Variance-Covariance decomposition of the MHA mean squared error, showing that variance reduction depends not merely on the number of heads H but fundamentally on the decorrelation of head outputs. Decorrelation is governed by the principal angles between learned projection subspaces: orthogonal projections yield maximum variance reduction; aligned projections yield none. We introduce the Head Diversity Index (HDI), a computable spectral measure of inter-head decorrelation, and prove that MHA mean squared error is monotonically decreasing in HDI. This provides the first rigorous theoretical explanation for the empirically observed specialization of attention heads. Under a fixed total-dimension budget D = H * d_k, we solve the optimal head-dimension allocation problem, deriving the MSE-minimizing pair (H*, d_k*) from data distribution and regression smoothness. The solution yields a new architectural scaling law: the optimal per-head dimension grows logarithmically with training set size, while the optimal number of heads grows nearly linearly with the total budget D. Our framework unifies three strands of prior work: the NW theory of single-head attention, the general weighting theory for ensemble learning, and the decorrelation-variance-reduction isomorphism between biological and computational ensembles. Multi-head attention is the Transformer's instantiation of a universal principle: identical agents plus diversity-enforcing mechanisms yields emergent optimality.