EfficientNet-B0's data-parallel step at SYNCHRONISED BatchNorm IS the single-device step at R·N #
EfficientNetStepTieG.lean (T3) threads the label-smoothed loss cotangent down the batch-BN
backward chain on ONE device and ties every parameter gradient node to the certified gradient.
This is its data-parallel twin, for the render EfficientNetRender emits at replicas > 1: R
replicas at batch N, every one of the 49 BatchNorms synchronised (bnFwdSite / bnBackSite /
bnGammaSite), every parameter gradient all-reduced by its mean. The capstone
efficientnet_net_syncTiedG says that, for every parameter,
mean over the R replicas of replica r's gradient node, loss divided by B
= the single-device gradient node at the global batch R·N, loss divided by R·B
— the gradient node EnetTiePoCG.efficientnet_net_tiedG at N := R·N ties to the certified
gradient. The spec it is stated against has not moved: the right-hand side is T3's chain at
N := R·N — its forward prefixes, loss cotangent and block .backwards verbatim, and its
in-block cotangents as named definitions (xCotEc, tCotDn, …) that unfold to enetExpTiedG's
lets, so each right-hand node is T3's node by rfl.
Five steps #
ResNet-34's four (ResNet34SyncStepTieB.lean), and one B0 needs because of how its T3 is written.
- The block VJP is the chain (§ 0). T3 threads each block's input cotangent as a certified
VJP's
.backward; a replica computes its own by the explicit chain, and only the explicit chain can be sharded.xCotIn_eq_vjpand its four peers say the two agree — theEfficientNetBackB0stage graphs, read at an.operandleaf, withbnBatchLABack_faithfulturning the one non-rfllink intobnBackB. - Sharding (§§ 2, 5). Every non-BN link is per-example — conv, depthwise and strided
depthwise input-VJPs, swish and sigmoid masks, and the squeeze-excite backward: the gate
cotangent
gateCotB(seReduceB'sden) and the fused input-VJPseInB(seBackBatched's) both read one example at a time, so they shard like ResNet-34's pool backward. The BN link isbnSyncInB, P2 on the graph, read throughbnInB_eq_bnBackBonto T3'sbnBackB. - The collectives. ResNet-34's conv, dense and BatchNorm ones, plus the depthwise,
strided-depthwise and XLA-
SAMEstem conv weights fromMBConvSyncTieB.lean, which also holds the depthwise, GAP and dense links of steps 1 and 3 that MobileNetV2 shares (§ 3 moved there). - Homogeneity (§§ 1, 4). Every link is linear in its cotangent; most are a certified VJP's
.backward, soHasVJP.backward_smulis the whole proof. - The divisor. Replica
r's loss cotangent isR ×its shard of the global one (replicaLossCot_eq), and steps 1–3 carry thatRdown to cancel each collective's1/R.
What is covered, and what is NOT claimed #
The DP render runs convBias := false, so it emits 213 parameter collectives — stem 3, b1 10,
fifteen MBConv6 blocks × 13, head 5 — and all 213 are tied. T3 carries 49 more conjuncts, one per
conv bias (a bnBetaGradB at the conv-output cotangent), for the convBias := true census; the
DP artifacts do not emit them and they are not tied here.
⚠ The replicas' saved forward activations enter as the shards of the single-device forward's;
that the sync forward graph computes exactly those is EfficientNetSyncB's
efficientnetFwdGraphSync_full_shard, the forward half. ⚠ That the replicas' inputs are the
shards of one batch is the driver's. ⚠ T3 states the chain without stochastic depth or classifier
dropout, so this does too: the drop / dropdo DP variants add a dropPathB on each residual
branch and a dropoutB before the classifier — per-example diagonal scalings, which shard and are
linear, but whose chain neither tier states. The bf16 DP variants emit different gradient nodes
and are not covered. ⚠ The lowerer's all_reduce is trusted as every other op's lowering is.
The tail every MBConv block shares — depthwise BatchNorm → swish → squeeze-excite →
1×1 project → project BatchNorm. MBW and MBWNoExp both carry it; naming it once lets the
three block kinds share one tail chain.
- dε : ℝ
- dγ : Vec mid
- dβ : Vec mid
- z1 : Mat mid rd
- zb1 : Vec rd
- z2 : Mat rd mid
- zb2 : Vec mid
- pW : Kernel4 oc mid 1 1
- pb : Vec oc
- pε : ℝ
- pγ : Vec oc
- pβ : Vec oc
Instances For
The tail of the MBConv1 block's weights.
Equations
Instances For
The tail's forward activations, from the depthwise conv output dc — enetExpTiedG's dn,
dr, s, e1, z, e2, se, pc, definitionally.
Equations
- Proofs.EnetSyncTieG.tDr N h w t dc = Proofs.swish (N * (mid * h * w)) (Proofs.EnetSyncTieG.tDn N h w t dc)
Instances For
Equations
- Proofs.EnetSyncTieG.tS N h w t dc = Proofs.StableHLO.batchMap N (Proofs.globalAvgPoolFlat mid h w) (Proofs.EnetSyncTieG.tDr N h w t dc)
Instances For
Equations
- Proofs.EnetSyncTieG.tE1 N h w t dc = Proofs.StableHLO.batchMap N (Proofs.dense t.z1 t.zb1) (Proofs.EnetSyncTieG.tS N h w t dc)
Instances For
Equations
- Proofs.EnetSyncTieG.tZ N h w t dc = Proofs.swish (N * rd) (Proofs.EnetSyncTieG.tE1 N h w t dc)
Instances For
Equations
- Proofs.EnetSyncTieG.tE2 N h w t dc = Proofs.StableHLO.batchMap N (Proofs.dense t.z2 t.zb2) (Proofs.EnetSyncTieG.tZ N h w t dc)
Instances For
Equations
- Proofs.EnetSyncTieG.tPc N h w t dc = Proofs.StableHLO.batchMap N (Proofs.flatConv t.pW t.pb) (Proofs.EnetSyncTieG.tSe N h w t dc)
Instances For
The tail's backward chain from the block-output cotangent dy — enetExpTiedG's cotPbn …
cotDc, definitionally.
Equations
- Proofs.EnetSyncTieG.tCotPbn N h w t hp dc dy = Proofs.EnetTiePoC.bnBackB N oc h w t.pε hp t.pγ t.pβ (Proofs.EnetSyncTieG.tPc N h w t dc) dy
Instances For
Equations
- Proofs.EnetSyncTieG.tCotSeOut N h w t hp dc dy = Proofs.EnetTiePoC.cInB N t.pW t.pb (Proofs.EnetSyncTieG.tCotPbn N h w t hp dc dy)
Instances For
Equations
- Proofs.EnetSyncTieG.tDgate N h w t hp dc dy = Proofs.EnetTiePoC.gateCotB N mid h w (Proofs.EnetSyncTieG.tDr N h w t dc) (Proofs.EnetSyncTieG.tCotSeOut N h w t hp dc dy)
Instances For
Equations
- Proofs.EnetSyncTieG.tCotE2 N h w t hp dc dy = Proofs.EnetTiePoC.sigBackB (N * mid) (Proofs.EnetSyncTieG.tE2 N h w t dc) (Proofs.EnetSyncTieG.tDgate N h w t hp dc dy)
Instances For
Equations
- Proofs.EnetSyncTieG.tCotZ N h w t hp dc dy = Proofs.StableHLO.rowDenseBackFlat N rd mid t.z2 (Proofs.EnetSyncTieG.tCotE2 N h w t hp dc dy)
Instances For
Equations
- Proofs.EnetSyncTieG.tCotE1 N h w t hp dc dy = Proofs.EnetTiePoC.swBackB (N * rd) (Proofs.EnetSyncTieG.tE1 N h w t dc) (Proofs.EnetSyncTieG.tCotZ N h w t hp dc dy)
Instances For
Equations
- Proofs.EnetSyncTieG.tCotDxSe N h w t hp dc dy = Proofs.EnetTiePoC.seInB N t.z1 t.zb1 t.z2 t.zb2 (Proofs.EnetSyncTieG.tDr N h w t dc) (Proofs.EnetSyncTieG.tCotSeOut N h w t hp dc dy)
Instances For
Equations
- Proofs.EnetSyncTieG.tCotDn N h w t hp dc dy = Proofs.EnetTiePoC.swBackB (N * (mid * h * w)) (Proofs.EnetSyncTieG.tDn N h w t dc) (Proofs.EnetSyncTieG.tCotDxSe N h w t hp dc dy)
Instances For
Equations
- Proofs.EnetSyncTieG.tCotDc N h w t hd hp dc dy = Proofs.EnetTiePoC.bnBackB N mid h w t.dε hd t.dγ t.dβ dc (Proofs.EnetSyncTieG.tCotDn N h w t hp dc dy)
Instances For
The stride-1 expand front (b3, b5, …, and the widenings b9 / b16).
Equations
- Proofs.EnetSyncTieG.xEc N h w p xin = Proofs.StableHLO.batchMap N (Proofs.flatConv p.eW p.eb) xin
Instances For
Equations
- Proofs.EnetSyncTieG.xEn N h w p xin = Proofs.StableHLO.bnBatchLA N mid h w p.eε p.eγ p.eβ (Proofs.EnetSyncTieG.xEc N h w p xin)
Instances For
Equations
- Proofs.EnetSyncTieG.xEr N h w p xin = Proofs.swish (N * (mid * h * w)) (Proofs.EnetSyncTieG.xEn N h w p xin)
Instances For
Equations
- Proofs.EnetSyncTieG.xDc N h w p xin = Proofs.StableHLO.batchMap N (Proofs.depthwiseFlat p.dW p.db) (Proofs.EnetSyncTieG.xEr N h w p xin)
Instances For
Equations
- Proofs.EnetSyncTieG.xCotEn N h w p hd hp xin dy = Proofs.EnetTiePoC.swBackB (N * (mid * h * w)) (Proofs.EnetSyncTieG.xEn N h w p xin) (Proofs.EnetSyncTieG.xCotEr N h w p hd hp xin dy)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The widening block's input cotangent — the expand conv's input-VJP.
Equations
- Proofs.EnetSyncTieG.xCotIn N h w p he hd hp xin dy = Proofs.EnetTiePoC.cInB N p.eW p.eb (Proofs.EnetSyncTieG.xCotEc N h w p he hd hp xin dy)
Instances For
The residual block's input cotangent — the body's, plus the identity skip.
Equations
- Proofs.EnetSyncTieG.rCotIn N h w p he hd hp xin dy i = Proofs.EnetSyncTieG.xCotIn N h w p he hd hp xin dy i + dy i
Instances For
The strided front (b2, b4, b6, b12): expand at the input grid 2h×2w.
Equations
- Proofs.EnetSyncTieG.sEc N h w p xin = Proofs.StableHLO.batchMap N (Proofs.flatConv p.eW p.eb) xin
Instances For
Equations
- Proofs.EnetSyncTieG.sEn N h w p xin = Proofs.StableHLO.bnBatchLA N mid (2 * h) (2 * w) p.eε p.eγ p.eβ (Proofs.EnetSyncTieG.sEc N h w p xin)
Instances For
Equations
- Proofs.EnetSyncTieG.sEr N h w p xin = Proofs.swish (N * (mid * (2 * h) * (2 * w))) (Proofs.EnetSyncTieG.sEn N h w p xin)
Instances For
Equations
- Proofs.EnetSyncTieG.sDc N h w p xin = Proofs.StableHLO.batchMap N (Proofs.depthwiseStride2Flat p.dW p.db) (Proofs.EnetSyncTieG.sEr N h w p xin)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The strided block's input cotangent.
Equations
- Proofs.EnetSyncTieG.sCotIn N h w p he hd hp xin dy = Proofs.EnetTiePoC.cInB N p.eW p.eb (Proofs.EnetSyncTieG.sCotEc N h w p he hd hp xin dy)
Instances For
The MBConv1 front (b1): the depthwise runs on the block input.
Equations
- Proofs.EnetSyncTieG.nDc N h w p xin = Proofs.StableHLO.batchMap N (Proofs.depthwiseFlat p.dW p.db) xin
Instances For
The MBConv1 block's input cotangent — the depthwise's input-VJP.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The stem (enetStemTiedG's chain) and the head (enetHeadTiedG's).
Equations
- Proofs.EnetSyncTieG.stStc N h w Ws bs x = Proofs.StableHLO.batchMap N (Proofs.flatConvStride2Xla Ws bs) x
Instances For
Equations
- Proofs.EnetSyncTieG.stStn N h w Ws bs εs γs βs x = Proofs.StableHLO.bnBatchLA N oc h w εs γs βs (Proofs.EnetSyncTieG.stStc N h w Ws bs x)
Instances For
Equations
- Proofs.EnetSyncTieG.stCotBnS N h w Ws bs εs γs βs x dy = Proofs.EnetTiePoC.swBackB (N * (oc * h * w)) (Proofs.EnetSyncTieG.stStn N h w Ws bs εs γs βs x) dy
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Proofs.EnetSyncTieG.hdHc N h w Wh bh xin = Proofs.StableHLO.batchMap N (Proofs.flatConv Wh bh) xin
Instances For
Equations
- Proofs.EnetSyncTieG.hdHn N h w Wh bh εh γh βh xin = Proofs.StableHLO.bnBatchLA N oc h w εh γh βh (Proofs.EnetSyncTieG.hdHc N h w Wh bh xin)
Instances For
Equations
- Proofs.EnetSyncTieG.hdCotHr N h w Wfc g = Proofs.EnetTiePoC.gapInB N oc h w (Proofs.StableHLO.rowDenseBackFlat N oc nC Wfc g)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The head's input cotangent — the 1×1 conv's input-VJP.
Equations
- Proofs.EnetSyncTieG.hdCotIn N h w Wh bh εh hεh γh βh Wfc xin g = Proofs.EnetTiePoC.cInB N Wh bh (Proofs.EnetSyncTieG.hdCotHbn N h w Wh bh εh hεh γh βh Wfc xin g)
Instances For
The stage backwards, written out #
Each is the EfficientNetBackB0 stage graph's faithfulness read at an .operand leaf: the graph's
den IS the chain above node for node, except the BatchNorm link, which bnBatchLABack_faithful
turns into bnBackB.
Each block's input cotangent IS its certified VJP #
T3 threads the block-output cotangents by the block VJPs' .backward; the replicas compute theirs
by the explicit chain. These say the two agree, so the sharding argument (which needs the explicit
chain) lands on T3's own .backward terms. HasVJP.backward_unique swaps the bundle-level witness
for the unfolded one, which is then the stage composition by rfl.
The SE gate cotangent, per example: channel k's spatial sum of x ⊙ dy.
Equations
Instances For
⭐ The SE gate cotangent reads one example at a time — seReduceB is batchMapAux of
gateEx — so it shards like ResNet-34's pool backward.
The fused SE input-VJP is the per-example seBlockFull VJP, lifted — seBackBatched's den.
⭐⭐ The sync-BN backward on replica r is shard r of the certified global BN backward —
bnSyncInB_shard (P2 at the network index) read through bnInB_eq_bnBackB, so the right-hand
side is bnBackB, T3's own BN link.
The tail, on the replicas #
Equations
- Proofs.EnetSyncTieG.tsCotSeOut R hR N h w t DC dys r = Proofs.EnetTiePoC.cInB N t.pW t.pb (Proofs.EnetSyncTieG.tsCotPbn R hR N h w t DC dys r)
Instances For
Equations
- Proofs.EnetSyncTieG.tsCotZ R hR N h w t DC dys r = Proofs.StableHLO.rowDenseBackFlat N rd mid t.z2 (Proofs.EnetSyncTieG.tsCotE2 R hR N h w t DC dys r)
Instances For
The fronts, on the replicas #
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A replica's input cotangent at a widening block (b9, b16).
Equations
- Proofs.EnetSyncTieG.xsCotIn R hR N h w p XIN dys r = Proofs.EnetTiePoC.cInB N p.eW p.eb (Proofs.EnetSyncTieG.xsCotEc R hR N h w p XIN dys r)
Instances For
A replica's input cotangent at a residual block — the body's plus the skip's.
Equations
- Proofs.EnetSyncTieG.rsCotIn R hR N h w p XIN dys r i = Proofs.EnetSyncTieG.xsCotIn R hR N h w p XIN dys r i + dys r i
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A replica's input cotangent at a strided block (b2, b4, b6, b12).
Equations
- Proofs.EnetSyncTieG.ssCotIn R hR N h w p XIN dys r = Proofs.EnetTiePoC.cInB N p.eW p.eb (Proofs.EnetSyncTieG.ssCotEc R hR N h w p XIN dys r)
Instances For
A replica's input cotangent at the MBConv1 block (b1).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A replica's input cotangent at the head.
Equations
- Proofs.EnetSyncTieG.hdsCotIn R hR N h w Wh bh εh γh βh Wfc XIN gs r = Proofs.EnetTiePoC.cInB N Wh bh (Proofs.EnetSyncTieG.hdsCotHbn R hR N h w Wh bh εh γh βh Wfc XIN gs r)
Instances For
The scaled-shard invariant across each block #
Replicas at R × the shards of the single-device block-output cotangent DY hand the next block
up R × the shards of T3's own .backward — sharding, then the explicit chain IS the VJP (§ 0),
then HasVJP.backward_smul.
The tail, DP-tied — nine collectives: the depthwise BatchNorm's γ and β, the SE reduce and excite dense layers' weight and bias, the project conv weight, the project BatchNorm's γ and β. Each equals the single-device gradient node at the global batch, at T3's chain cotangents.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A stride-1 MBConv6 block, DP-tied (the nine residual blocks and the two widenings) —
thirteen collectives: the expand conv weight, the expand BatchNorm's γ and β, the depthwise
weight, then the tail's nine. The body is the same with or without the identity skip; the skip
lives in the cotangent thread (rsCotIn).
Equations
- One or more equations did not get rendered due to their size.
Instances For
A strided MBConv6 block, DP-tied (b2, b4, b6, b12) — thirteen collectives, the expand pair
at the input grid 2h×2w and the depthwise strided.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The MBConv1 block, DP-tied (b1) — ten collectives: the depthwise weight, then the tail's nine.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The stem, DP-tied — three collectives: the 3×3/s2 XLA-SAME conv weight and its
BatchNorm's γ and β.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The head, DP-tied — five collectives: the 1×1 conv weight, its BatchNorm's γ and β, and the classifier's weight and bias, the last two at the loss cotangent itself.
Equations
- One or more equations did not get rendered due to their size.
Instances For
⭐⭐⭐ The synchronised-BN data-parallel EfficientNet-B0 step IS the single-device step at the
global batch. R replicas at batch N, each dividing its loss by B, each running the
render's sync-BN backward chain from its own label-smoothed cotangent; every parameter's
all-reduced mean gradient — stem 3, b1 10, fifteen MBConv6 blocks × 13, head 5: the 213 the
render emits at convBias := false — equals the single-device batch-BN gradient node at batch
R·N, loss divided by R·B, at the cotangent T3's chain delivers there.
The right-hand chain is EnetTiePoCG.efficientnet_net_tiedG's at N := R·N, B := R·B:
verbatim for the forward prefixes a0 … a16, the loss cotangent g and the block-output
cotangents dy16 … dy0 threaded by the certified block VJPs' .backward; by rfl for the
in-block cotangents, which are this file's named chain. That capstone ties those nodes to the
certified gradient, so the two together say the DP step's update is the certified gradient of
the mean loss over all R·N examples. It carries the same fifty 0 < ε hypotheses, because
T3's single-device chain does.
⭐ The left-hand chain is the replicas' own: sync-BN backward at every one of the 49
BatchNorms (bnSyncInB, a collective each), per-example conv / depthwise / squeeze-excite /
swish / head links, each replica's own loss cotangent.