The relative position of RoPE: why can one move offset

Rotate position encoding rotates the query and key pairing channel at their respective locations.

• Step by stepCollate in 2 self-measured2 First-hand sources
Start Body
Learning objectives and first steps2 objectives . 1 first fix

Try to do it after reading

  • Explains the relative position of RoPE: mechanisms and prerequisites for moving together to offset
  • Positioning the mechanism ' s fault limits with fixed examples

Suggested first

  • 2D rotation and inner volume

Issues and mechanisms

Rotate position encoding rotates the query and key pairing channel at their respective locations. The absolute position determines the location of each phase, leaving a difference in the inner volume, which makes the matching visible dependent on the relative position. Understanding this nature requires looking at both queries and keys, and cannot be explained by the location of a trajectory after a vector rotates as a model.

The two-dimensional rotation matrix is straight and the query at m and the key info at n can be written as the original query and rotate n less m. High-dimensional realization consists of two-dimensional spaces with multiple frequencies; Different frequencies vary in the cycle of distance change. Rotation does not change the length of a single two-dimensional vector, but it changes the direction of the other position vector.

A concrete example

Synthetic query q = [10], key k = [10], 60 degrees per position. The two positions accumulated in one place, 0.5 at the difference, and negative 1 at the difference of three positions. Increase both positions by five, the angle changes but the margin remains unchanged, and the internal build-up remains the same. The negative matching score here can still be normalized to produce a legitimate non-fouling weight and cannot be interpreted as a negative probability.

Borders and checks

Different channel pairings, angle base and length scaling change to achieve, and the configuration must be matched when the model is loaded. Long distances from training also encounter problems of phase distribution, accuracy and data disaggregation. Some scaling allows the code to accept longer sequences, only to demonstrate that the location calculation is running and not to prove long-text retrieval or the accuracy of reasoning.

A method of verification

This should be achieved by using a query and key-recording constant equation that is not a axis vector of coordinates, avoiding a particularly symmetrical sample that conceals the transfer or symbol error. Channel pairing is also checked: adjacent pairings with the back and back half-zones can be stored in different forms and cannot be exchanged simply because of the same length of output. A comparison of a small sample of high accuracy with actual accuracy helps to distinguish formula errors from a long-position perspective to calculate errors rather than attribute all differences to model capacity.

Check understanding

RoPE guarantees that the individual vector parameters will not change, and that the Attention weights will not change?

No guarantee. The weight depends on the relative direction of the different locations, and rotation changes these internal balances; Combining offsets under compatible rotation rules is more specific in nature.

Does that mean you can't read the position?

No, it's not. Negative one is the non-alignment of points, which may still be positive weights; Zero weight should be given only if mask is explicitly prohibited.

Sources and reconciliations

Definitions, methods and interfaces are available.

  1. RoFormer — Enhanced Transformer with Rotary Position Embedding
  2. Attention Is All You Need

Figures and calculations are reorganized according to this chapter. Mathematical measurements, framework operations and real business effects are described separately in the body of the text.

← Back to the knowledge directory
Ask Max Ask about this site
Ask Max ↗

Opening the assistant…

Paper figure

Photo comments

LEAVE A NOTE

About this photograph

Connecting to the discussion board…

    Comments become public after moderation. You can delete your own comments from this browser.
    No email is required. Clearing cookies prevents this browser from claiming earlier comments.

    MAX WANG / INDEX

    Find something

    Enter a keyword, or explore the directory below.