Equation 16 · 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 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
Symbol x
x is an argument of the function-like quantity on the left; its role is set by that function’s stated inputs.
Symbol W_1
is one factor in the product that computes the quantity on the left.
Symbol W_3
is one factor in the product that computes the quantity on the left.
Symbol W_2
is one factor in the product that computes the quantity on the left.
Symbol z
z is one factor in the product that computes the quantity on the left.
Symbol σ
σ is one factor in the product that computes the quantity on the left.
=
The expressions on both sides represent the same quantity under the stated assumptions.
See an illustrated explanation →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.
How to interpret it
Read it with the definitions, units, and assumptions supplied by the article.
What the article says around this equation
Shazeer’s paper on gated linear unit variants tested several replacements for the standard ReLU or GELU feed-forward block, in which two linear projections are combined so that one, passed through a nonlinearity, gates the other [ 6 ] . The variant that stuck across the field, and that Llama adopts in every generation, uses the Swish (SiLU) nonlinearity as the gate: . Two independent linear projections of the residual stream are formed; one is passed through the gate and multiplied element-wise ( ) against the other; the product is projected back down. Shazeer’s own results reported the gated variants outperforming the plain ReLU feed-forward block across the…
Read the full surrounding passage
Shazeer’s paper on gated linear unit variants tested several replacements for the standard ReLU or GELU feed-forward block, in which two linear projections are combined so that one, passed through a nonlinearity, gates the other [ 6 ] . The variant that stuck across the field, and that Llama adopts in every generation, uses the Swish (SiLU) nonlinearity as the gate: . Two independent linear projections of the residual stream are formed; one is passed through the gate and multiplied element-wise ( ) against the other; the product is projected back down. Shazeer’s own results reported the gated variants outperforming the plain ReLU feed-forward block across the language modelling and fine-tuning tasks tested, at matched parameter and compute budgets [ 6 ] . Because the gate consumes an extra weight matrix, Llama’s feed-forward hidden dimension is set below the naive 4d multiplier used in the original transformer, to hold total parameters roughly constant against a non-gated block of the same width — an accounting detail visible in the hyperparameter tables of Meta’s own papers rather than a claim requiring independent verification here.
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