MobileNetV4-Conv-M's data-parallel step at SYNCHRONISED BatchNorm IS the single-device step at R·N #
MobileNetV4StepTieB.lean (T3) threads a loss cotangent g 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 MobileNetV4RenderB emits at replicas > 1: R replicas at
batch N, every one of the 77 BatchNorms synchronised, every parameter gradient all-reduced by
its mean. The capstone mnv4_net_syncTiedB says that, for every parameter the render emits,
mean over the R replicas of replica r's gradient node, replica cotangent gs r
= the single-device gradient node at the global batch R·N, global cotangent G
whenever each replica's loss cotangent is R × its shard of the global one — the gradient node
mnv4_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.
⚠ T3 binds the loss cotangent, so this twin does too #
mnv4_net_tiedB takes the logits' cotangent g as a binder (mnv4_lossCot_is_smoothedCE_grad
instantiates it). The twin therefore takes the global cotangent G and the replica family gs as
binders, with the scaled-shard hypothesis ∀ r, gs r = batchShard R N nCls (fun i => R * G i) r —
exactly the invariant ResNet-34's and MobileNetV2's twins carry down their chains, and there
discharge from replicaLossCot_eq. mnv4_net_syncTiedB_smoothedCE discharges it the same way for
the label-smoothed softmax chain the artifacts emit: replicas dividing their loss by B, the
single-device step by R·B.
The same four steps as ResNet-34's twin #
ResNet34SyncStepTieB.lean is the template, and everything net-agnostic is imported from it: the
replica BN link bnSyncInB and its shard lemma, the ConvWSync / ConvStridedWSync / BnSync /
DenseSync statements and their *_of_scaled closers, and the homogeneity of bnInB, cInB,
cStridedInB and the head. The MBConv pieces come from MBConvSyncTieB.lean — the depthwise and
SYMMETRIC strided-depthwise input-VJPs and weight collectives, and the XLA-SAME stem collective.
Swish's backward is a certified VJP's .backward, so its homogeneity is HasVJP.backward_smul
and its sharding is definitional.
- Sharding — each replica's backward chain, handed its shard of a global cotangent, computes
the shard of the global chain. The relu mask and swish's backward are pointwise; the conv,
depthwise, strided conv and strided depthwise input-VJPs are per-example maps; every BN link is
bnSyncInB. The table'sk = 0dispatch (if s.postDWk = 0,if s.preDWk = 0) is the sameifon both sides, so it splits once. - The collectives — the mean over replicas of each replica's gradient node is
1/Rof the global node at the global cotangent. MobileNetV4 needs no kind the kit does not have. - Homogeneity — the single-device chain and its gradient nodes are linear in the loss
cotangent (§1):
R ×the cotangent givesR ×every node. - The divisor — the hypothesis on
gs; itsRcancels the collective's1/Rat every parameter.
⭐ Everything is GENERIC IN THE ROW (s : UibSpec), as T3 is, so widths stay variables; the
capstone instantiates at the 21 concrete rows. MNv4's activation is relu (the fused stage's is
swish), so the masks are reluMaskB — MobileNetV2's relu6MaskB does not appear.
The index seam #
ℝ-level, as T3 is: the replica BN link bnSyncInB is the den of the emitted nodes
(bnSyncDyStatsB → all-reduce → bnSyncBack) over .operand leaves at reassocB, and
bnSyncInB_shard carries P2 across the N·(c·h·w) / N·(c·(h·w)) seam; BnSync's γ and β
collectives read reassocB of the pre-BN activation and of the cotangent, exactly as T3's
BnPairTiedB nodes do.
What the DP render emits, and what is tied #
MobileNetV4RenderB emits 233 parameter gradients — stem 3 (sW, sg, sbt), fused 6
(f0cW f0cg f0cbt f0pW f0pg f0pbt), thirteen ExtraDW-profile blocks × 12 (ten stride-1 rows and
the three pre-strided rows 1, 3, 11: u{p}{q,e,d,p}{W,g,bt}), four ConvNeXt-like × 9 (no d),
four FFN × 6 (no q, no d), head 8 (h1W h1g h1bt hW hg hbt Wd bd) — and the capstone ties all
233. ⚠ There are no conv-bias gradients to exclude: the render has no convBias flag, binds every
bias slot to %zb{c}, and emits none. ⚠ Conv-M has no post-strided row, so the render's
post-strided backward is never emitted for this table and T3 has no chain for it; neither does
this file.
What is NOT claimed #
⚠ The replicas' saved forward activations enter as the shards of the single-device forward's
(batchShard r (mnv4Blk{k} (R*N) w X)); that the sync forward graph computes exactly those is
StableHLO.mnv4FwdGraphSync_full_shard, the forward half. ⚠ That the replicas' inputs are the
shards of one batch is the driver's. ⚠ The statement is at the f32 nodes: the *bf16 artifact's
bf16 conv twins are outside it, as for every other net. ⚠ The lowerer's all_reduce is trusted as
every other op's lowering is.
The stride-1 body (ExtraDW / ConvNeXt-like / FFN), each one line from the previous link's. The
two ifs are T3's table dispatch; they split on both sides at once.
The pre-strided block (rows 1, 3, 11).
The stem, the fused stage (swish, no mask) and the two-conv head.
Stride-1 body, replica r: the project BatchNorm's sync backward of the block-output cotangent
(the bottleneck is linear, so nothing masks it). Feeds u{p}pW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the post-DW BN's output cotangent. Feeds u{p}dg/u{p}dbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the post-DW conv's output cotangent. Feeds u{p}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 — dispatching on the row exactly
as T3's mnv4CotEn does. Feeds u{p}eg/u{p}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 u{p}eW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the pre-DW BN's output cotangent. Feeds u{p}qg/u{p}qbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 body, replica r: the pre-DW conv's output cotangent. Feeds u{p}qW.
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, before the skip fan-in — the pre-DW's
input-VJP, or the expand's when the row has no pre-DW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block, replica r: the project BatchNorm's sync backward. Feeds u{p}pW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block, replica r: the post-DW BN's output cotangent. Feeds u{p}dg/u{p}dbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block, replica r: the post-DW conv's output cotangent. Feeds u{p}dW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block, replica r: the expand BN's output cotangent. Feeds u{p}eg/u{p}ebt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block, replica r: the expand conv's output cotangent. Feeds u{p}eW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block, replica r: the STRIDED pre-DW BN's output cotangent. Feeds
u{p}qg/u{p}qbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block, replica r: the STRIDED pre-DW conv's output cotangent. Feeds u{p}qW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block, replica r: the block-INPUT cotangent — the strided depthwise's input-VJP,
landing at 2h. No skip.
Equations
- Proofs.MobileNetV4SyncTieB.mnv4SBodySyncCotIn R hR N s p XIN dys r = Proofs.EnetTiePoC.dStridedInB N p.Wq p.bq (Proofs.MobileNetV4SyncTieB.mnv4SSyncCotQc R hR N s p XIN dys r)
Instances For
Stem, replica r: the stem relu's mask of the cotangent the fused stage 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; the chain stops here.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fused stage, replica r: the project BatchNorm's sync backward of the stage-output cotangent
(no activation after the project). Feeds f0pW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fused stage, replica r: the fused BN's output cotangent, through swish's backward — no
mask. Feeds f0cg/f0cbt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fused stage, replica r: the fused conv's output cotangent. Feeds f0cW.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fused stage, replica r: the stage-INPUT cotangent — the SYMMETRIC strided conv's input-VJP,
handed to the stem.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, replica r: the second head relu's mask of the GAP/dense tail'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 second 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 first head relu's mask. Feeds h1g/h1bt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, replica r: the first head BatchNorm's sync backward. Feeds h1W.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, replica r: the cotangent handed to block 21.
Equations
- One or more equations did not get rendered due to their size.
Instances For
⭐ The skip fan-in carries the invariant — body dx + dyOut, each at R × its shard, is
R × the shard of the sum. Generic in the width, so it applies at the concrete rows where
s.oc = s.ic is definitional, as T3's mnv4SkipCotIn is.
ExtraDW-profile stride-1 block, DP-tied — its twelve emitted collectives (u{p}qW qg qbt eW eg ebt dW dg dbt pW pg pbt), each the single-device node at the global batch, at T3's chain
cotangents there. The skip changes only the cotangent handed down, never a parameter's.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ConvNeXt-like block (postDWk = 0), DP-tied — its nine emitted collectives (no d).
Equations
- One or more equations did not get rendered due to their size.
Instances For
FFN block (neither depthwise), DP-tied — its six emitted collectives (eW eg ebt pW pg pbt).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pre-strided block (rows 1, 3, 11), DP-tied — its twelve emitted collectives, the leading
one the SYMMETRIC strided depthwise weight depthwiseStridedWeightGradB.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stem, DP-tied — 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
Fused stage, DP-tied — its six emitted collectives: the SYMMETRIC strided conv weight
(f0cW, where the stem's is the XLA-SAME twin), the fused BN's γ/β (through swish), the
project weight and the project BN's γ/β.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, DP-tied — all eight emitted collectives: the two 1×1 conv weights (h1W 256 → 960,
hW 960 → 1280), their BatchNorms' γ and β, and the classifier's weight and bias at the GAP
output (ResNet34SyncTieB.r34HeadSyncTiedB, reused: MNv4's GAP-and-dense tail is ResNet-34's).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The whole-net statement, named — so the capstone (cotangents bound) and its smoothed-CE
corollary (cotangents instantiated) state exactly one thing. The first 23 lets are
mnv4_net_tiedB's chain at N := R·N, driven by the global cotangent G; the next 23 are the
replicas' sync-BN chain, driven by the family gs; the 24 conjuncts are one per stage, every
emitted parameter collective against T3's node at the global batch.
Equations
- One or more equations did not get rendered due to their size.
Instances For
⭐⭐⭐ The synchronised-BN data-parallel MobileNetV4-Conv-M step IS the single-device step at the
global batch. R replicas at batch N, each running the render's sync-BN backward chain
from its own loss cotangent gs r; when each gs r is R × its shard of a global cotangent
G — the replicas' loss divisor is R × smaller than the global step's — every parameter's
all-reduced mean gradient — stem 3, fused 6, thirteen ExtraDW-profile blocks × 12, four
ConvNeXt-like × 9, four FFN × 6, head 8: the 233 the render emits — equals the single-device
batch-BN gradient node at batch R·N, at the cotangent T3's chain delivers there from G.
⭐ The left-hand chain is the replicas' own: sync-BN backward (bnSyncInB, a collective per BN
layer), per-example conv / depthwise / strided / relu / swish / GAP / dense links. The
right-hand chain is mnv4_net_tiedB's at N := R·N with g := G, 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 global-batch step. mnv4_net_syncTiedB_smoothedCE discharges the
hypothesis for the label-smoothed chain the artifacts emit.
⛔ 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.
⭐⭐ …and at the loss the artifacts emit. mnv4_net_syncTiedB with its cotangent hypothesis
discharged by replicaLossCot_eq: each replica runs the label-smoothed softmax chain
(smoothedLossCotGraph, the rowB/unrowB spelling mnv4_lossCot_is_smoothedCE_grad reads
off the render) on its shard of the logits and targets with divisor B; the single-device step
runs it on the whole R·N batch with divisor R·B. Then every all-reduced gradient the DP
render emits IS the single-device node at batch R·N — the step mnv4_net_tiedB at
N := R·N, g := that step's own smoothed-CE cotangent, ties to the certified gradient.