ResNet-50 — every parameter gradient node IS the loss's derivative in that parameter #
r50_net_tiedB says each of the 161 parameter gradient nodes denotes its layer's parameter
Jacobian contracted with the cotangent the emitted backward chain threads to it, from a loss
cotangent g it takes as a binder; the r50*CotIn_eq_vjp lemmas say the block-input cotangents
are certified VJP backwards. r50_net_lossGrad composes them: for any loss L of the logits whose
gradient at the net's output is g, every node is ∂L/∂θ of the WHOLE net with that one parameter
varied. The two losses the artifacts ship discharge hL:
r50_net_lossGrad_smoothedCE— thebce := falseartifacts:L = smoothedBatchLoss,gthe six-op label-smoothed chain (smoothedBatchLoss_grad).r50_net_lossGrad_bce— thebce := trueartifacts,resnet50in160_lambaccdp8x64wxclipbceamong them:L = bceBatchLoss, the mean overB×K,gthe three-op chain (bceBatchLoss_grad).
Scope. One replica, at either precision: every conv weight node is stated on the renderers'
switch (convWeightGradBAt bf16 id …, Foundation.GradNodesBAt), so bf16 := true is the bf16
kind resnet50in_momdp64bf16 and resnet50in160_lambaccdp4x128wxclipbcebf16, the book's ImageNet
runs, emit, read over ℝ at the identity rounding (Bf16Erasure), and bf16 := false the f32
artifacts'. The drop-path forwards (*drop*) are outside this statement. Sync-BN data
parallelism is reached by composition: r50_net_syncTiedB says each all-reduced gradient is this
net's tied node at N := R·N, which this file's capstone makes the loss's gradient at the global
batch.
How. ResNet34ParamGrad's three layers, with R34's stem and head bundles reused verbatim (the
stem and head ARE R34's functions at R50's widths):
- Per block kind (at variable widths): the loss read at an identity / stride-1 projection /
strided projection bottleneck's output, pulled back one certified stage at a time by
ParamGradNodes' pull-backs, so each internal activation's gradient is the chain's own cotangent. The bundlesr50IdLossTiedB/r50ProjLossTiedB/r50DownLossTiedBstate the block's nodes againstΦ, the loss as a function of the block's weight record — the same slots asr50IdTiedB/r50ProjTiedB/r50DownTiedB, no conv bias (ResNet50RenderBemits none). - Per net: the loss read after each block (
r50Suf*), its gradient pulled back through the sixteen certified bottleneck VJPs, andΦidentified with the whole net at updated weights (r50_factor_*), each a standalone theorem.
Hypotheses. R50PosB (every BN ε > 0), R50LossSmoothAtB (every relu off its kink and every
stem-pool window dead, or its maximum at one position up to cells reading identical input
patches, at the real activations); for the smoothed loss also every example's target summing to one and 0 < nCls.
The BCE corollary takes no hypothesis on the target.
The stem pool's clause is stated for the parameters, not the image. Real batches have stem-pool
windows whose positive maximum sits at two positions, because two cells read identical input
patches (flat image regions). There the net has no derivative in the image, so the input VJP's
R50SmoothAtB rejects them, but the tied cells are the same function of the stem's weights, so the
loss IS differentiable in the parameters. R50LossSmoothAtB allows exactly those ties
(StemPoolTwinAt at StemConvTwin), and the stem's parameter nodes are proved through the argmax
gather they reduce to (r34StemPool_param_germ). At a tied window the render's pool backward
(select_and_scatter with a GE select) sends the cotangent to the window's first maximal cell, and
so does the denotation maxPool3s2BackB (its reindex reads windowArgmax, the first maximum).
Every pool selector (IsMaxPool3s2SelectB) gives the same four stem gradients
(r34Stem_select_grads_eq): r50_net_lossGrad_stemSelect states the stem's nodes at any of them.
The probe script scripts/probes/stem_pool_smooth_probe.py checks the stem's clauses on real
batches.
Identity bottleneck, 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 nine nodes r50IdTiedB 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
Stride-1 projection bottleneck, every parameter node a loss derivative — the twelve nodes
r50ProjTiedB ties.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Strided projection bottleneck, every parameter node a loss derivative — the twelve nodes
r50DownTiedB ties: W₁ an ordinary conv node at 2h × 2w, W₂ and Wp strided.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pull the loss gradient back through an identity bottleneck: the certified block VJP, read at
the chain's own fan-in (r50IdCotIn_eq_vjp).
…through the stride-1 projection bottleneck (r50ProjCotIn_eq_vjp).
…and through the strided projection bottleneck (r50DownCotIn_eq_vjp).
The net after block s4b2 — the head.
Equations
- Proofs.ResNet50TieB.r50SufS4b2 N q w = Proofs.r34HeadB N q q w.Wd w.bd
Instances For
The net after block s4b1: block s4b2, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS4b1 N q w y = Proofs.ResNet50TieB.r50SufS4b2 N q w (Proofs.r50IdB N q q w.s4b2 y)
Instances For
The net after block s4b0: block s4b1, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS4b0 N q w y = Proofs.ResNet50TieB.r50SufS4b1 N q w (Proofs.r50IdB N q q w.s4b1 y)
Instances For
The net after block s3b5: block s4b0, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS3b5 N q w y = Proofs.ResNet50TieB.r50SufS4b0 N q w (Proofs.r50DownB N q q w.s4b0 y)
Instances For
The net after block s3b4: block s3b5, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS3b4 N q w y = Proofs.ResNet50TieB.r50SufS3b5 N q w (Proofs.r50IdB N (2 * q) (2 * q) w.s3b5 y)
Instances For
The net after block s3b3: block s3b4, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS3b3 N q w y = Proofs.ResNet50TieB.r50SufS3b4 N q w (Proofs.r50IdB N (2 * q) (2 * q) w.s3b4 y)
Instances For
The net after block s3b2: block s3b3, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS3b2 N q w y = Proofs.ResNet50TieB.r50SufS3b3 N q w (Proofs.r50IdB N (2 * q) (2 * q) w.s3b3 y)
Instances For
The net after block s3b1: block s3b2, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS3b1 N q w y = Proofs.ResNet50TieB.r50SufS3b2 N q w (Proofs.r50IdB N (2 * q) (2 * q) w.s3b2 y)
Instances For
The net after block s3b0: block s3b1, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS3b0 N q w y = Proofs.ResNet50TieB.r50SufS3b1 N q w (Proofs.r50IdB N (2 * q) (2 * q) w.s3b1 y)
Instances For
The net after block s2b3: block s3b0, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS2b3 N q w y = Proofs.ResNet50TieB.r50SufS3b0 N q w (Proofs.r50DownB N (2 * q) (2 * q) w.s3b0 y)
Instances For
The net after block s2b2: block s2b3, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS2b2 N q w y = Proofs.ResNet50TieB.r50SufS2b3 N q w (Proofs.r50IdB N (2 * (2 * q)) (2 * (2 * q)) w.s2b3 y)
Instances For
The net after block s2b1: block s2b2, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS2b1 N q w y = Proofs.ResNet50TieB.r50SufS2b2 N q w (Proofs.r50IdB N (2 * (2 * q)) (2 * (2 * q)) w.s2b2 y)
Instances For
The net after block s2b0: block s2b1, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS2b0 N q w y = Proofs.ResNet50TieB.r50SufS2b1 N q w (Proofs.r50IdB N (2 * (2 * q)) (2 * (2 * q)) w.s2b1 y)
Instances For
The net after block s1b2: block s2b0, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS1b2 N q w y = Proofs.ResNet50TieB.r50SufS2b0 N q w (Proofs.r50DownB N (2 * (2 * q)) (2 * (2 * q)) w.s2b0 y)
Instances For
The net after block s1b1: block s1b2, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS1b1 N q w y = Proofs.ResNet50TieB.r50SufS1b2 N q w (Proofs.r50IdB N (2 * (2 * (2 * q))) (2 * (2 * (2 * q))) w.s1b2 y)
Instances For
The net after block s1b0: block s1b1, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufS1b0 N q w y = Proofs.ResNet50TieB.r50SufS1b1 N q w (Proofs.r50IdB N (2 * (2 * (2 * q))) (2 * (2 * (2 * q))) w.s1b1 y)
Instances For
The net after the stem: block s1b0, then the rest.
Equations
- Proofs.ResNet50TieB.r50SufStem N q w y = Proofs.ResNet50TieB.r50SufS1b0 N q w (Proofs.r50ProjB N (2 * (2 * (2 * q))) (2 * (2 * (2 * q))) w.s1b0 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 s1b0's weights varied is the suffix after s1b0 at the varied block.
The net with block s1b1's weights varied is the suffix after s1b1 at the varied block.
The net with block s1b2's weights varied is the suffix after s1b2 at the varied block.
The net with block s2b0's weights varied is the suffix after s2b0 at the varied block.
The net with block s2b1's weights varied is the suffix after s2b1 at the varied block.
The net with block s2b2's weights varied is the suffix after s2b2 at the varied block.
The net with block s2b3's weights varied is the suffix after s2b3 at the varied block.
The net with block s3b0's weights varied is the suffix after s3b0 at the varied block.
The net with block s3b1's weights varied is the suffix after s3b1 at the varied block.
The net with block s3b2's weights varied is the suffix after s3b2 at the varied block.
The net with block s3b3's weights varied is the suffix after s3b3 at the varied block.
The net with block s3b4's weights varied is the suffix after s3b4 at the varied block.
The net with block s3b5's weights varied is the suffix after s3b5 at the varied block.
The net with block s4b0's weights varied is the suffix after s4b0 at the varied block.
The net with block s4b1's weights varied is the suffix after s4b1 at the varied block.
The net with block s4b2's weights varied is the suffix after s4b2 at the varied block.
The net with the classifier varied is the head at the varied classifier.
Every ResNet-50 parameter gradient node is the derivative of L in that parameter, for a
loss L of the logits and g the cotangent the chain starts from: the 161 nodes
r50_net_tiedB ties, each at the cotangent the emitted chain threads to it, stated against L
of resnet50ForwardBFull with that one parameter varied. r50_net_lossGrad proves it whenever
g is L's gradient at the logits; the two losses the artifacts ship instantiate it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The smooth-point bundle a loss gradient needs — R50SmoothAtB with the stem pool's clause
weakened to allow ties between cells that read identical input patches, as
ResNet34TieB.R34LossSmoothAtB does for ResNet-34 (whose stem this is).
- s3b0 : R50DownSmoothAt N (2 * q) (2 * q) w.s3b0 (r50Pre7 N q w x)
- s3b1 : R50IdSmoothAt N (2 * q) (2 * q) w.s3b1 (r50Pre8 N q w x)
- s3b2 : R50IdSmoothAt N (2 * q) (2 * q) w.s3b2 (r50Pre9 N q w x)
- s3b3 : R50IdSmoothAt N (2 * q) (2 * q) w.s3b3 (r50Pre10 N q w x)
- s3b4 : R50IdSmoothAt N (2 * q) (2 * q) w.s3b4 (r50Pre11 N q w x)
- s3b5 : R50IdSmoothAt N (2 * q) (2 * q) w.s3b5 (r50Pre12 N q w x)
- s4b0 : R50DownSmoothAt N q q w.s4b0 (r50Pre13 N q w x)
- s4b1 : R50IdSmoothAt N q q w.s4b1 (r50Pre14 N q w x)
- s4b2 : R50IdSmoothAt N q q w.s4b2 (r50Pre15 N q w x)
Instances For
The input-VJP bundle implies the loss-gradient one.
Every ResNet-50 parameter gradient node is the derivative of the loss in that parameter.
For any loss L of the logits with gradient g at the net's output, each of the 161 nodes
r50_net_tiedB ties — at the same cotangent — is ∂L/∂θ of the WHOLE net, resnet50ForwardBFull
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 (R50PosB), every relu off its kink and every stem-pool
window dead or tied only between cells reading identical input patches, at the real
activations (R50LossSmoothAtB). The loss enters only through hL;
r50_net_lossGrad_smoothedCE and r50_net_lossGrad_bce discharge it for the two losses the
artifacts ship.
The nodes are the f32 ones on one replica (the module's Scope).
The stem's gradient nodes at the render's own pool routing — r50_net_lossGrad's stem
bundle read at the cotangents routed along ANY pool selector σ at the stem's post-ReLU
activation, the emitted select_and_scatter among them (r34StemLossTiedB.select; the R50
stem is R34's, see ResNet34TieB.r34_net_lossGrad_stemSelect).
The bce := false artifacts: every node is the derivative of the batched label-smoothed
cross-entropy smoothedBatchLoss, g the six-op cotangent the render emits.
The bce := true artifacts (resnet50in160_lambaccdp8x64wxclipbce among them): every node is
the derivative of the batched BCE-with-logits bceBatchLoss, the mean over B×K, g the
three-op cotangent at the committed divisor N·K. No hypothesis on the target.
The emitted ResNet-50 step's gradient nodes ARE the loss's gradient, at one chain. For each
of the 161 parameter slots, at ONE cotangent chain (the tie's own, from g): the node denotes
its layer's Jacobian against the chain cotangent (r50_net_tiedB), and any loss L of the
logits with gradient g at the network's output of resnet50ForwardBFull with that one slot
varied is differentiable there with the node as its gradient (r50_net_lossGrad). The two
theorems each state the chain; this one states it once, so an edit to either chain breaks its
proof.