Equation 15 · How Llama's Architecture Actually Works, Generation by Generation
What does this equation mean?
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.
This equation states a bound: one expression must stay on the indicated side of the other 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
Symbol G
G is part of the quantity the equation computes from the expression on the right.
Symbol H
H is part of the quantity the equation computes from the expression on the right.
=
The expressions on both sides represent the same quantity under the stated assumptions.
See an illustrated explanation →subtraction
Subtract the following term or group from the preceding one. A leading minus marks a negative quantity.
How to interpret it
Read it with the definitions, units, and assumptions supplied by the article.
What the article says around this equation
Multi-head attention gives every query head its own key and value projections. That is expensive at inference time for an autoregressive model, because every generated token requires reading the cached keys and values for every previous token, once per head, from memory — and memory bandwidth, not arithmetic, is usually the bottleneck in decoding. Multi-query attention collapses all query heads onto a single shared key-value pair, cutting that cache to a fraction of its multi-head size at some cost in quality. Ainslie and colleagues proposed the middle path that all three Llama generations actually use: grouped-query attention, in which H query heads are partitioned into G groups, and every…
Read the full surrounding passage
Multi-head attention gives every query head its own key and value projections. That is expensive at inference time for an autoregressive model, because every generated token requires reading the cached keys and values for every previous token, once per head, from memory — and memory bandwidth, not arithmetic, is usually the bottleneck in decoding. Multi-query attention collapses all query heads onto a single shared key-value pair, cutting that cache to a fraction of its multi-head size at some cost in quality. Ainslie and colleagues proposed the middle path that all three Llama generations actually use: grouped-query attention, in which H query heads are partitioned into G groups, and every query head within a group shares one key-value head pair [ 8 ] . The two earlier schemes are the boundary cases of the same construction: . Ainslie and colleagues’ own contribution was as much practical as architectural: they showed an existing multi-head checkpoint can be converted into a grouped-query one by mean-pooling its key and value heads and continuing training with roughly five percent of the original pretraining compute, rather than requiring the smaller attention footprint to be trained in from scratch [ 8 ] .
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