ChatPaper.aiChatPaper

フーリエ位置エンベッディング:長さの一般化のための注意の周期的拡張の強化

Fourier Position Embedding: Enhancing Attention's Periodic Extension for Length Generalization

December 23, 2024
著者: Ermo Hua, Che Jiang, Xingtai Lv, Kaiyan Zhang, Ning Ding, Youbang Sun, Biqing Qi, Yuchen Fan, Xue Kai Zhu, Bowen Zhou
cs.AI

要旨

言語モデル(LMs)のコンテキスト長を拡張するために、Rotary Position Embedding(RoPE)を改善することがトレンドとなっています。既存の研究は主に注意メカニズム内のRoPEの制限に焦点を当てていますが、本論文ではLMsのほぼすべての部分にわたる分析を提供し、RoPEベースの注意に対する長さの一般化への悪影響を明らかにしています。離散信号処理理論を用いて、RoPEが非一様離散フーリエ変換を暗黙的に達成することで周期的な注意を可能にすることを示します。しかし、この周期性は、注意以外の線形層や活性化関数によるスペクトルの損傷、および時間領域の切り捨てによってもたらされる訓練不足の周波数成分によって損なわれます。私たちの観察に基づいて、周波数領域の特性を向上させるためにFourier Position Embedding(FoPE)を提案します。FoPEはフーリエ級数を構築し、破壊的な周波数成分をゼロにして、スペクトル損傷に対するモデルの頑健性を向上させます。さまざまなモデルスケールでの実験結果は、さまざまなコンテキストウィンドウ内で、RoPEやALiBiに比べて、FoPEが針の中のハイスタックタスクにおいてより安定した困惑度と一貫した精度を維持できることを示しています。いくつかの分析と削除実験は、私たちの手法と理論モデリングをさらに支持しています。
English
Extending the context length of Language Models (LMs) by improving Rotary Position Embedding (RoPE) has become a trend. While existing works mainly address RoPE's limitations within attention mechanism, this paper provides an analysis across nearly all parts of LMs, uncovering their adverse effects on length generalization for RoPE-based attention. Using Discrete Signal Processing theory, we show that RoPE enables periodic attention by implicitly achieving Non-Uniform Discrete Fourier Transform. However, this periodicity is undermined by the spectral damage caused by: 1) linear layers and activation functions outside of attention; 2) insufficiently trained frequency components brought by time-domain truncation. Building on our observations, we propose Fourier Position Embedding (FoPE), which enhances attention's frequency-domain properties to improve both its periodic extension and length generalization. FoPE constructs Fourier Series and zero-outs the destructive frequency components, increasing model robustness against the spectrum damage. Experiments across various model scales show that, within varying context windows, FoPE can maintain a more stable perplexity and a more consistent accuracy in a needle-in-haystack task compared to RoPE and ALiBi. Several analyses and ablations bring further support to our method and theoretical modeling.

Summary

AI-Generated Summary

PDF4226December 25, 2024