arXiv:2603.04127cs.LGcs.AI2026-03

让Transformer注意力更高效,适合小样本微调场景。

Data-Aware Random Feature Kernel for Transformers

  • 通过数据对齐内核几何,设计可高效重要性采样的随机特征
  • 在微调时性能逼近精确softmax,且训练更稳定
  • 适合资源受限环境,尤其对预训练模型的非各向同性特征有效

Transformer在多个领域表现优异,但其二次注意力复杂度限制了扩展。Random-feature attention(如Performers)通过从各向同性分布中抽取正随机特征来近似softmax核,将复杂度降至序列长度的线性。然而,在预训练模型中,查询和键通常具有各向异性,导致各向同性采样方案的蒙特卡洛方差过高,除非重训练或使用大量特征。重要性采样可通过适应输入几何调整采样分布,但数据依赖的提议分布常难求解。本文表明,通过数据对齐softmax核,可获得一个可实现低方差可解析提议分布的注意力机制,并提升训练稳定性。基于此,提出DARKFormer:一种数据感知的随机特征核Transformer,通过学习随机投影协方差,高效实现数据对齐核的重要性采样正随机特征估计器。实验显示,DARKFormer在微调阶段显著缩小了与精确softmax注意力的性能差距,尤其适用于预训练表示各向异性的场景。结合随机特征效率与数据感知内核,DARKFormer推动了资源受限条件下的核注意力发展。

原文摘要 · Abstract (English)

Transformers excel across domains, yet their quadratic attention complexity poses a barrier to scaling. Random-feature attention, as in Performers, can reduce this cost to linear in the sequence length by approximating the softmax kernel with positive random features drawn from an isotropic distribution. In pretrained models, however, queries and keys are typically anisotropic. This induces high Monte Carlo variance in isotropic sampling schemes unless one retrains the model or uses a large feature budget. Importance sampling can address this by adapting the sampling distribution to the input geometry, but complex data-dependent proposal distributions are often intractable. We show that by data aligning the softmax kernel, we obtain an attention mechanism which can both admit a tractable minimal-variance proposal distribution for importance sampling, and exhibits better training stability. Motivated by this finding, we introduce DARKFormer, a Data-Aware Random-feature Kernel transformer that features a data-aligned kernel geometry. DARKFormer learns the random-projection covariance, efficiently realizing an importance-sampled positive random-feature estimator for its data-aligned kernel. Empirically, DARKFormer narrows the performance gap with exact softmax attention, particularly in finetuning regimes where pretrained representations are anisotropic. By combining random-feature efficiency with data-aware kernels, DARKFormer advances kernel-based attention in resource-constrained settings.

Transformer注意力机制随机特征高效计算

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。