The ViT encoder-block backward tie at the VECTOR LayerNorm the net runs #
The shipped depth-12 net is vitForwardKV, whose blocks are transformerBlockV at
γ β : Vec D, the form ViTRender.lean emits. This file states the block backward tie there,
so the whole-net fold in ViTWholeBackCertifiedTie.lean is about the blocks the artifact
contains. It is the same move as ConvNeXtBackCertifiedTie.lean makes for ConvNeXt-T.
No new analysis: ConvNeXt's LayerNorm backward is ViT's. rowLNVecFlatBack
(ChannelLNBack.lean) is perRowFlatPR of bnGradInput c ε 1 (X r) ∘ diagBack γ — the γ scale in
front of the unit-γ input gradient at each row's own saved activation — and its own header says it
is "literally ViT's per-token LN with 'token' read as 'spatial position'".
rowLNVecFlatHasVJP_backward_eq already pins it to layerNormVecPerTokenHasVJPMat. So the
vector-LN seam (rowLNVecFlatBack_eq_vecLN_vjp) is that lemma read at a flat saved input, and
everything else in the block — mhsaBackFlat, the dense Wᵀ 0 input-VJPs, the diagBack GELU
derivative, the perRowFlatPR residual seams — is LayerNorm-agnostic and is reused from
ViTMhsaBackCertifiedTie.lean verbatim.
Both sublayer decompositions and the block unfold are rfl at the vector LN:
transformerBlockVHasVJPMat is a vjpMatComp / biPathMatHasVJP assembly, so the
projections reduce.
The vector-LN backward at a flat saved input IS the certified per-token vector-LN VJP,
flattened. rowLNVecFlatHasVJP_backward_eq (ConvNeXt's) read through
HasVJPMat.toHasVJP's projection. The only LayerNorm-specific step in this file.
The attention-sublayer backward float-half IS the certified sublayer VJP, flat.
residual (rowLNVecFlatBack ∘ mhsaBackFlat) with Q/K/V
pinned at LNᵥ₁(A) and the LN backward at the block's own saved input. The sdpa leaf is
mhsaBackFlat_eq_mhsa_vjp, which never mentions a LayerNorm.
The MLP-sublayer backward float-half IS the certified sublayer VJP, flat. The residual
is lifted out of the per-token fold. The per-token
body tie (transformerMlp_back_flat_eq_perRowFlatPR) is LayerNorm-agnostic and reused
verbatim; only the LN₂-back seam changes.
The vector-LN ViT block backward tie. vitBlockBackV, with every saved activation pinned
to the real forward (Q/K/V at LNᵥ₁ A; the LN₁ backward at the block's own input A and the
LN₂ backward at the attention sublayer's output; the GELU derivative at
dense₁(LNᵥ₂(attn A))), IS the certified transformerBlockV input-gradient VJP, flattened.
Assembled from the block unfold and the two sublayer flat ties; no new analysis, and general in the head count.
The block tie in the form the tower recursion needs — vitBlockBackVAt at a FLAT saved
input v is the flat block's VJP backward at v, i.e. exactly the HasVJP that
vitBodyKVFlatHasVJP's chain step consumes. Mat.flatten_unflatten is the only step.