Evaluating the LayerNorm graph #
Closed forms for every saved intermediate of layerNormGraph. Each val* definition is the value
the corresponding node computes from the packed input [X, gamma, beta], and each get_* lemma
identifies the block of Graph.evalVec at that stage with its closed form.
Two consequences drive the calculus: the per-row variance block is a mean of squares, so it is
nonnegative, and therefore var + ε is positive and the clamped square root is nonzero as soon as
0 < ε. Those two facts are exactly the domain hypotheses of the LayerNorm graph theorem.
Closed forms of the intermediates #
Stage evaluations #
Stage g3: the centered block.
Stage g4: the squared centered block.
Stage layerNormPrefix6: the shifted variance block.
Stage layerNormPrefix7: the standard deviation block.
Stage g9: the broadcast inverse standard deviation block.
The centered block is still available at stage g9.
Stage g11: the broadcast scale block.
Stage g13: the broadcast shift block.
The scaled block is still available at stage g13.
The output block of the full LayerNorm graph.
Positivity of the denominators #
Coordinates of the row-sum map.
Coordinates of the row-mean map.