MobileNetV2's data-parallel forward at SYNCHRONISED BatchNorm — replica r IS shard r #
MobileNetV2FullB.lean says the typed batch-BN graph denotes mobilenetv2ForwardBFull N w
on one device. MobileNetV2RenderB's data-parallel step normalises with the GLOBAL batch's
statistics at replicas > 1: every one of the 52 BatchNorm sites is the sync-BN composition —
this replica's mean all-reduced, then Chan's σ²_r + (μ_r − μ)² all-reduced, packed, then
bnSyncF. This file is the data-parallel twin of mobilenetv2FwdGraphBFull_faithful: that forward graph, stated as a family over the
R replicas, denotes on replica r exactly batchShard r of the single-device forward at the
global batch R·N.
den (mobilenetv2FwdGraphSyncFull R hR N epsStr w bf16 e r)
= batchShard R N nCls (mobilenetv2ForwardBFull (R * N) w X) r
given that each replica's input is its shard of one global batch X. The spec does not
move: the right-hand side is the committed mobilenetv2ForwardBFull, at N := R·N, and it does
not move with the precision either: bf16 selects the conv and depthwise kinds at every site
(.convAt / .convStridedXlaAt / .depthwiseAt / .depthwiseStridedXlaAt, as
MobileNetV2FullB), bf16 := true being the kinds the *bf16 DP renders emit —
mobilenetv2in_rmsdp64wxdols0eps0001bf16, the run the book reports, among them; each conv's
shard step erases the switch through Bf16Erasure (Bf16Fold.denOp_convAt_id, …) and the rest
of the proof is the f32 one. The *do* DP artifacts' forward — that run's — is
mobilenetv2FwdGraphSyncFullDo: the same graph with replica r's dropoutB at its own mask
%do between the GAP and the dense, and mobilenetv2FwdGraphSyncFullDo_shard says it denotes
shard r of mobilenetv2ForwardBFullDo at the global batch and the global mask the replicas'
masks are the shards of.
How it is proved #
As ResNet34SyncB.lean proves ResNet-34's: by induction on the chain, one block at a time, with
the shard hypothesis ∀ r, den (e r) = batchShard R N _ X r carried from block to block.
- every conv, depthwise, GAP and dense node is a per-example lift (
den_batchOp_shard), and so is the XLA-SAMEstrided conv and depthwise — the padding lives inside the per-example map; - relu6 is pointwise, so it commutes with sharding (
den_relu6_shard, the peer ofden_relu_shard); the identity skip isden_addVB_shard; - every BatchNorm site is
bnSyncSiteLA, whose shard lemmaden_bnSyncSiteLAis the sync-BN shard identity on the graph, read at the network index.
The graph reuses ResNet34SyncB's site verbatim — it is net-agnostic — and relu6's shard lemma
is the kit's, so this file is MobileNetV2's six block shapes and their chain.
Names #
Parameter names are MobileNetV2FullB's (%b{k}{e,d,p}{W,g,bt}, %sW, %hW, …, the
convBias := false zero-bias operands %zb{c}). A BatchNorm site with γ %b{k}dg gathers its
statistics as %arsum / %armean of b{k}dgmu and b{k}dgvar, each over a [c] vector — the
γ name without %, then mu / var.
What is NOT claimed here #
The backward and the parameter collectives are MobileNetV2SyncStepTieB.lean's. That the R
replicas' inputs are the shards of one batch is the driver's, as in DataParallel.Sync. The rounding the
bf16 kinds perform is not modelled, as f32 rounding is not: den is over ℝ at either value of
the flag. The lowerer's all_reduce is trusted as every other op's lowering is.
Stem at sync-BN, over the replica family: 3x3/s2 XLA-SAME conv → sync-BN → relu6.
Equations
- One or more equations did not get rendered due to their size.
Instances For
t = 1 bottleneck (b1) at sync-BN, over the replica family: depthwise → sync-BN → relu6 →
project 1x1 → sync-BN. Two sync sites.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 no-skip bottleneck (b11, b17) at sync-BN, over the replica family: expand → depthwise → project, a sync site after each, relu6 after the first two.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stride-1 skip bottleneck at sync-BN: the body plus the addVB identity skip, the block input
shared between both arms on every replica.
Equations
- Proofs.StableHLO.mnv2ResidGraphSync pfx epsStr R hR N h w p bf16 e r = (Proofs.StableHLO.mnv2ExpOnlyGraphSync pfx epsStr R hR N h w p bf16 e r).addVB (e r)
Instances For
Stride-2 downsampling bottleneck at sync-BN, over the replica family: expand at 2h x 2w, the
XLA-SAME strided depthwise, project at h x w; three sync sites.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head at sync-BN, over the replica family: 1x1 conv → sync-BN → relu6 → GAP → dense.
Equations
- One or more equations did not get rendered due to their size.
Instances For
mnv2HeadGraphSync with the classifier-dropout site: replica r's dropoutB at its own mask
ms r (the render's per-replica %do input) between the GAP and the dense —
mnv2HeadGraphBDo over the replica family.
Equations
- One or more equations did not get rendered due to their size.
Instances For
With the replicas' masks the shards of one global mask M, replica r's dropout head is
shard r of the global mnv2HeadBDo — the site's step is batchShard_zipWith at the
multiply, the rest mnv2HeadGraphSync_shard's.
The sync-BN data-parallel MobileNetV2 forward graph, over the replica family.
mobilenetv2FwdGraphBFull with every BatchNorm a bnSyncSiteLA over all R replicas; block
prefixes, parameter names and collective tags are the render's.
Equations
- One or more equations did not get rendered due to their size.
Instances For
At synchronised BatchNorm, replica r's forward is shard r of the global-batch
forward. Given that the replicas' inputs are the shards of one batch X of R·N examples,
the sync-BN graph on replica r denotes batchShard r of mobilenetv2ForwardBFull (R * N) w X — the committed batch-BN forward, at the global batch. One block lemma per stage, the
shard hypothesis threaded from each into the next.
The sync-BN data-parallel MobileNetV2 forward graph with classifier dropout, over the
replica family — mobilenetv2FwdGraphSyncFull with mnv2HeadGraphSyncDo as its head, replica
r at its mask ms r; the forward of the *do* DP train steps.
Equations
- One or more equations did not get rendered due to their size.
Instances For
mobilenetv2FwdGraphSyncFull_shard at the site: with the replicas' inputs the shards of one
batch X and their masks the shards of one mask M, replica r's dropout forward denotes
shard r of mobilenetv2ForwardBFullDo (R * N) w M X.