ViT at vector-[D] LayerNorm #
The committed ViT render (ViTRender.lean, the GPU-trained ViT-Tiny) carries a vector γ, β : [D]
per LN site, spelled scalar-LN(1,0) ∘ per-channel scale γ ∘ + β. The op itself — layerNormVec,
its VJP, its per-token lift and its γ/β parameter gradients (vecLNGradGamma / _beta and the
vit_render_vecln*_certified step forms) — is in Architectures/LayerNorm, which ConvNeXt's
channel-LN shares. This file is ViT's use of it:
- §1
transformerBlockV— the vector-LN block, with its VJP composed through the sublayer recipe (biPathMatHasVJP+vjpMatComp+rowwiseHasVJPMat). UNCONDITIONAL except0 < ε. The depth-knet built from it isViTDepthK's. - §2 the row-broadcast flat bridges (
rowScaleFlat_flat,rowBiasFlat_flat) for the tokens each vector-LN site is spelled with:lnRowF(1,0) →rowScaleF γ→rowBiasF β. - §3 the chain cotangents at vector LN.
References #
- Ba, Kiros, Hinton 2016, Layer Normalization. https://arxiv.org/abs/1607.06450
Attention sublayer with vector-LN: X ↦ X + MHSA(LNᵥ(X)).
Equations
- One or more equations did not get rendered due to their size.
Instances For
MLP sublayer with vector-LN: h ↦ h + MLP(LNᵥ(h)).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Vector-LN transformer block: MLPᵥ-sublayer ∘ attentionᵥ-sublayer —
the ViTRender block form.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Attentionᵥ sublayer VJP.
Equations
- One or more equations did not get rendered due to their size.
Instances For
MLPᵥ sublayer VJP.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Flat Diff of the vector-LN block.
Vector-LN block VJP — one vjpMatComp of the two sublayer witnesses.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Row-broadcast scale commutation bridge.
Row-broadcast bias commutation bridge.
Cot at the attention-sublayer output h, vector-LN form: dyOut + the
decomposed LN₂ input-VJP (rowScaleFlat γ2 then rowLNBackFlat at γ=1).
Equations
- Proofs.vitCotHV gf ε γ2 Wfc1 Wfc2 h m1 dyOut i = dyOut i + Proofs.StableHLO.rowLNBackFlat Np1 D ε 1 h (Proofs.StableHLO.rowScaleFlat Np1 D γ2 (Proofs.vitCotLn2 gf Wfc1 Wfc2 m1 dyOut)) i
Instances For
Cot at the SDPA output, vector-LN form.
Equations
- Proofs.vitCotAttV gf ε γ2 Wo Wfc1 Wfc2 h m1 dyOut = Proofs.StableHLO.rowDenseBackFlat Np1 D D Wo (Proofs.vitCotHV gf ε γ2 Wfc1 Wfc2 h m1 dyOut)
Instances For
Cot at the block input, vector-LN form: cotH + the decomposed LN₁
input-VJP of the three-way Q/K/V fan-in.
Equations
- Proofs.vitCotXinV ε γ1 Wq Wk Wv xin dQ dK dV cotH i = cotH i + Proofs.StableHLO.rowLNBackFlat Np1 D ε 1 xin (Proofs.StableHLO.rowScaleFlat Np1 D γ1 (Proofs.vitCotLn1 Wq Wk Wv dQ dK dV)) i
Instances For
Cot at the last block's output (the final-LN input), vector-LN form: the decomposed final-LN input-VJP of the classifier-back row-0 scatter.
Equations
- One or more equations did not get rendered due to their size.