NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Beyond Position: the emergence of wavelet-like properties in Transformers

Valeria Ruscio, Umberto Nanni, Fabrizio Silvestri

TL;DR

Transformer models using Rotary Position Embeddings (RoPE) don't just learn to track positions; they spontaneously evolve into sophisticated multi-resolution signal processors. By organizing attention heads into specialized frequency bands, these models implement an emergent "wavelet-like" transform that overcomes the inherent theoretical limitations of their positional encodings.

What Problem Does This Paper Address?

Transformers are inherently "bag-of-words" models—they don't know the order of tokens unless we tell them. Rotary Position Embeddings (RoPE) have become the industry standard for providing this signal (used in LLaMA, Mistral, etc.). However, RoPE faces a fundamental mathematical paradox: the uncertainty principle.

In signal processing, you generally can't have perfect resolution in both position (where a token is) and frequency (the broader patterns/rhythms of the text) simultaneously. Furthermore, RoPE is periodic, which can lead to "aliasing"—where the model confuses distant positions for nearby ones in very long sequences. Despite these theoretical hurdles, RoPE-based models perform exceptionally well. This paper investigates why they work so well and how they bypass these architectural constraints.

Methods

The authors treat Transformer attention patterns as signals and apply a battery of classical signal processing tools to analyze them:

  • Frequency Analysis: Using Discrete Fourier Transforms (DFT) to see which "frequencies" (local vs. global patterns) different attention heads focus on.
  • Wavelet Analysis: Specifically using the Daubechies-2 (db2) wavelet to measure how heads balance spatial localization with scale-dependent behavior.
  • Uncertainty Analysis: Calculating the correlation between positional entropy (how spread out attention is) and spectral entropy (how complex the frequency response is).
  • Scale Invariance Testing: Measuring how much attention patterns change when the input sequence is rescaled (e.g., shortened to 50% or 25%).
  • Evolutionary Analysis: Tracking these metrics across the training checkpoints of the Pythia model family to see how these properties emerge over time.

Datasets

The study evaluates several prominent open-source LLMs: Gemma 2 (2B), Pythia (2.8B & 12B), LLaMA-3.2 (1B), Mistral (7B), and Qwen 2.5 (5B). For the evolutionary analysis, they used the full checkpoint history of Pythia 6.9B. All models were tested on a curated sample of 500 sequences drawn from Wikipedia.

Key Insights and Ideas

  • Spontaneous Specialization: Attention heads do not act as a monolithic block. Instead, they specialize into "local" and "global" processors. This creates a branching structure strikingly similar to a wavelet packet decomposition.
Figure 1: Local vs Global attention distribution from Pythia 12B
  • Implicit Uncertainty Principle: The models "know" physics. The authors found a consistent negative correlation between positional and spectral precision across all models. This confirms that Transformers have implicitly learned to navigate the Heisenberg-Gabor uncertainty principle to optimize information flow.
  • The "Exploratory" Phase: Training isn't a linear improvement. Models go through a chaotic "exploratory phase" (peaking around step 1,000 in Pythia) where spectral entropy surges and frequency selectivity plummets, before settling into a refined "specialization phase."
  • RoPE is Unique: This wavelet-like emergence is a specific byproduct of RoPE. When the authors ablated the model using absolute embeddings (BERT-style) or relative biases (T5-style), the models remained "rigid" and failed to develop the same robust, scale-invariant multi-resolution strategies.

Key Results

  • Frequency Stratification: In mature models, low-frequency components (0–0.25 $\omega_N$) form the "contextual backbone," capturing 60–80% of the spectral power, while high-frequency heads handle fine-grained local details.
Figure 2: Frequency band distribution across heads from Pythia 12B
  • Superior Scale Invariance: RoPE models demonstrated remarkably low scale sensitivity (e.g., 0.030 for Mistral 7B) compared to non-rotary models like T5 (0.627) or BERT (0.507). This explains why RoPE models generalize better to different sequence lengths.
  • Perfect Reconstruction: The authors showed that attention patterns can be reconstructed from their wavelet coefficients with an incredibly low error ($\sim 10^{-7}$), proving that the "wavelet frame" is not just a metaphor but a mathematically faithful representation of the model's internal logic.

Limitations and Future Work

  • Inference vs. Training: The primary analysis looks at pre-trained models at inference time. While the Pythia analysis gives a glimpse into training, a more continuous, fine-grained study of the "phase shifts" during training is needed.
  • Modality and Language: The findings are based on English text. The authors note that further research is required to see if these wavelet properties emerge in vision, audio, or multi-lingual Transformers.
  • Architectural Innovation: The authors suggest that since these wavelet structures are "optimal," we might be able to speed up training by pre-initializing attention heads to a wavelet-like basis, bypassing the inefficient "exploratory phase" altogether.

Summary updated

BibTeX
@inproceedings{ruscio2025beyond,
  author = {Valeria Ruscio and Umberto Nanni and Fabrizio Silvestri},
  title = {{Beyond Position: the emergence of wavelet-like properties in Transformers}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure