ResNet-34's data-parallel step at SYNCHRONISED BatchNorm IS the single-device step at R·N #
ResNet34StepTieB.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 ResNet34RenderB emits at replicas > 1 since
2026-09-21: R replicas at batch N, every BatchNorm synchronised (bnFwdSite / bnBackSite /
bnGammaSite), every parameter gradient all-reduced by its mean. The capstone
r34_net_syncTiedB 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 r34_net_tiedB at N := R·N ties to the certified gradient. So the sentence
the DP render header carries ("this step IS the single-device step at the global batch") is a
theorem, and the spec it is stated against has not moved: the right-hand side is the existing
single-device chain at N := R·N.
Four steps #
- Sharding — each replica's backward chain, handed its shard of a global cotangent, computes
the shard of the global chain. Every non-BN link (relu mask, conv and strided-conv input-VJP,
the 3×3/s2 pool's scatter, the head) is a per-example map and commutes with sharding by
definition; the BN link is
bnSyncInB, whose shard lemmabnSyncInB_shardis P2 on the graph (DataParallelSync.den_bnSyncBack_allReduce) carried across themul_assocseam. - The collectives — the mean over replicas of each replica's gradient node is
1/Rof the global node at the global cotangent (DataParallelSync's P4 lemmas, plus the strided-conv and dense ones here). The γ node is the sync one,bnSyncGammaGradB, reading the forward's all-reduced statistics — the one parameter gradient sync-BN changes. - Homogeneity — the single-device chain and its gradient nodes are linear in the loss
cotangent (
*_smul):R ×the cotangent givesR ×every node. - The divisor — replica
rdivides its loss byBand the global step byR·B, so replicar's loss cotangent isR ×its shard of the global one (replicaLossCot_eq). Steps 1–3 carry thatRdown the chain and it cancels the collective's1/R.
What is NOT claimed #
⚠ The replicas' saved forward activations enter as the shards of the single-device forward's
(batchShard r (r34Pre_k (R*N) w X)); that the sync forward graph computes exactly those is
ResNet34SyncB.resnet34FwdGraphSync_full_shard, the forward half. ⚠ That the replicas' inputs are
the shards of one batch is the driver's. ⚠ The emitted artifacts run convBias := false, so the
conv-bias nodes are not emitted and are not tied here (r34_net_tiedB keeps them for the flag).
⚠ The lowerer's all_reduce is trusted as every other op's lowering is.
The three-term BatchNorm input-gradient is linear in dy — both its reductions are.
The block cotangents, each one line from the previous link's.
The gradient nodes.
Replica r's sync-BN input cotangent, as bnBackSite's replicas > 1 branch computes it,
in the network layout: this replica's [μ ‖ σ² ‖ mean(γ·dy) ‖ mean(x̂·γ·dy)]
(bnSyncDyStatsB, reading the forward's syncStats) all-reduced, then bnSyncBack. The
replica peer of ResNet34TieB.bnInB, and like it written as the den of the emitted nodes
over .operand leaves.
Equations
- One or more equations did not get rendered due to their size.
Instances For
reassocB of a shard is the shard of the reassocB.
⭐⭐ The sync-BN backward on replica r is shard r of the global-batch BN backward —
den_bnSyncBack_allReduce (P2 on the graph) at the network index. The right-hand side is
bnInB, the single-device chain's BN link, at N := R·N.
The replica's block-INPUT cotangent: the residual fan-in, body plus identity skip.
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
The replica's block-INPUT cotangent: the projected-residual fan-in.
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
P4 at the STRIDED conv weight — den_allReduceMeanF_convWeightGradB_shard's strided peer.
P4 at the dense weight — the head's Σ_n outer product, split by replica.
P4 at the dense bias — Σ_n cot, split by replica.
One conv weight, DP-tied: the mean over replicas of each replica's weight-gradient node (at its shard of the layer input and its own cotangent) IS the single-device node at the global batch. Tags are the render's: the collective is named for the parameter.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The strided conv weight, DP-tied.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One BatchNorm's γ and β, DP-tied. Each replica's γ node is bnSyncGammaGradB, reading the
forward's all-reduced [μ ‖ σ²] (syncStats over the replicas' pre-BN activations, tagged
{tg}mu / {tg}var as bnFwdSite tags them), so its x̂ is the global batch's; the β node
reads no statistic. The right-hand sides are the single-device bnGammaGradB /
bnBetaGradB at N := R·N — BnPairTiedB's nodes.
Equations
- One or more equations did not get rendered due to their size.
Instances For
⭐ A replica family at R × the shards of COT gives the DP tie — the collective's 1/R
(§4) cancels the R homogeneity (§1) carries. The same three lines for every kind below.
Identity basic block, DP-tied. Its six emitted parameter collectives — conv₁/conv₂
weights, bn₁/bn₂ γ and β — each equal the single-device node at the global batch, at the
single-device chain cotangents driven by DY, when the replicas' block-output cotangents are
R × its shards.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The scaled-shard invariant, carried through one identity block: replicas at R × the shards
of DY produce block-input cotangents at R × the shards of the single-device one.
Downsample basic block, DP-tied — nine emitted collectives: the strided conv₁, the stride-1 conv₂ and the 1×1/s2 projection weights, and the three BatchNorms' γ and β.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Stem, DP-tied — the 7×7/s2 conv weight and its BatchNorm's γ and β.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Head, DP-tied — 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 block-side cotangent on a replica, at R × the shards of G, is R × the shard of
the single-device one.
rowB of a shard is the shard of the rowB — a relabelling inside each example.
⭐ The divisor step. Replica r divides its smoothed-CE cotangent by B — the render's
divConstB at the per-replica batch — and the single-device step at the global batch divides
by R·B. At the replica's shard of the logits and targets, the replica's cotangent is R ×
its shard of the global one. Nothing else about the loss differs: softmax, the label-smoothing
shift and the target are per example.
⭐⭐⭐ The synchronised-BN data-parallel ResNet-34 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, thirteen identity blocks × 6, three downsample blocks × 9, dense 2:
the 110 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 / relu / pool / head links, each replica's own loss cotangent. The
right-hand chain is r34_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 2026-09-21 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.