Achter RoPE: Hoe Codeert het Causale Masker Positionele Informatie?
Behind RoPE: How Does Causal Mask Encode Positional Information?
September 25, 2025
Auteurs: Junu Kim, Xiao Liu, Zhenghao Lin, Lei Ji, Yeyun Gong, Edward Choi
cs.AI
Samenvatting
Hoewel expliciete positionele coderingen zoals RoPE een primaire bron van positionele informatie zijn in Transformer-decoders, biedt ook het causale masker positionele informatie. In dit werk bewijzen we dat het causale masker positieafhankelijke patronen in aandachtsscores kan induceren, zelfs zonder parameters of causale afhankelijkheid in de invoer. Onze theoretische analyse geeft aan dat het geïnduceerde aandachtspatroon de neiging heeft om nabije query-sleutelparen te bevoordelen, wat het gedrag van veelvoorkomende positionele coderingen weerspiegelt. Empirische analyse bevestigt dat getrainde modellen hetzelfde gedrag vertonen, waarbij geleerde parameters deze patronen verder versterken. Opmerkelijk is dat we ontdekten dat de interactie tussen het causale masker en RoPE de relatieve aandachtsscorepatronen van RoPE vervormt tot niet-relatieve patronen. We hebben dit effect consistent waargenomen in moderne grote taalmodellen, wat het belang onderstreept van het beschouwen van het causale masker als een bron van positionele informatie naast expliciete positionele coderingen.
English
While explicit positional encodings such as RoPE are a primary source of
positional information in Transformer decoders, the causal mask also provides
positional information. In this work, we prove that the causal mask can induce
position-dependent patterns in attention scores, even without parameters or
causal dependency in the input. Our theoretical analysis indicates that the
induced attention pattern tends to favor nearby query-key pairs, mirroring the
behavior of common positional encodings. Empirical analysis confirms that
trained models exhibit the same behavior, with learned parameters further
amplifying these patterns. Notably, we found that the interaction of causal
mask and RoPE distorts RoPE's relative attention score patterns into
non-relative ones. We consistently observed this effect in modern large
language models, suggesting the importance of considering the causal mask as a
source of positional information alongside explicit positional encodings.