Element-wise Formula for RoPE Rotation
The Rotary Positional Embedding (RoPE) transformation can be expressed as an element-wise operation on a d-dimensional vector . This formulation calculates the rotated vector, , by summing two vectors derived from Hadamard products (element-wise multiplication). The first vector is the product of the input vector and a cosine vector. The second is the product of a permuted input vector () and a sine vector. The complete formula is: where denotes the Hadamard product.

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
Euclidean Representation of RoPE Rotation
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
Element-wise Formula for RoPE Rotation
In a system that encodes positional information, a 'cosine vector' is defined for each position based on a set of frequency parameters . The formula for this vector is: .
Given a total dimension , a position , and frequency parameters and , what is the correct cosine vector for this position?
A developer is implementing a positional encoding scheme where a 'cosine vector' is needed for each position . Given a set of frequency parameters and a total embedding dimension , which of the following formulas correctly defines this vector?
Properties of Positional Cosine Vectors
Element-wise Formula for RoPE Rotation
Consider a system where positional information is encoded using periodic functions. A key component is a vector constructed for each position. Given a position index
i = 2and a set of frequency parametersθ = [π/2, π/4], what is the resulting 2-dimensional sine vector, defined as[sin(iθ₁), sin(iθ₂)]?Consider a method for encoding positional information where a
d-dimensional input vector is modified using periodic functions. In this method, a 'sine vector' is constructed for each positioni. This sine vector has a dimensionality equal tod.Determining Position Index from a Sine Vector
Learn After
Permuted Input Vector in RoPE
A transformation is applied to a d-dimensional vector at position using a set of frequencies . The transformation is defined by the following element-wise formula: where denotes element-wise multiplication.
Given the input vector , position , and frequencies , , what is the resulting vector ?
Analyzing Components of a Vector Transformation
Consider the element-wise formula for applying a rotational transformation to a d-dimensional vector . The formula involves summing two vectors derived from element-wise products.
True or False: The first vector in the sum is the product of the original input vector and a sine vector, and the second vector is the product of a permuted input vector (e.g., ) and a cosine vector.