RoPE (Rotary Position Embedding) rotates the
2j-th and
2j+1-th dims of Q/K by angle
mθj with
θj=10000−2j/d, so the inner product of any positions
m,
n depends only on their relative distance
m−n; ALiBi instead adds a linear bias
−m⋅∣i−j∣ to attention scores with zero parameters.