Official Implementation of the paper ComRoPE: Scalable and Robust Rotary Position Embedding Parameterized by Trainable Commuting Angle Matrices.
Overview of our method is shown as follows. Features are arranged into several blocks, each representing a distinct point in the feature space. The positions, along with the angle matrices, define the rotation matrix, which is an element of the special orthogonal group. The rotation transformation projects a feature point onto another point on the surface of the same hypersphere.
Formally, we define the angle matrices as follows:
where the elements in $\mathcal B_j = \lbrace \mathbf B_{1j}, \mathbf B_{2j}, \cdots,\mathbf B_{Nj}\rbrace $ are all skew-symmetric and pairwise commute with each other, i.e.,
We propose two solutions: ComRoPE-AP and ComRoPE-LD.
ComRoPE-AP defines the angle matrices as follows, where
ComRoPE-LD defines the angle matrices as follows, where a base matrix




