EfficientNet-B0's data-parallel forward at SYNCHRONISED BatchNorm — replica r IS shard r #
EfficientNetFullB0.lean says the typed batch-BN graph denotes efficientnetForwardBFull N w
on one device. At replicas > 1 the data-parallel render normalises every one of B0's 49
BatchNorms with the GLOBAL batch's statistics — the sync-BN composition bnFwdSite emits: this
replica's mean all-reduced, then Chan's σ²_r + (μ_r − μ)² all-reduced, packed, then bnSyncF.
This file is its data-parallel twin: 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 (efficientnetFwdGraphSyncFull R hR N epsStr w bf16 e r)
= batchShard R N nCls (efficientnetForwardBFull (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 efficientnetForwardBFull, 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 the single-device
graph), bf16 := true being the kinds the *bf16 DP renders emit —
efficientnetin_emarmsdp64dropdowxeps0001bf16, the run the book reports, among them (its drop
sites are outside this graph, as they are at f32); each conv's shard step erases the switch
through Bf16Erasure (Bf16Fold.denOp_convAt_id, …) and the rest of the proof is the f32 one.
How it is proved #
ResNet-34's recipe (ResNet34SyncB.lean), block by block, the shard hypothesis
∀ r, den (e r) = batchShard R N _ X r carried from each block into the next:
- every conv, depthwise, strided depthwise, squeeze-excite, GAP and dense node is a per-example
lift and commutes with sharding (
den_batchOp_shard) — the SE block included: its squeeze (GAP), both dense layers and the gate multiply all act on one example at a time, so it is onebatchMapand needs nothing new; - swish is pointwise (
den_swishF_shard), and so is the residualaddV(den_addV_shard); - every BatchNorm is
bnSyncSiteLA, whose shard lemmaden_bnSyncSiteLAis P1 on the graph.
The collectives are tagged as bnFwdSite tags them: a BN site whose γ is %{p}eg gathers
{p}egmu and {p}egvar, each over a [c] statistic. den ignores every string, so the tags fix
which graph is stated, not what it denotes.
What is NOT claimed here #
The backward and the parameter collectives are the step half (EfficientNetSyncStepTieG.lean).
That the R replicas' inputs are the shards of one batch is the driver's. The emitted
artifacts' stochastic-depth and classifier-dropout variants are efficientnetFwdGraphSyncFullDrop
(replica r's dropPathB at its own per-example scale on each of the nine skip-carrying blocks,
its dropoutB at its own mask before the dense), and efficientnetFwdGraphSyncFullDrop_shard
says it denotes shard r of efficientnetForwardBFullDrop at the global batch and the global
masks the replicas' are the shards of. The lowerer's all_reduce is trusted as every other op's
lowering is.
MBConv1 (b1, no expand) at sync-BN, over the replica family: depthwise → sync-BN → swish → SE → 1×1 project → sync-BN.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The MBConv6 body at sync-BN — expand 1×1 → sync-BN → swish → depthwise → sync-BN → swish → SE → project 1×1 → sync-BN — shared by the residual (b3, b5, …) and the no-skip widening (b9, b16) blocks.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The residual MBConv6 block (b3, b5, b7, b8, b10, b11, b13–b15): the body plus the identity skip,
addV body e — body first, the order mbResidGraphB uses.
Equations
- Proofs.StableHLO.mbResidGraphSync p epsStr R hR N h w q bf16 e r = (Proofs.StableHLO.mbBodyGraphSync p epsStr R hR N h w q bf16 e r).addV (e r)
Instances For
The strided MBConv6 block (b2, b4, b6, b12): expand at the input grid 2h×2w, the strided
depthwise down to h×w, SE and project there. Three sync sites, the expand one at 2h×2w.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stem at sync-BN, over the replica family: 3×3/s2 conv (XLA-SAME) → sync-BN → swish.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head at sync-BN, over the replica family: 1×1 conv → sync-BN → swish → GAP → dense.
Equations
- One or more equations did not get rendered due to their size.
Instances For
mbResidGraphSync with its drop site: replica r's dropPathB at its own per-example scale
s r on the branch before the skip add — mbResidDropGraphB over the replica family.
Equations
- One or more equations did not get rendered due to their size.
Instances For
With the replicas' scales the shards of one per-example mask S, replica r's block is shard
r of mbResidDropW at S — the site's step is dropPath_shard, the rest
mbResidGraphSync_shard's.
headGraphSync with the classifier-dropout site: replica r's dropoutB at its own mask
ms r between the GAP and the dense — headGraphBDo over the replica family.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The sync-BN data-parallel EfficientNet-B0 forward graph, over the replica family. The
single-device efficientnetFwdGraphBFull with every one of the 49 BatchNorms a bnSyncSiteLA
over all R replicas, fed each replica's own input subgraph e r; block prefixes and
collective tags are EfficientNetRender.Basic's.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The forward 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 images, the
sync-BN graph on replica r denotes batchShard r of efficientnetForwardBFull (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 EfficientNet-B0 forward graph with both sites, over the replica
family — efficientnetFwdGraphSyncFull with mbResidDropGraphSync at the nine skip-carrying
blocks (replica r at its scales ss i r, the mask names dpName's at the render's block
indices) and headGraphSyncDo as its head (replica r at its mask ms r); the forward of
the dropdo DP train steps, efficientnetin_emarmsdp64dropdowxeps0001bf16's among them.
Equations
- One or more equations did not get rendered due to their size.
Instances For
efficientnetFwdGraphSyncFull_shard at the sites: with the replicas' inputs the shards of one
batch X, their scales the exampleShards of one per-example mask per site SD i and their
masks the shards of one mask M, replica r's forward denotes shard r of
efficientnetForwardBFullDrop (R * N) w (some SD) (some M) X.