Documentation

LeanMlir.Proofs.Nets.MobileNet.MobileNetV4SyncStepTieB

MobileNetV4-Conv-M's data-parallel step at synchronised BatchNorm is the single-device step at R·N #

MobileNetV4StepTieB.lean threads a loss cotangent g down the batch-BN backward chain on one device and ties every parameter gradient node to the certified gradient at that chain's cotangent. 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.

The single-device tie 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 BnSync / DenseSync statements and their *_of_scaled closers (the conv and depthwise weight collectives are Foundation.GradNodesBAt's ConvWSyncAt bf16 / ConvStridedWSyncAt bf16 / DepthwiseWSyncAt bf16 / DepthwiseStridedWSyncAt bf16, on the renderers' precision switch), and the homogeneity of bnInB, cInB, cStridedInB and the head. The MBConv pieces come from DataParallel.SyncKit — the depthwise and SYMMETRIC strided-depthwise input-VJPs and weight collectives, the GAP backward and the row-wise dense input-VJP. The head's two 1×1 relabellings are per-example reindexes, so they commute with the batch cut (mnv4To11_shard, mnv4From11_shard) and with scaling.

  1. Sharding — each replica's backward chain, handed its shard of a global cotangent, computes the shard of the global chain. The relu mask is pointwise; the conv, depthwise, strided conv and strided depthwise input-VJPs are per-example maps; every BN link is bnSyncInB. The table's k = 0 dispatch (if s.postDWk = 0, if s.preDWk = 0) is the same if on both sides, so it splits once.
  2. The collectives — the mean over replicas of each replica's gradient node is 1/R of the global node at the global cotangent. MobileNetV4 needs no kind the kit does not have.
  3. Homogeneity — the single-device chain and its gradient nodes are linear in the loss cotangent (§1): R × the cotangent gives R × every node.
  4. The divisor — the hypothesis on gs; its R cancels the collective's 1/R at every parameter.

Everything is generic in the row (s : UibSpec), as MobileNetV4StepTieB is, so widths stay variables; the capstone instantiates at the 21 concrete rows. MNv4's activation is relu everywhere (timm), so the masks are reluMaskB — MobileNetV2's relu6MaskB does not appear; the BN-only pre-DW has no mask at all.

The index seam #

ℝ-level, as MobileNetV4StepTieB 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 DataParallel.Sync's P2 (the sync-BN input-VJP shard identity) 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 the BnPairTiedB nodes MobileNetV4StepTieB uses 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 blocks × 12 (ten stride-1 rows and the three 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.

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.mnv4FwdGraphSyncFull_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.

Precision is a flag on the statement. Every conv and depthwise weight collective below is stated on the renderers' switch (Foundation.GradNodesBAt): the replicas' nodes and the batch-R·N node are the f32 kind at bf16 := false and the bf16 kind at true — and the capstone takes bf16, so it covers the f32 DP artifacts and the *bf16 ones' step (mnv4in_emaaccdp8x128wxdowd005bf16, mnv4in_accdp8x128wxdropdowd01bf16) read over ℝ at the identity rounding (Bf16Erasure), where each bf16 collective is 1/R of the batch-R·N bf16 node exactly as at f32. At a real rounding the bf16 weight-gradient collective differs from the single-device node by the per-replica rounding of each partial sum, which DataParallel.SyncBf16 states and this file does not model, as the f32 tie does not model f32 rounding.

The stride-1 body (ExtraDW / ConvNeXt-like / FFN), each one line from the previous link's. The two ifs are MobileNetV4StepTieB's table dispatch; they split on both sides at once.

The strided block (rows 1, 3, 11).

The stem, the fused stage and the head.

theorem Proofs.MobileNetV4SyncTieB.mnv4StemCotC_smul (N h w : ℕ) {ic oc kH kW : ℕ} (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) :
IsHomog (Mnv4TieB.mnv4StemCotC N h w Ws bs εs γs βs x)
theorem Proofs.MobileNetV4SyncTieB.mnv4FusedCotIn_smul (N h w : ℕ) {ic mid oc kH kW : ℕ} (Wc : Kernel4 mid ic kH kW) (bc : Vec mid) (εc : ℝ) (γc βc : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp : Vec oc) (εp : ℝ) (γp βp : Vec oc) (xin : Vec (N * (ic * (2 * h) * (2 * w)))) :
IsHomog (Mnv4TieB.mnv4FusedCotIn N h w Wc bc εc γc βc Wp bp εp γp βp xin)
theorem Proofs.MobileNetV4SyncTieB.mnv4HeadCotIn_smul (N h w : ℕ) {c mid oc nCls : ℕ} (W1 : Kernel4 mid c 1 1) (b1 : Vec mid) (ε1 : ℝ) (γ1 β1 : Vec mid) (W2 : Kernel4 oc mid 1 1) (b2 : Vec oc) (ε2 : ℝ) (γ2 β2 : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (xin : Vec (N * (c * h * w))) :
IsHomog (Mnv4TieB.mnv4HeadCotIn N h w W1 b1 ε1 γ1 β1 W2 b2 ε2 γ2 β2 Wd bd xin)
noncomputable def Proofs.MobileNetV4SyncTieB.mnv4BodySyncCotIn (R : ℕ) (hR : 0 < R) (N : ℕ) (s : StableHLO.UibSpec) (p : StableHLO.UibParams s) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (r : Fin R) :
Vec (N * (s.ic * s.h * s.h))

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
    theorem Proofs.MobileNetV4SyncTieB.mnv4BodySyncCotIn_shard (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) (s : StableHLO.UibSpec) (hh : 0 < s.h) (p : StableHLO.UibParams s) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (s.oc * s.h * s.h) DY r) (r : Fin R) :
    mnv4BodySyncCotIn R hR N s p XIN dys r = batchShard R N (s.ic * s.h * s.h) (Mnv4TieB.mnv4BodyCotIn (R * N) s p XIN DY) r
    noncomputable def Proofs.MobileNetV4SyncTieB.mnv4SBodySyncCotIn (R : ℕ) (hR : 0 < R) (N : ℕ) (s : StableHLO.UibSpec) (p : StableHLO.UibParams s) (XIN : Vec (R * N * (s.ic * (2 * s.h) * (2 * s.h)))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (r : Fin R) :
    Vec (N * (s.ic * (2 * s.h) * (2 * s.h)))

    Strided block, replica r: the block-INPUT cotangent, at 2h — the pre-DW's input-VJP, or the expand's when the row has no pre-DW. No skip.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Proofs.MobileNetV4SyncTieB.mnv4SBodySyncCotIn_shard (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) (s : StableHLO.UibSpec) (hh : 0 < s.h) (p : StableHLO.UibParams s) (XIN : Vec (R * N * (s.ic * (2 * s.h) * (2 * s.h)))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (s.oc * s.h * s.h) DY r) (r : Fin R) :
      mnv4SBodySyncCotIn R hR N s p XIN dys r = batchShard R N (s.ic * (2 * s.h) * (2 * s.h)) (Mnv4TieB.mnv4SBodyCotIn (R * N) s p XIN DY) r
      noncomputable def Proofs.MobileNetV4SyncTieB.mnv4StemSyncCotC (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic oc kH kW : ℕ} (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (X : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (r : Fin R) :
      Vec (N * (oc * h * w))

      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
        theorem Proofs.MobileNetV4SyncTieB.mnv4StemSyncCotC_shard (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic oc kH kW : ℕ} (hN : 0 < N) (hh : 0 < h) (hw : 0 < w) (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (X : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (DY : Vec (R * N * (oc * h * w))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (oc * h * w) DY r) (r : Fin R) :
        mnv4StemSyncCotC R hR N h w Ws bs εs γs βs X dys r = batchShard R N (oc * h * w) (Mnv4TieB.mnv4StemCotC (R * N) h w Ws bs εs γs βs X DY) r
        noncomputable def Proofs.MobileNetV4SyncTieB.mnv4FusedSyncCotIn (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic mid oc kH kW : ℕ} (Wc : Kernel4 mid ic kH kW) (bc : Vec mid) (εc : ℝ) (γc βc : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp : Vec oc) (εp : ℝ) (γp : Vec oc) (XIN : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (r : Fin R) :
        Vec (N * (ic * (2 * h) * (2 * w)))

        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
          theorem Proofs.MobileNetV4SyncTieB.mnv4FusedSyncCotIn_shard (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic mid oc kH kW : ℕ} (hN : 0 < N) (hh : 0 < h) (hw : 0 < w) (Wc : Kernel4 mid ic kH kW) (bc : Vec mid) (εc : ℝ) (γc βc : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp : Vec oc) (εp : ℝ) (γp βp : Vec oc) (XIN : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (DY : Vec (R * N * (oc * h * w))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (oc * h * w) DY r) (r : Fin R) :
          mnv4FusedSyncCotIn R hR N h w Wc bc εc γc βc Wp bp εp γp XIN dys r = batchShard R N (ic * (2 * h) * (2 * w)) (Mnv4TieB.mnv4FusedCotIn (R * N) h w Wc bc εc γc βc Wp bp εp γp βp XIN DY) r
          noncomputable def Proofs.MobileNetV4SyncTieB.mnv4HeadSyncCotIn (R : ℕ) (hR : 0 < R) (N h w : ℕ) {c mid oc nCls : ℕ} (W1 : Kernel4 mid c 1 1) (b1 : Vec mid) (ε1 : ℝ) (γ1 β1 : Vec mid) (W2 : Kernel4 oc mid 1 1) (b2 : Vec oc) (ε2 : ℝ) (γ2 β2 : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (XIN : Vec (R * N * (c * h * w))) (gs : Fin R → Vec (N * nCls)) (r : Fin R) :
          Vec (N * (c * h * w))

          Head, replica r: the cotangent handed to block 21.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem Proofs.MobileNetV4SyncTieB.mnv4HeadSyncCotIn_shard (R : ℕ) (hR : 0 < R) (N h w : ℕ) {c mid oc nCls : ℕ} (hN : 0 < N) (hh : 0 < h) (hw : 0 < w) (W1 : Kernel4 mid c 1 1) (b1 : Vec mid) (ε1 : ℝ) (γ1 β1 : Vec mid) (W2 : Kernel4 oc mid 1 1) (b2 : Vec oc) (ε2 : ℝ) (γ2 β2 : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (XIN : Vec (R * N * (c * h * w))) (gs : Fin R → Vec (N * nCls)) (G : Vec (R * N * nCls)) (hgs : ∀ (r : Fin R), gs r = batchShard R N nCls G r) (r : Fin R) :
            mnv4HeadSyncCotIn R hR N h w W1 b1 ε1 γ1 β1 W2 b2 ε2 γ2 β2 Wd bd XIN gs r = batchShard R N (c * h * w) (Mnv4TieB.mnv4HeadCotIn (R * N) h w W1 b1 ε1 γ1 β1 W2 b2 ε2 γ2 β2 Wd bd XIN G) r
            theorem Proofs.MobileNetV4SyncTieB.mnv4BodySyncCotIn_scaled (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) (s : StableHLO.UibSpec) (hh : 0 < s.h) (p : StableHLO.UibParams s) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (s.oc * s.h * s.h) (fun (i : Fin (R * N * (s.oc * s.h * s.h))) => ↑R * DY i) r) (r : Fin R) :
            mnv4BodySyncCotIn R hR N s p XIN dys r = batchShard R N (s.ic * s.h * s.h) (fun (i : Fin (R * N * (s.ic * s.h * s.h))) => ↑R * Mnv4TieB.mnv4BodyCotIn (R * N) s p XIN DY i) r
            theorem Proofs.MobileNetV4SyncTieB.mnv4SkipSyncCotIn_scaled {R N n : ℕ} (a b : Fin R → Vec (N * n)) (A B : Vec (R * N * n)) (ha : ∀ (r : Fin R), a r = batchShard R N n (fun (i : Fin (R * N * n)) => ↑R * A i) r) (hb : ∀ (r : Fin R), b r = batchShard R N n (fun (i : Fin (R * N * n)) => ↑R * B i) r) (r : Fin R) :
            Mnv4TieB.mnv4SkipCotIn (a r) (b r) = batchShard R N n (fun (i : Fin (R * N * n)) => ↑R * Mnv4TieB.mnv4SkipCotIn A B i) r

            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 mnv4SkipCotIn is.

            theorem Proofs.MobileNetV4SyncTieB.mnv4SBodySyncCotIn_scaled (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) (s : StableHLO.UibSpec) (hh : 0 < s.h) (p : StableHLO.UibParams s) (XIN : Vec (R * N * (s.ic * (2 * s.h) * (2 * s.h)))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (s.oc * s.h * s.h) (fun (i : Fin (R * N * (s.oc * s.h * s.h))) => ↑R * DY i) r) (r : Fin R) :
            mnv4SBodySyncCotIn R hR N s p XIN dys r = batchShard R N (s.ic * (2 * s.h) * (2 * s.h)) (fun (i : Fin (R * N * (s.ic * (2 * s.h) * (2 * s.h)))) => ↑R * Mnv4TieB.mnv4SBodyCotIn (R * N) s p XIN DY i) r
            theorem Proofs.MobileNetV4SyncTieB.mnv4FusedSyncCotIn_scaled (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic mid oc kH kW : ℕ} (hN : 0 < N) (hh : 0 < h) (hw : 0 < w) (Wc : Kernel4 mid ic kH kW) (bc : Vec mid) (εc : ℝ) (γc βc : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp : Vec oc) (εp : ℝ) (γp βp : Vec oc) (XIN : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (DY : Vec (R * N * (oc * h * w))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (oc * h * w) (fun (i : Fin (R * N * (oc * h * w))) => ↑R * DY i) r) (r : Fin R) :
            mnv4FusedSyncCotIn R hR N h w Wc bc εc γc βc Wp bp εp γp XIN dys r = batchShard R N (ic * (2 * h) * (2 * w)) (fun (i : Fin (R * N * (ic * (2 * h) * (2 * w)))) => ↑R * Mnv4TieB.mnv4FusedCotIn (R * N) h w Wc bc εc γc βc Wp bp εp γp βp XIN DY i) r
            theorem Proofs.MobileNetV4SyncTieB.mnv4HeadSyncCotIn_scaled (R : ℕ) (hR : 0 < R) (N h w : ℕ) {c mid oc nCls : ℕ} (hN : 0 < N) (hh : 0 < h) (hw : 0 < w) (W1 : Kernel4 mid c 1 1) (b1 : Vec mid) (ε1 : ℝ) (γ1 β1 : Vec mid) (W2 : Kernel4 oc mid 1 1) (b2 : Vec oc) (ε2 : ℝ) (γ2 β2 : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (XIN : Vec (R * N * (c * h * w))) (gs : Fin R → Vec (N * nCls)) (G : Vec (R * N * nCls)) (hgs : ∀ (r : Fin R), gs r = batchShard R N nCls (fun (i : Fin (R * N * nCls)) => ↑R * G i) r) (r : Fin R) :
            mnv4HeadSyncCotIn R hR N h w W1 b1 ε1 γ1 β1 W2 b2 ε2 γ2 β2 Wd bd XIN gs r = batchShard R N (c * h * w) (fun (i : Fin (R * N * (c * h * w))) => ↑R * Mnv4TieB.mnv4HeadCotIn (R * N) h w W1 b1 ε1 γ1 β1 W2 b2 ε2 γ2 β2 Wd bd XIN G i) r
            def Proofs.MobileNetV4SyncTieB.mnv4ExtraDWSyncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (s : StableHLO.UibSpec) (xN cotN vN epsStr : String) (p : StableHLO.UibParams s) (bf16 : Bool) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) :

            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 mnv4_net_tiedB'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
              theorem Proofs.MobileNetV4SyncTieB.mnv4_extradw_syncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) (s : StableHLO.UibSpec) (hh : 0 < s.h) (xN cotN vN epsStr : String) (p : StableHLO.UibParams s) (bf16 : Bool) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (s.oc * s.h * s.h) (fun (i : Fin (R * N * (s.oc * s.h * s.h))) => ↑R * DY i) r) :
              mnv4ExtraDWSyncTiedB R hR N s xN cotN vN epsStr p bf16 XIN dys DY
              def Proofs.MobileNetV4SyncTieB.mnv4ConvNeXtSyncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (s : StableHLO.UibSpec) (xN cotN vN epsStr : String) (p : StableHLO.UibParams s) (bf16 : Bool) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) :

              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
                theorem Proofs.MobileNetV4SyncTieB.mnv4_convnext_syncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) (s : StableHLO.UibSpec) (hh : 0 < s.h) (xN cotN vN epsStr : String) (p : StableHLO.UibParams s) (bf16 : Bool) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (s.oc * s.h * s.h) (fun (i : Fin (R * N * (s.oc * s.h * s.h))) => ↑R * DY i) r) :
                mnv4ConvNeXtSyncTiedB R hR N s xN cotN vN epsStr p bf16 XIN dys DY
                def Proofs.MobileNetV4SyncTieB.mnv4FfnSyncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (s : StableHLO.UibSpec) (xN cotN vN epsStr : String) (p : StableHLO.UibParams s) (bf16 : Bool) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) :

                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
                  theorem Proofs.MobileNetV4SyncTieB.mnv4_ffn_syncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) (s : StableHLO.UibSpec) (hh : 0 < s.h) (xN cotN vN epsStr : String) (p : StableHLO.UibParams s) (bf16 : Bool) (XIN : Vec (R * N * (s.ic * s.h * s.h))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (s.oc * s.h * s.h) (fun (i : Fin (R * N * (s.oc * s.h * s.h))) => ↑R * DY i) r) :
                  mnv4FfnSyncTiedB R hR N s xN cotN vN epsStr p bf16 XIN dys DY
                  def Proofs.MobileNetV4SyncTieB.mnv4StridedSyncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (s : StableHLO.UibSpec) (xN cotN vN epsStr : String) (p : StableHLO.UibParams s) (bf16 : Bool) (XIN : Vec (R * N * (s.ic * (2 * s.h) * (2 * s.h)))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) :

                  Strided block (rows 1, 3, 11), DP-tied — its twelve emitted collectives, the strided one the post-DW weight depthwiseStridedWeightGradB (symmetric); the pre-DW and the expand at 2h.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem Proofs.MobileNetV4SyncTieB.mnv4_strided_syncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) (s : StableHLO.UibSpec) (hh : 0 < s.h) (xN cotN vN epsStr : String) (p : StableHLO.UibParams s) (bf16 : Bool) (XIN : Vec (R * N * (s.ic * (2 * s.h) * (2 * s.h)))) (dys : Fin R → Vec (N * (s.oc * s.h * s.h))) (DY : Vec (R * N * (s.oc * s.h * s.h))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (s.oc * s.h * s.h) (fun (i : Fin (R * N * (s.oc * s.h * s.h))) => ↑R * DY i) r) :
                    mnv4StridedSyncTiedB R hR N s xN cotN vN epsStr p bf16 XIN dys DY
                    def Proofs.MobileNetV4SyncTieB.mnv4StemSyncTiedB (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic oc kH kW : ℕ} (xN cotN vN epsStr : String) (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (bf16 : Bool) (X : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (DY : Vec (R * N * (oc * h * w))) :

                    Stem, DP-tied — the 3×3/s2 symmetric conv weight and its BatchNorm's γ and β.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem Proofs.MobileNetV4SyncTieB.mnv4_stem_syncTiedB (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic oc kH kW : ℕ} (hN : 0 < N) (hh : 0 < h) (hw : 0 < w) (xN cotN vN epsStr : String) (Ws : Kernel4 oc ic kH kW) (bs : Vec oc) (εs : ℝ) (γs βs : Vec oc) (bf16 : Bool) (X : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (DY : Vec (R * N * (oc * h * w))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (oc * h * w) (fun (i : Fin (R * N * (oc * h * w))) => ↑R * DY i) r) :
                      mnv4StemSyncTiedB R hR N h w xN cotN vN epsStr Ws bs εs γs βs bf16 X dys DY
                      def Proofs.MobileNetV4SyncTieB.mnv4FusedSyncTiedB (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic mid oc kH kW : ℕ} (Wc : Kernel4 mid ic kH kW) (bc : Vec mid) (εc : ℝ) (γc βc : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp : Vec oc) (εp : ℝ) (γp βp : Vec oc) (xN cotN vN epsStr : String) (bf16 : Bool) (XIN : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (DY : Vec (R * N * (oc * h * w))) :

                      Fused stage, DP-tied — its six emitted collectives: the symmetric strided conv weight f0cW, the fused BN's γ/β (through the relu mask), the project weight and the project BN's γ/β.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        theorem Proofs.MobileNetV4SyncTieB.mnv4_fused_syncTiedB (R : ℕ) (hR : 0 < R) (N h w : ℕ) {ic mid oc kH kW : ℕ} (hN : 0 < N) (hh : 0 < h) (hw : 0 < w) (Wc : Kernel4 mid ic kH kW) (bc : Vec mid) (εc : ℝ) (γc βc : Vec mid) (Wp : Kernel4 oc mid 1 1) (bp : Vec oc) (εp : ℝ) (γp βp : Vec oc) (xN cotN vN epsStr : String) (bf16 : Bool) (XIN : Vec (R * N * (ic * (2 * h) * (2 * w)))) (dys : Fin R → Vec (N * (oc * h * w))) (DY : Vec (R * N * (oc * h * w))) (hdys : ∀ (r : Fin R), dys r = batchShard R N (oc * h * w) (fun (i : Fin (R * N * (oc * h * w))) => ↑R * DY i) r) :
                        mnv4FusedSyncTiedB R hR N h w Wc bc εc γc βc Wp bp εp γp βp xN cotN vN epsStr bf16 XIN dys DY
                        def Proofs.MobileNetV4SyncTieB.mnv4HeadSyncTiedB (R : ℕ) (hR : 0 < R) (N h w : ℕ) {c mid oc nCls : ℕ} (W1 : Kernel4 mid c 1 1) (b1 : Vec mid) (ε1 : ℝ) (γ1 β1 : Vec mid) (W2 : Kernel4 oc mid 1 1) (b2 : Vec oc) (ε2 : ℝ) (γ2 β2 : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (xN cotN vN epsStr : String) (bf16 : Bool) (XIN : Vec (R * N * (c * h * w))) (gs : Fin R → Vec (N * nCls)) (G : Vec (R * N * nCls)) :

                        Head, DP-tied — all eight emitted collectives: h1W (256 → 960) and its BatchNorm's γ, β at h × w; conv_head's hW (960 → 1280) and its BatchNorm's γ, β on the pooled features at 1 × 1; the classifier's weight and bias at conv_head's relu output.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem Proofs.MobileNetV4SyncTieB.mnv4_head_syncTiedB (R : ℕ) (hR : 0 < R) (N h w : ℕ) {c mid oc nCls : ℕ} (hN : 0 < N) (hh : 0 < h) (hw : 0 < w) (W1 : Kernel4 mid c 1 1) (b1 : Vec mid) (ε1 : ℝ) (γ1 β1 : Vec mid) (W2 : Kernel4 oc mid 1 1) (b2 : Vec oc) (ε2 : ℝ) (γ2 β2 : Vec oc) (Wd : Mat oc nCls) (bd : Vec nCls) (xN cotN vN epsStr : String) (bf16 : Bool) (XIN : Vec (R * N * (c * h * w))) (gs : Fin R → Vec (N * nCls)) (G : Vec (R * N * nCls)) (hgs : ∀ (r : Fin R), gs r = batchShard R N nCls (fun (i : Fin (R * N * nCls)) => ↑R * G i) r) :
                          mnv4HeadSyncTiedB R hR N h w W1 b1 ε1 γ1 β1 W2 b2 ε2 γ2 β2 Wd bd xN cotN vN epsStr bf16 XIN gs G
                          def Proofs.MobileNetV4SyncTieB.mnv4NetSyncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) {nCls : ℕ} (xN cotN vN epsStr : String) (w : StableHLO.Mnv4BWeights nCls) (bf16 : Bool) (X : Vec (R * N * (3 * 224 * 224))) (G : Vec (R * N * nCls)) (gs : Fin R → Vec (N * nCls)) :

                          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 mnv4_net_tiedB's node at the global batch.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem Proofs.MobileNetV4SyncTieB.mnv4_net_syncTiedB (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) {nCls : ℕ} (xN cotN vN epsStr : String) (w : StableHLO.Mnv4BWeights nCls) (bf16 : Bool) (X : Vec (R * N * (3 * 224 * 224))) (G : Vec (R * N * nCls)) (gs : Fin R → Vec (N * nCls)) (hgs : ∀ (r : Fin R), gs r = batchShard R N nCls (fun (i : Fin (R * N * nCls)) => ↑R * G i) r) :
                            mnv4NetSyncTiedB R hR N xN cotN vN epsStr w bf16 X G gs

                            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 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 mnv4_net_tiedB'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 / GAP / relabel / 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 at its chain cotangent — so this and it together say every all-reduced gradient a DP render emits — mnv4in_adamdp64's at bf16 := false, mnv4in_emaaccdp8x128wxdowd005bf16's conv and depthwise collectives at true, read at the identity rounding (Bf16Erasure) — is the global-batch step's gradient node. The AdamW update that follows is not stated here, and neither are the classifier dropout (%do), EMA and gradient accumulation of mnv4in_emaaccdp8x128wxdowd005bf16. mnv4_net_syncTiedB_smoothedCE discharges the hypothesis for the label-smoothed chain the artifacts emit.

                            With per-replica BatchNorm the corresponding statement is false in general; DataParallel.dpMeanGrad_ne_globalBatchGrad is a two-replica counterexample.

                            theorem Proofs.MobileNetV4SyncTieB.mnv4_net_syncTiedB_smoothedCE (R : ℕ) (hR : 0 < R) (N : ℕ) (hN : 0 < N) {nCls : ℕ} (xN cotN vN epsStr aStr negAK bStr logN ohN : String) (α B : ℝ) (w : StableHLO.Mnv4BWeights nCls) (bf16 : Bool) (X : Vec (R * N * (3 * 224 * 224))) (T : Vec (R * N * (1 * nCls))) :
                            mnv4NetSyncTiedB R hR N xN cotN vN epsStr w bf16 X (BackLinks.unrowB (R * N) nCls (StableHLO.den (smoothedLossCotGraph (R * N) nCls α (↑R * B) aStr negAK bStr logN ohN (BackLinks.rowB (R * N) nCls (StableHLO.mobilenetv4ForwardBFull (R * N) w X)) T))) fun (r : Fin R) => BackLinks.unrowB N nCls (StableHLO.den (smoothedLossCotGraph N nCls α B aStr negAK bStr logN ohN (BackLinks.rowB N nCls (batchShard R N nCls (StableHLO.mobilenetv4ForwardBFull (R * N) w X) r)) (batchShard R N (1 * nCls) T r)))

                            …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.