Fourier Position Embedding: Enhancing Attention's Periodic Extension for Length Generalization
🤗 Upvotes: 20 | cs.AI, cs.CL Authors: Ermo Hua, Che Jiang, Xingtai Lv, Kaiyan Zhang, Ning Ding, Youbang Sun, Biqing Qi, Yuchen Fan, Xue Kai Zhu, Bowen Zhou Title: Fourier Position Embedding: Enhancing Attention's Periodic Extension for Length Generalization Arxiv: http://arxiv.org/abs/2412.17739v1 Abstract: 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.
You May Also Like

The Grave Talks | Haunted, Paranormal & Supernatural
Ghost Stores, Haunted, Paranormal & Supernatural Stories

Sasquatch Chronicles
Sasquatch Chronicles - Bigfoot Encounters

Somewhere in the Skies
SpectreVision Radio

UAP Files Podcast
UAP Files Podcast
![Cosmosis [Formerly The UFO Rabbit Hole]](https://megaphone.imgix.net/podcasts/d3ee87c2-574f-11f0-b7e9-5fbb4796470a/image/6f967dac188a10d90dcdbd82d3194a98.png?ixlib=rails-4.3.1&max-w=3000&max-h=3000&fit=crop&auto=format,compress)
Cosmosis [Formerly The UFO Rabbit Hole]
Kelly Chase
Life, Death, and Taxonomy
Life, Death, and Taxonomy

Podcast de Juan Ramón Rallo
Juan Ramón Rallo

Vida Eterna. Respuestas desde la Ciencia | Dr. Manuel Sans Segarra
Dr. Manuel Sans Segarra

The Best of Coast to Coast AM
iHeartPodcasts and Coast to Coast AM

Let's Science
SQPN, Inc.
Community discussion