MobileNetV2's data-parallel step at SYNCHRONISED BatchNorm IS the single-device step at R·N #
MobileNetV2StepTieB.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 MobileNetV2RenderB emits at replicas > 1: R
replicas at batch N, every one of the 52 BatchNorms synchronised, every parameter gradient
all-reduced by its mean. The capstone mnv2_net_syncTiedB says that, for every parameter the
render emits,
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 mnv2_net_tiedB at N := R·N ties to the certified gradient. The right-hand
side is the existing single-device chain at N := R·N, so the spec has not moved.
The same four steps as ResNet-34's twin #
ResNet34SyncStepTieB.lean is the template, and everything net-agnostic is imported from it
rather than restated: the replica BN link bnSyncInB and its shard lemma, the ConvWSync /
BnSync / DenseSync statements and their *_of_scaled closers, the divisor step
replicaLossCot_eq, and the homogeneity of bnInB and cInB. The inverted-residual pieces it
shares with EfficientNet-B0 — the depthwise, GAP and dense input-VJPs, the depthwise and
XLA-SAME stem weight collectives — come from MBConvSyncTieB.lean.
- Sharding — each replica's backward chain, handed its shard of a global cotangent, computes
the shard of the global chain. The relu6 mask is pointwise (
relu6MaskB_shard, byrfl); the conv, depthwise, XLA-SAMEstrided depthwise, GAP and dense input-VJPs are per-example maps; every BN link isbnSyncInB. - The collectives — the mean over replicas of each replica's gradient node is
1/Rof the global node at the global cotangent. MobileNetV2 adds three kinds the ResNet-34 kit does not have: the XLA-SAMEstrided conv weight (the stem), the depthwise weight and its XLA-SAMEstrided peer (§4). - Homogeneity — the single-device chain and its gradient nodes are linear in the loss
cotangent (§1):
R ×the cotangent givesR ×every node. - The divisor — replica
r's loss cotangent isR ×its shard of the global one, and thatRcancels the collective's1/Rat every parameter.
What the DP render emits, and what is tied #
At the committed convBias := false, MobileNetV2RenderB emits 158 parameter gradients — stem 3
(sW, sg, sbt), b1 6, sixteen blocks × 9 (eW eg ebt dW dg dbt pW pg pbt), head 3 (hW,
hg, hbt), dense 2 (Wd, bd) — and the capstone ties all 158. ⚠ The 52 conv, depthwise and
project BIAS nodes the single-device tie also states are not emitted at convBias := false and
are not tied here (mnv2_net_tiedB keeps them for the flag).
What is NOT claimed #
⚠ The replicas' saved forward activations enter as the shards of the single-device forward's
(batchShard r (mnv2PreB{k} (R*N) w X)); that the sync forward graph computes exactly those is
StableHLO.mobilenetv2FwdGraphSync_full_shard, the forward half. ⚠ That the replicas' inputs are
the shards of one batch is the driver's. ⚠ The lowerer's all_reduce is trusted as every other
op's lowering is.
The two-sided relu6 mask is linear in the cotangent it gates.
The block cotangents, each one line from the previous link's.
The gradient nodes MobileNetV2 adds to the ResNet-34 kit.
b1, replica r: the project BatchNorm's sync backward of the block-output cotangent (the
linear bottleneck has no activation after project). Feeds pW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
b1, replica r: the depthwise BN's output cotangent. Feeds dg/dbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
b1, replica r: the depthwise conv's output cotangent. Feeds dW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
b1, replica r: the block-INPUT cotangent, handed to the stem.
Equations
- Proofs.MobileNetV2SyncTieB.mnv2NoExpSyncCotIn R hR N h w p XIN dys r = Proofs.EnetTiePoC.dInB N p.dW p.db (Proofs.MobileNetV2SyncTieB.mnv2NoExpSyncCotDc R hR N h w p XIN dys r)
Instances For
Stride-1 body, replica r: the project BatchNorm's sync backward of the block-output
cotangent. Feeds pW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the depthwise BN's output cotangent. Feeds dg/dbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the depthwise conv's output cotangent. Feeds dW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the expand BN's output cotangent. Feeds eg/ebt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the expand conv's output cotangent. Feeds eW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the body's input cotangent — the whole block-input cotangent for a
widening (b11, b17).
Equations
- Proofs.MobileNetV2SyncTieB.mnv2SyncCotInBody R hR N h w p XIN dys r = Proofs.EnetTiePoC.cInB N p.eW p.eb (Proofs.MobileNetV2SyncTieB.mnv2SyncCotEc R hR N h w p XIN dys r)
Instances For
Skip block, replica r: the body branch plus the identity skip.
Equations
- Proofs.MobileNetV2SyncTieB.mnv2ResidSyncCotIn R hR N h w p XIN dys r i = Proofs.MobileNetV2SyncTieB.mnv2SyncCotInBody R hR N h w p XIN dys r i + dys r i
Instances For
Stride-2 block, replica r: the project BatchNorm's sync backward. Feeds pW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-2 block, replica r: the strided depthwise BN's output cotangent. Feeds dg/dbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-2 block, replica r: the strided depthwise conv's output cotangent. Feeds dW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-2 block, replica r: the expand BN's output cotangent at the 2h x 2w grid — the
strided depthwise's input-VJP (which upsamples) masked by the expand relu6.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-2 block, replica r: the expand conv's output cotangent. Feeds eW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-2 block, replica r: the block-INPUT cotangent.
Equations
- Proofs.MobileNetV2SyncTieB.mnv2StridedSyncCotIn R hR N h w p XIN dys r = Proofs.EnetTiePoC.cInB N p.eW p.eb (Proofs.MobileNetV2SyncTieB.mnv2SSyncCotEc R hR N h w p XIN dys r)
Instances For
Stem, replica r: the stem relu6's mask of the cotangent b1 hands down. Feeds sg/sbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stem, replica r: the stem BatchNorm's sync backward. Feeds sW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, replica r: the head relu6's mask of the GAP backward of the classifier's input-VJP of
this replica's loss cotangent. Feeds hg/hbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, replica r: the head BatchNorm's sync backward. Feeds hW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, replica r: the cotangent handed to b17.
Equations
- One or more equations did not get rendered due to their size.
Instances For
P4 at the XLA-SAME strided depthwise weight (b2, b4, b7, b14).
The XLA-SAME strided depthwise weight, DP-tied.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stem, DP-tied — the 3x3/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
t = 1 block (b1), DP-tied — its six emitted collectives: the depthwise weight, the
depthwise BatchNorm's γ and β, the project weight, the project BatchNorm's γ and β.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The scaled-shard invariant through b1: replicas at R × the shards of DY hand the stem
R × the shards of the single-device block-input cotangent.
Stride-1 inverted-residual block, DP-tied — its nine emitted collectives (eW eg ebt dW dg dbt pW pg pbt). ⭐ One statement for all twelve stride-1 blocks, skip or widening, exactly as
mnv2Stride1TiedB is: the identity skip changes only the cotangent handed to the previous
block, never a parameter's.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The scaled-shard invariant through a widening's body (b11, b17).
The scaled-shard invariant through a skip block.
Stride-2 downsampling block, DP-tied — its nine emitted collectives (b2, b4, b7,
b14): the expand half at the 2h x 2w input grid, the XLA-SAME strided depthwise.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The scaled-shard invariant through a stride-2 block.
Head, DP-tied — the 1x1 conv weight, its BatchNorm's γ and β, and the classifier's weight and bias at the GAP output.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The head's cotangent handed to b17 on a replica, at R × the shards of G, is R × the
shard of the single-device one.
⭐⭐⭐ The synchronised-BN data-parallel MobileNetV2 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 6, sixteen blocks × 9, head 3, dense 2: the 158 the
render emits — 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 left-hand chain is the replicas' own: sync-BN backward (bnSyncInB, a collective per
BN layer), per-example conv / depthwise / relu6 / GAP / dense links, each replica's own loss
cotangent. The right-hand chain is mnv2_net_tiedB's at N := R·N, B := R·B, whose nodes
that capstone ties to the certified gradient — so this and it together say the DP step's
update is the certified gradient of the mean loss over all R·N examples.
⛔ Before the render's sync-BN swap the DP render normalised per replica and this statement
was false: DataParallel.dpMeanGrad_ne_globalBatchGrad is the witness, and stays as the
statement of what those runs did.