ResNet-34 — every parameter gradient node IS the loss's derivative in that parameter #
r34_net_tiedB says each of the 146 parameter gradient nodes denotes its layer's parameter
Jacobian contracted with the cotangent the emitted backward chain threads to it; the
*CotIn_eq_vjp lemmas say the block-input cotangents are certified VJP backwards; and
r34_lossCot_is_smoothedCE_grad identifies the loss cotangent row by row. r34_net_lossGrad
composes them: at the same cotangents, every node is ∂L/∂θ of the WHOLE net with that one
parameter varied, L the batched label-smoothed cross-entropy (smoothedBatchLoss) the trainer
minimises.
How. Three layers, each generic where it can be:
- Per node kind (
ParamGradNodes): a node is∂G/∂θwhenever its cotangent is the gradient ofG— the loss read at that op's output — there (HasGradAt). - Per block kind (this file, at variable widths): the loss read at each internal activation of
an identity / downsample block, the stem and the head (
r34IdG*,r34DownG*,r34StemG*), with its gradient the chain's own cotangent (r34IdGC1_hasGradAt, …), pulled back one certified stage at a time (HasGradAt.comp). The bundlesr34IdLossTiedB/r34DownLossTiedB/r34StemLossTiedB/r34HeadLossTiedBstate all of a block's nodes againstΦ, the loss as a function of that block's weight record. - Per net: the loss read after each block (
r34Suf*), its gradient pulled back through the sixteen certified block VJPs (r34IdB_hasGradAt_comp,r34DownB_hasGradAt_comp), andΦidentified with the whole net at updated weights (r34_factor_*) — each a standalonerfl; inside the capstone the same identity is a kernel deep recursion at the literal widths.
Hypotheses. R34PosB (every BN ε > 0), R34SmoothAtB (every relu off its kink and the stem
pool tie-free at the real activations), every example's target summing to one, 0 < nCls.
The loss at bn₂'s output (the skip v held fixed).
Equations
- Proofs.ResNet34TieB.r34IdGN2 N h w Gn v u = Proofs.ResNet34TieB.r34IdGA N h w Gn fun (i : Fin (N * (c * h * w))) => u i + v i
Instances For
The loss at conv₂'s output.
Equations
- Proofs.ResNet34TieB.r34IdGC2 N h w Gn p v z = Proofs.ResNet34TieB.r34IdGN2 N h w Gn v (Proofs.StableHLO.bnBatchLA N c h w p.ε₂ p.γ₂ p.β₂ z)
Instances For
The loss at bn₁'s output.
Equations
- Proofs.ResNet34TieB.r34IdGN1 N h w Gn p v u = Proofs.ResNet34TieB.r34IdGC2 N h w Gn p v (Proofs.StableHLO.batchMap N (Proofs.flatConv p.W₂ p.b₂) (Proofs.relu (N * (c * h * w)) u))
Instances For
The loss at conv₁'s output.
Equations
- Proofs.ResNet34TieB.r34IdGC1 N h w Gn p v z = Proofs.ResNet34TieB.r34IdGN1 N h w Gn p v (Proofs.StableHLO.bnBatchLA N c h w p.ε₁ p.γ₁ p.β₁ z)
Instances For
Identity block, every parameter node a loss derivative. With Gn the loss read at the
block's output and Φ the loss as a function of the block's weight record (hΦ), each of the
eight nodes r34IdTiedB ties — at the same cotangents — is ∂Φ/∂slot with that one slot
varied.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The projection branch's output, bnₚ(convₚ v).
Equations
- Proofs.ResNet34TieB.r34DownProjOut N h w p v = Proofs.StableHLO.projStridedB N p.Wp p.bp p.εp p.γp p.βp v
Instances For
The body branch's output, bn₂(conv₂(relu(bn₁(conv₁ v)))).
Equations
- Proofs.ResNet34TieB.r34DownBodyOut N h w p v = Proofs.projB N p.W₂ p.b₂ p.ε₂ p.γ₂ p.β₂ (Proofs.StableHLO.cbReluStridedB N p.W₁ p.b₁ p.ε₁ p.γ₁ p.β₁ v)
Instances For
The loss at bn₂'s output (projection branch fixed, on the left).
Equations
- Proofs.ResNet34TieB.r34DownGN2 N h w Gn p v u = Proofs.ResNet34TieB.r34DownGA N h w Gn fun (i : Fin (N * (oc * h * w))) => Proofs.ResNet34TieB.r34DownProjOut N h w p v i + u i
Instances For
Equations
- Proofs.ResNet34TieB.r34DownGC2 N h w Gn p v z = Proofs.ResNet34TieB.r34DownGN2 N h w Gn p v (Proofs.StableHLO.bnBatchLA N oc h w p.ε₂ p.γ₂ p.β₂ z)
Instances For
Equations
- Proofs.ResNet34TieB.r34DownGN1 N h w Gn p v u = Proofs.ResNet34TieB.r34DownGC2 N h w Gn p v (Proofs.StableHLO.batchMap N (Proofs.flatConv p.W₂ p.b₂) (Proofs.relu (N * (oc * h * w)) u))
Instances For
Equations
- Proofs.ResNet34TieB.r34DownGC1 N h w Gn p v z = Proofs.ResNet34TieB.r34DownGN1 N h w Gn p v (Proofs.StableHLO.bnBatchLA N oc h w p.ε₁ p.γ₁ p.β₁ z)
Instances For
The loss at bnₚ's output (body branch fixed, on the right).
Equations
- Proofs.ResNet34TieB.r34DownGNp N h w Gn p v u = Proofs.ResNet34TieB.r34DownGA N h w Gn fun (i : Fin (N * (oc * h * w))) => u i + Proofs.ResNet34TieB.r34DownBodyOut N h w p v i
Instances For
Equations
- Proofs.ResNet34TieB.r34DownGCp N h w Gn p v z = Proofs.ResNet34TieB.r34DownGNp N h w Gn p v (Proofs.StableHLO.bnBatchLA N oc h w p.εp p.γp p.βp z)
Instances For
Downsample block, every parameter node a loss derivative — the twelve nodes
r34DownTiedB ties.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The loss at the stem relu's output (the pool's input).
Equations
- Proofs.ResNet34TieB.r34StemGP N h w Gn u = Gn (Proofs.StableHLO.batchMap N (Proofs.maxPool3s2Flat oc h w) u)
Instances For
The loss at the stem BN's output.
Equations
- Proofs.ResNet34TieB.r34StemGN N h w Gn u = Proofs.ResNet34TieB.r34StemGP N h w Gn (Proofs.relu (N * (oc * (2 * h) * (2 * w))) u)
Instances For
The loss at the stem conv's output.
Equations
- Proofs.ResNet34TieB.r34StemGC N h w Gn εs γs βs z = Proofs.ResNet34TieB.r34StemGN N h w Gn (Proofs.StableHLO.bnBatchLA N oc (2 * h) (2 * w) εs γs βs z)
Instances For
Stem, every parameter node a loss derivative — the four nodes r34StemTiedB ties, Φ the
loss as a function of the stem's (W, b, γ, β).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, both parameter nodes loss derivatives — the classifier weight and bias nodes
r34HeadTiedB ties, Φ the loss as a function of (Wd, bd).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The net after block e1 — the head.
Equations
- Proofs.ResNet34TieB.r34SufE1 N w = Proofs.r34HeadB N 7 7 w.Wd w.bd
Instances For
The net after block e0: block e1, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufE0 N w y = Proofs.ResNet34TieB.r34SufE1 N w (Proofs.r34IdB N 7 7 w.e1 y)
Instances For
The net after block d4: block e0, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufD4 N w y = Proofs.ResNet34TieB.r34SufE0 N w (Proofs.r34IdB N 7 7 w.e0 y)
Instances For
The net after block c4: block d4, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufC4 N w y = Proofs.ResNet34TieB.r34SufD4 N w (Proofs.r34DownB N 7 7 w.d4 y)
Instances For
The net after block c3: block c4, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufC3 N w y = Proofs.ResNet34TieB.r34SufC4 N w (Proofs.r34IdB N 14 14 w.c4 y)
Instances For
The net after block c2: block c3, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufC2 N w y = Proofs.ResNet34TieB.r34SufC3 N w (Proofs.r34IdB N 14 14 w.c3 y)
Instances For
The net after block c1: block c2, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufC1 N w y = Proofs.ResNet34TieB.r34SufC2 N w (Proofs.r34IdB N 14 14 w.c2 y)
Instances For
The net after block c0: block c1, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufC0 N w y = Proofs.ResNet34TieB.r34SufC1 N w (Proofs.r34IdB N 14 14 w.c1 y)
Instances For
The net after block d3: block c0, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufD3 N w y = Proofs.ResNet34TieB.r34SufC0 N w (Proofs.r34IdB N 14 14 w.c0 y)
Instances For
The net after block b2: block d3, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufB2 N w y = Proofs.ResNet34TieB.r34SufD3 N w (Proofs.r34DownB N 14 14 w.d3 y)
Instances For
The net after block b1: block b2, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufB1 N w y = Proofs.ResNet34TieB.r34SufB2 N w (Proofs.r34IdB N 28 28 w.b2 y)
Instances For
The net after block b0: block b1, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufB0 N w y = Proofs.ResNet34TieB.r34SufB1 N w (Proofs.r34IdB N 28 28 w.b1 y)
Instances For
The net after block d2: block b0, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufD2 N w y = Proofs.ResNet34TieB.r34SufB0 N w (Proofs.r34IdB N 28 28 w.b0 y)
Instances For
The net after block a2: block d2, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufA2 N w y = Proofs.ResNet34TieB.r34SufD2 N w (Proofs.r34DownB N 28 28 w.d2 y)
Instances For
The net after block a1: block a2, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufA1 N w y = Proofs.ResNet34TieB.r34SufA2 N w (Proofs.r34IdB N 56 56 w.a2 y)
Instances For
The net after block a0: block a1, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufA0 N w y = Proofs.ResNet34TieB.r34SufA1 N w (Proofs.r34IdB N 56 56 w.a1 y)
Instances For
The net after the stem: block a0, then the rest.
Equations
- Proofs.ResNet34TieB.r34SufStem N w y = Proofs.ResNet34TieB.r34SufA0 N w (Proofs.r34IdB N 56 56 w.a0 y)
Instances For
The net with the stem's parameters varied is the suffix after the stem at the varied stem.
The net with block a0's weights varied is the suffix after a0 at the varied block.
The net with block a1's weights varied is the suffix after a1 at the varied block.
The net with block a2's weights varied is the suffix after a2 at the varied block.
The net with block d2's weights varied is the suffix after d2 at the varied block.
The net with block b0's weights varied is the suffix after b0 at the varied block.
The net with block b1's weights varied is the suffix after b1 at the varied block.
The net with block b2's weights varied is the suffix after b2 at the varied block.
The net with block d3's weights varied is the suffix after d3 at the varied block.
The net with block c0's weights varied is the suffix after c0 at the varied block.
The net with block c1's weights varied is the suffix after c1 at the varied block.
The net with block c2's weights varied is the suffix after c2 at the varied block.
The net with block c3's weights varied is the suffix after c3 at the varied block.
The net with block c4's weights varied is the suffix after c4 at the varied block.
The net with block d4's weights varied is the suffix after d4 at the varied block.
The net with block e0's weights varied is the suffix after e0 at the varied block.
The net with block e1's weights varied is the suffix after e1 at the varied block.
The net with the classifier varied is the head at the varied classifier.
Pull the loss gradient back through an identity block: the certified block VJP, read at the
chain's own fan-in (r34IdCotIn_eq_vjp).
…and through a downsample block (r34DownCotIn_eq_vjp).
Every ResNet-34 parameter gradient node is the derivative of the batched smoothed loss in
that parameter. r34_net_tiedB threads the label-smoothed cotangent g down the emitted
backward chain and ties each of the 146 parameter nodes to its layer's Jacobian at the
cotangent reaching it. Here each node, at that same cotangent, is ∂L/∂θ of the WHOLE net —
L the batched label-smoothed cross-entropy smoothedBatchLoss of resnet34ForwardBFull
with that one parameter varied (a stem field, a block's weight record w.blk := p with one
slot changed, or the classifier).
Hypotheses: every BN ε positive (R34PosB), every relu off its kink and the stem pool
tie-free at the real activations (R34SmoothAtB), every example's target summing to one, and
at least one class.