Beyond Sinusoids: A Morlet Wavelet Framework for Transformer Positional Encoding
This paper introduces Morlet Positional Encoding (MoPE), a novel framework that unifies sinusoidal and rotary positional encodings as limiting cases of a learnable wavelet-based approach, demonstrating improved performance in transformer models by simultaneously encoding position and locality while converging to the wavelet admissibility boundary.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Big Problem: "Where" vs. "How Far"
Imagine you are reading a book. Standard AI models (Transformers) have a built-in way of knowing where a word is in the sentence. They use a system called "Positional Encoding."
Currently, the two most popular systems (Sinusoidal and ROPE) act like a perfect, infinite ruler. They tell the AI, "This word is the 5th word," and "This word is the 100th word." But they treat every position exactly the same: they assume the influence of a word stretches forever.
The author argues this is wrong for language. In a story, the word "he" might refer to a character mentioned two sentences ago, but it probably doesn't refer to a character mentioned two chapters ago. Standard rulers don't know how far a word's influence should reach; they just say "it's here."
The Solution: The "Flashlight" (MOPE)
The author proposes a new system called Morlet Positional Encoding (MOPE).
Instead of a ruler that goes on forever, MOPE acts like a flashlight.
- The Beam (Phase): Like the old systems, it tells the AI the exact angle or "phase" of the word (e.g., "You are at the 5th step of the dance"). This part is identical to the popular ROPE system.
- The Glow (Amplitude): This is the new part. The flashlight beam gets dimmer the further you get from the center. In MOPE, the "brightness" of a position signal fades away as you move away from the start of the sequence.
The Analogy:
- Old System (ROPE/Sin-cos): Imagine a stadium where every seat is lit up with a bright, unchanging light. A fan in seat 1 is just as "visible" to the announcer as a fan in seat 10,000.
- New System (MOPE): Imagine a spotlight. The person in the center is super bright. As you move to the back rows, the light gets softer and eventually fades. This tells the AI: "Pay close attention to words nearby; words far away are less relevant right now."
The "Magic" Connection
The paper proves something fascinating: The old systems (Sin-cos and ROPE) are actually just broken versions of this new flashlight system.
- If you make the flashlight beam infinitely wide (so it never gets dim), you get the old ROPE system.
- If you make the beam infinitely wide and remove the rotation, you get the old Sin-cos system.
So, MOPE isn't just a new idea; it's the "parent" of the old ideas. It learns from the data how wide the flashlight beam should be for each part of the AI's brain.
What Happened in the Experiments?
The author tested this on a tiny dataset (a few thousand words from Shakespeare). Here is what they found:
- The Combo is King: When they combined this new "Flashlight" (MOPE) with a different tool called "Energy-Gated Attention" (which acts like a bouncer deciding which words are important), the AI got significantly better at predicting the next word. It beat using either tool alone.
- The "Sweet Spot" Discovery: The AI had to learn how wide to make the flashlight beams. Surprisingly, every single one of the 128 "flashlights" in the AI's brain adjusted itself to hit a specific mathematical limit. They all settled on a beam width that is neither too narrow nor too wide, but just right for the "character-to-word" scale.
- Think of it like tuning 128 radios: Instead of tuning them to different stations, they all locked onto the exact same frequency where the signal is clearest.
- The "Start" Bias: The current version of MOPE has a quirk. It assumes the "center" of the flashlight is always at the very beginning of the text (Word #1). This means Word #5 is naturally "brighter" than Word #200, even if the story is about to start. The author admits this is a limitation and suggests future versions should let the AI learn where the "center" of the flashlight should be.
Summary
The paper suggests that instead of using a rigid, infinite ruler to track word positions, we should use a smart, fading spotlight. This spotlight learns how far its influence should reach.
- Old way: "I am here, and I am important forever."
- New way (MOPE): "I am here, and I am important for a short distance, then I fade out."
The experiments show that this "fading" approach, when paired with other smart attention tools, helps the AI understand the local structure of language (like sentences and phrases) much better than the old methods.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.