Euclidean Representation of RoPE Rotation
The Euclidean space representation of Rotary Positional Embeddings (RoPE) applies a rotational transformation to a d-dimensional vector through matrix multiplication. This transformation is performed by a d-dimensional square rotation matrix, denoted as , which is specific to the token's position . The formula is: Here, the input row vector is multiplied by the block diagonal matrix . This matrix is composed of individual 2x2 rotation matrices, , along its diagonal, each acting on a consecutive pair of components from the vector .
0
1
Tags
Ch.3 Prompting - Foundations of Large Language Models
Foundations of Large Language Models
Foundations of Large Language Models Course
Computing Sciences
Ch.2 Generative Models - Foundations of Large Language Models
Related
Element-wise Formula for RoPE Rotation
A positional encoding method can be described in two ways. In one view, a d-dimensional vector is treated as d/2 complex numbers, and each complex number is rotated by an angle. In another view, the same d-dimensional vector is treated as d/2 pairs of real numbers, and each pair is rotated as a 2D vector by the same corresponding angle. What is the core principle that makes these two views equivalent?
Equivalence of 2D Vector Rotation Representations
Verifying Equivalence of 2D Rotational Methods
In a specific positional encoding method, pairs of embedding dimensions are rotated using a 2x2 matrix defined as: where
tis the token's position and\theta_kis a frequency. Given a token at positiont = 2and a frequency\theta_k = \pi/4, which matrix correctly represents the rotation?In a certain positional encoding method, the rotation of a pair of dimensions is achieved using the matrix , where
tis the position and\thetais a frequency parameter.Applying a Rotational Transformation Matrix
Learn After
Consider a 4-dimensional row vector . This vector undergoes a rotational transformation by being post-multiplied by a 4x4 block-diagonal matrix. This matrix consists of two 2x2 rotation blocks along its diagonal. The first block rotates the first pair of vector components by an angle of , and the second block rotates the second pair of components by an angle of . Given that each 2x2 rotation block for an angle $\a
Consider the transformation of a d-dimensional vector by post-multiplication with a d-dimensional block-diagonal rotation matrix, as used in Rotary Positional Embeddings. This transformation will alter the Euclidean norm (magnitude) of the vector.
Independent Rotational Transformation in RoPE