SpectralShift:通过谱重参数化有效扩展门控DeltaNet的上下文窗口
研究论文 · 2026/09/17
近期,线性注意力层越来越多地被用于替代softmax注意力以进行大规模长上下文建模。然而,现有的上下文扩展方法通常直接进行持续预训练而不修改这些层,忽视了线性注意力状态动态的谱特性。在本工作中,我们从转移矩阵的谱视角研究Gated DeltaNet(GDN)的长上下文扩展,并识别出控制长程信息检索的两个关键因素:(1)与目标依赖长度对齐的足够宽的慢谱带,以及(2)保留快速衰减模式以实现状态清除和上下文切换。基于这一观察,我们提出SpectralShift,一种用于GDN长上下文持续预训练的谱重参数化方法。具体而言,SpectralShift通过增强慢传播能力来重参数化alpha投影初始化以重塑衰减谱,并进一步为alpha投影引入学习率缩放以促进长上下文训练。实验表明,SpectralShift在训练中持续提升长上下文能力,为扩展线性注意力模型的上下文窗口提供了一种有效且高效的解决方案。代码已在https://github.com/RUCAIBox/GDN-SpectralShift开源。
该工作从谱视角深入分析了线性注意力模型的长上下文扩展问题,提出了简单有效的重参数化方法,实验验证了其持续提升长上下文能力的效果,且代码开源,对长上下文建模研究具有参考价值。
Recently, linear attention layers have been increasingly adopted to replace softmax attention at scale for long-context modeling. However, existing context extension approaches typically apply continued pretraining directly without modifying these layers, overlooking the spectral properties of linear attention state dynamics. In this work, we study long-context extension of Gated DeltaNet (GDN) from a spectral perspective of transition matrix and identify two essential factors governing long-range information retrieval: (1) a sufficiently broad slow spectral band aligned with the target dependency length, and (2) the preservation of fast-decaying modes for state clearing and context switching. Based on this observation, we propose SpectralShift, a spectral reparameterization approach for long-context continual pretraining of GDNs. Specifically, SpectralShift reparameterizes the alpha projections initialization to reshape the decay spectrum by enhancing slow propagation capacity, and further introduces a learning-rate scaling for alpha projections to facilitate long-context training. Experiments show that SpectralShift consistently improves long-context capabilities over training, providing an effective and efficient solution for extending context windows of linear attention models. The code has been open-sourced at https://github.com/RUCAIBox/GDN-SpectralShift.