← Back to article

Equation 11 · How Llama's Architecture Actually Works, Generation by Generation

What does this equation mean?

⟨RΘ,m q,  RΘ,n k⟩  =  ⟨RΘ, m−n q,  k⟩.\langle R_{\Theta,m}\,q,\; R_{\Theta,n}\,k\rangle \;=\; \langle R_{\Theta,\,m-n}\,q,\; k\rangle.

Read the formula alongside the article passage below. Each part has a deeper page with its role in the equation, the supporting passage and nearby citations.

Inputs and operationslangle R_Theta,m-nq, krangle
Result or conditionlangle R_Theta,mq, R_Theta,nkrangle
How to read the two sides of this formula. Follow the article passage for the meaning of each quantity.

This equation states an equality: the expressions on both sides have the same value under the article’s assumptions. Read the equation part by part below; each part has a contextual explanation and a link to its mathematical background.

Read it piece by piece

RΘ,mR_{\Theta,m}

Symbol R_Theta,m

RTR_Theta,m is part of the quantity the equation computes from the expression on the right.

Understand this part →

qq

Symbol q

q is part of the quantity the equation computes from the expression on the right.

Understand this part →

RΘ,nR_{\Theta,n}

Symbol R_Theta,n

RTR_Theta,n is part of the quantity the equation computes from the expression on the right.

Understand this part →

kk

Symbol k

k is part of the quantity the equation computes from the expression on the right.

Understand this part →

RΘ, m−nR_{\Theta,\,m-n}

Symbol R_Theta,m-n

RTR_Theta,m-n is one of the signed contributions combined to compute the quantity on the left.

Understand this part →

=

=

The expressions on both sides represent the same quantity under the stated assumptions.

Understand this part →

See an illustrated explanation →
subtraction

subtraction

Subtract the following term or group from the preceding one. A leading minus marks a negative quantity.

Understand this part →

subscript

subscript

The lower label selects a particular version, component, or indexed member of the quantity. For example, x₀ and xₜ can be values at different positions.

Understand this part →

How to interpret it

Read it with the definitions, units, and assumptions supplied by the article.

What the article says around this equation

The property that makes this useful rather than merely elegant is that rotating a query at position m and a key at position n by these matrices before taking their dot product leaves a result that depends only on the distance between them: ⟨RΘ,m q,  RΘ,n k⟩  =  ⟨RΘ, m−n q,  k⟩\langle R_{\Theta,m}\,q,\; R_{\Theta,n}\,k\rangle \;=\; \langle R_{\Theta,\,m-n}\,q,\; k\rangle. Relative position falls out of the mechanism instead of being engineered into it separately, and — as the RoFormer paper’s own experiments emphasise — the same rotation formula applies at any sequence length the rotation frequencies were designed for, which is what makes RoPE the natural place to intervene when a later generation wants a longer context window [ 5 ] .

Read the equation in its article →

Sources cited in the surrounding passage

These citations give research context. Read each source to check which claims it supports.

Return to How Llama's Architecture Actually Works, Generation by Generation

See this formula across 1 published context →

Browse the mathematical compendium →