Documentation

LeanMlir.Proofs.Nets.ConvNeXt.ConvNeXtStepTieGB

ConvNeXt-T's step tie at the batched index, the un-fused gradient and the smoothed loss #

ConvNeXtStepTie.lean ties all 182 parameters of the SGD-inline convnext_train_step.mlir: each fused θ − lr·g op dens to the certified step at the cotangent the emitted backward chain delivers, per example, at a hard label. This file is that statement re-pointed along three axes; unlike EfficientNet-B0's (EfficientNetStepTieG.lean, two axes), ConvNeXt's per-example capstone was at a single image with the batch outside the AST, so the index is the third.

Axis 1 — the gradient node. Every conjunct is at the raw gradient node (*GradB), which is what convnext_adam_train_step.mlir and every f32 convnextin_* artifact emit; the fused op appears only in the SGD-inline file. The optimizer update that consumes the node (AdamW, the wx/clip variants, EMA) is outside this statement. ConvNeXtFoldGB.lean is the fold each conjunct delegates to.

Precision is a flag on the statement. The bf16 artifacts (convnextin_adamwxclipdropbf16 and its EMA, data-parallel, S and B twins) emit the bf16 conv, depthwise, strided-conv and patchify weight-gradient kinds (Foundation.Bf16GradNodes). Every such node below is stated on the renderers' switch — ConvWTiedBAt bf16 / DepthwiseWTiedBAt bf16 / ConvStridedWTiedBAt bf16 (Foundation.GradNodesBAt), the stem's convStride4WeightGradBAt bf16 id … spelled inline — bf16 := false the f32 node, bf16 := true the bf16 one, and the capstone cnx_net_tiedGB takes bf16, so it reaches the bf16 artifacts' gradient nodes read over ℝ exactly as it reads the f32 ones (Bf16Erasure: at the identity rounding the bf16 kind denotes what its f32 peer does). The bias nodes, LayerNorm, layer scale and the classifier carry no flag because no render switches them. The forward graph is a different matter: ConvNeXt's typed forward graph (convNextFwdGraphTCh) is the per-example one, tied to ConvNeXtRender, which has no bf16; the batched chain the bf16 artifacts render from has no typed graph at either precision.

Axis 2 — the loss. The capstone's top-of-chain cotangent is smoothedLossCotGraphDiv's, at a GENERAL target: the six-op chain expe → softmaxDiv → subB → scaleB → addVB → shiftB → divConstB this render emits, with the target arriving as the graph input %onehot — a soft vector under mixup or cutmix. The fused file pins it to softmax − oneHot, the gradient of plain cross-entropy at a hard label, which no ImageNet artifact computes. ConvNeXt's chain runs at the plain width N·K (no 1· row index), so there is no rowB/unrowB cast anywhere here.

Axis 3 — the index. N is a binder. Every forward activation is a per-example lift of the prefix the fused file threads (cnxStemFwdO, the block forward, cnxDownFwdChO), and every cotangent a per-example lift of the chain (the block's input cotangent, cnxDownCotInChAt, ConvNeXtChainClose's cnxCotP/E/N, chanLNTensor3Back); a block's lift is the INDEXED one (batchMapIdx / batchMapAuxIdx, Foundation.Batched.Indexed), since with stochastic depth example n runs the block at its own mask entry. That lift is honest for this net and for no BatchNorm net: LayerNorm, GELU, the convolutions, layer scale and the residual add are all batch-separable, so the batched op IS the per-example op under batchMap — which is what the *B constructors' den arms say. nC is a binder too: the Imagenette artifact is nC = 10, the ImageNet ones nC = 1000.

Relation to the fused file #

Every activation, every Jacobian witness and every chain cotangent is ConvNeXtStepTie.lean's, lifted; every conjunct's proof is one CnxFoldGB.*_den lemma. The wN, bN, gN, lrStr and lr binders disappear with the fused wrapper, as they did for B0. The head takes g as a parameter where the fused cnxHeadChTied computed it from a label; the per-block ties were already loss-agnostic.

Conventions carried unchanged from the fused file: channel LayerNorm (chanLNTensor3, a Vec c affine, h·w statistics per example) at all 22 spatial sites, the head at ViT's vector LN on one row, per-channel layer scale, GELU (no kink — no smoothness hypothesis anywhere), SYMMETRIC padding at the 4×4/s4 stem and the three 2×2/s2 downsamples. Stated at the literal widths of ConvNeXt-T; S and B are other nets.

Scope. One replica: in convnextin_adamdp* every gradient node feeds allReduceMeanF; DataParallel.Node composes the per-replica statement with the replica mean.

Stochastic depth is a binder. sd : Option (Fin 18 → Vec N) is the render's drop flag: none the drop-free artifacts' chain (every family constant, the statement the drop-free one by rfl), some the *drop* artifacts' — every shipped convnextin_*bf16 artifact, the book's convnextin_adamdpwxclipdroperfbf16 among them. Block k's site (cnxSd) sits between LayerScale and the skip add (CnxTieBlk.fwdOD), so every one of the block's nine nodes, LayerScale γ's included, reads the dropped cotangent (dropPathOpt, where ConvNeXtRenderB.bwdBlockB emits dropPathB on it) and only the skip fan-in the raw one (CnxTieBlk.cotInD, ConvNeXtDropBlock). The forward saves the nodes read are the drop-free ones: the site is after them. Note: the %dgi…%dgapf GAP backward is hand-written text on both chains; its value here is globalAvgPoolFlatHasVJP.backward, as in the fused file.

Per-example internal cotangents as functions of a block's INPUT #

ConvNeXtChainClose's cnxCotE/N and chanLNTensor3Back take the saved activations as arguments; batchMapAux lifts a function of (one saved value, one input), so these recompute the activations from the block input, exactly as cnxBlockCotInChAt does.

noncomputable def Proofs.CnxTieGB.blkCotE (gf : GeluForm) {c cExp h w : ℕ} (ε : ℝ) (Wdw : DepthwiseKernel c 7 7) (bdw ng nbt : Vec c) (Wex : Kernel4 cExp c 1 1) (bex : Vec cExp) (Wpr : Kernel4 c cExp 1 1) (bpr lg : Vec c) (xin dyOut : Vec (c * h * w)) :
Vec (cExp * h * w)

Cotangent at the expand output (pre-GELU), from the block input and output cotangent.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    noncomputable def Proofs.CnxTieGB.blkCotN (gf : GeluForm) {c cExp h w : ℕ} (ε : ℝ) (Wdw : DepthwiseKernel c 7 7) (bdw ng nbt : Vec c) (Wex : Kernel4 cExp c 1 1) (bex : Vec cExp) (Wpr : Kernel4 c cExp 1 1) (bpr lg : Vec c) (xin dyOut : Vec (c * h * w)) :
    Vec (c * h * w)

    Cotangent at the channel-LN output, from the block input and output cotangent.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      noncomputable def Proofs.CnxTieGB.blkCotD (gf : GeluForm) {c cExp h w : ℕ} (ε : ℝ) (Wdw : DepthwiseKernel c 7 7) (bdw ng nbt : Vec c) (Wex : Kernel4 cExp c 1 1) (bex : Vec cExp) (Wpr : Kernel4 c cExp 1 1) (bpr lg : Vec c) (xin dyOut : Vec (c * h * w)) :
      Vec (c * h * w)

      Cotangent at the depthwise output (the channel-LN input-VJP of blkCotN).

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        noncomputable def Proofs.CnxTieGB.dnCotN {ci co h w : ℕ} (ε : ℝ) (dng dnbt : Vec ci) (Wd : Kernel4 co ci 2 2) (bd : Vec co) (xin : Vec (ci * (2 * h) * (2 * w))) (dyOut : Vec (co * h * w)) :
        Vec (ci * (2 * h) * (2 * w))

        Downsample: cotangent at the LN output, i.e. the strided conv's input-VJP.

        Equations
        Instances For
          noncomputable def Proofs.CnxTieGB.stemCotPatch {c h w : ℕ} (ε : ℝ) (Wst : Kernel4 c 3 4 4) (psb psng : Vec c) (x : Vec (3 * (2 * (2 * h)) * (2 * (2 * w)))) (dyStem : Vec (c * h * w)) :
          Vec (c * h * w)

          Stem: cotangent at the patchify output, the stem LN's input-VJP of dyStem.

          Equations
          Instances For
            noncomputable def Proofs.CnxTieGB.headCotHn {nC : ℕ} (Wfc : Mat 768 nC) (bfc : Vec nC) (hn : Vec 768) (g : Vec nC) :
            Vec (1 * 768)

            Head: the dense backward at one example's LN output and loss cotangent.

            Equations
            Instances For
              noncomputable def Proofs.CnxTieGB.cnxHeadDyXheadChN {h w nC : ℕ} (ε : ℝ) (hng hnbt : Vec 768) (Wfc : Mat 768 nC) (bfc : Vec nC) (xhead : Vec (768 * h * w)) (g : Vec nC) :
              Vec (768 * h * w)

              The cotangent at the last block output, per example, at a GENERAL class count — CnxTie.cnxHeadDyXheadCh with nC a binder (that one is at the literal 10).

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                ConvNeXt block — all 9 gradient nodes, batched #

                def Proofs.CnxTieGB.cnxBlockChTiedGB (gf : GeluForm) (N : ℕ) {c cExp h w : ℕ} (xN epsStr cotN : String) (ε : ℝ) (Wdw : DepthwiseKernel c 7 7) (bdw ng nbt : Vec c) (Wex : Kernel4 cExp c 1 1) (bex : Vec cExp) (Wpr : Kernel4 c cExp 1 1) (bpr lg : Vec c) (bf16 : Bool) (sd : Option (Vec N)) (xin dyOut : Vec (N * (c * h * w))) :

                ConvNeXt block, tied at the batched gradient nodes. All 9 params (depthwise 7×7 W+b, channel-LN γ/β at Vec c, expand/project 1×1 W+b, per-channel layer-scale γ) denote the certified Σ_n gradient at the real batched block forward and the chain cotangents driven by dyOut.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem Proofs.CnxTieGB.cnx_block_ch_tiedGB {gf : GeluForm} (N : ℕ) {c cExp h w : ℕ} (xN epsStr cotN : String) (ε : ℝ) (Wdw : DepthwiseKernel c 7 7) (bdw ng nbt : Vec c) (Wex : Kernel4 cExp c 1 1) (bex : Vec cExp) (Wpr : Kernel4 c cExp 1 1) (bpr lg : Vec c) (bf16 : Bool) (sd : Option (Vec N)) (xin dyOut : Vec (N * (c * h * w))) :
                  cnxBlockChTiedGB gf N xN epsStr cotN ε Wdw bdw ng nbt Wex bex Wpr bpr lg bf16 sd xin dyOut

                  Downsample — channel-LN → 2×2/s2 conv, all 4 gradient nodes, batched #

                  def Proofs.CnxTieGB.cnxDownChTiedGB (N : ℕ) {ci co h w : ℕ} (xN epsStr cotN : String) (ε : ℝ) (dng dnbt : Vec ci) (Wd : Kernel4 co ci 2 2) (bd : Vec co) (bf16 : Bool) (xin : Vec (N * (ci * (2 * h) * (2 * w)))) (dyOut : Vec (N * (co * h * w))) :

                  Downsample, tied at the batched gradient nodes. Channel-LN γ/β at the ci·(2h)·(2w) input grid, plus the strided conv's weight and bias.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem Proofs.CnxTieGB.cnx_down_ch_tiedGB (N : ℕ) {ci co h w : ℕ} (xN epsStr cotN : String) (ε : ℝ) (dng dnbt : Vec ci) (Wd : Kernel4 co ci 2 2) (bd : Vec co) (bf16 : Bool) (xin : Vec (N * (ci * (2 * h) * (2 * w)))) (dyOut : Vec (N * (co * h * w))) :
                    cnxDownChTiedGB N xN epsStr cotN ε dng dnbt Wd bd bf16 xin dyOut

                    Stem — 4×4/s4 patchify conv → channel-LN, all 4 gradient nodes, batched #

                    The bias grad is a pure cotangent reduce, so the render emits it as a stride-1 convBiasGradB at the OUTPUT resolution; the node carries an input it never reads (stated at zero), and the clause is at the real stride-4 stem on each example's image through GradNodeB.pdiv_flatConvStride4_bias_eq_conv2d. The weight is convStride4WeightGradB, at its gradient on both chains.

                    def Proofs.CnxTieGB.cnxStemChTiedGB (N : ℕ) {c h w : ℕ} (xN epsStr cotN : String) (ε : ℝ) (Wst : Kernel4 c 3 4 4) (psb psng psnbt : Vec c) (bf16 : Bool) (x : Vec (N * (3 * (2 * (2 * h)) * (2 * (2 * w))))) (dyStem : Vec (N * (c * h * w))) :

                    Stem, tied at the batched gradient nodes. Channel-LN γ/β, the conv bias, the conv weight.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      theorem Proofs.CnxTieGB.cnx_stem_ch_tiedGB (N : ℕ) {c h w : ℕ} (xN epsStr cotN : String) (ε : ℝ) (Wst : Kernel4 c 3 4 4) (psb psng psnbt : Vec c) (bf16 : Bool) (x : Vec (N * (3 * (2 * (2 * h)) * (2 * (2 * w))))) (dyStem : Vec (N * (c * h * w))) :
                      cnxStemChTiedGB N xN epsStr cotN ε Wst psb psng psnbt bf16 x dyStem

                      Head — GAP → vector-LN at one row → dense, all 4 gradient nodes, batched #

                      Stated at the LITERAL 768 for the fused file's reason: 1 * m does not reduce at a variable m. g is a PARAMETER — the loss cotangent arrives from smoothedLossCotGraphDiv in the capstone.

                      def Proofs.CnxTieGB.cnxHeadChTiedGB (N : ℕ) {h w nC : ℕ} (xN epsStr cotN dN : String) (ε : ℝ) (hng hnbt : Vec 768) (Wfc : Mat 768 nC) (bfc : Vec nC) (xhead : Vec (N * (768 * h * w))) (g : Vec (N * nC)) :

                      Head, tied at the batched gradient nodes. The head-LN γ/β at the pooled row, the classifier weight at the LN output, and the classifier bias summed over the batch (GradNodeB.headBGradB_den).

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        theorem Proofs.CnxTieGB.cnx_head_ch_tiedGB (N : ℕ) {h w nC : ℕ} (xN epsStr cotN dN : String) (ε : ℝ) (hng hnbt : Vec 768) (Wfc : Mat 768 nC) (bfc : Vec nC) (xhead : Vec (N * (768 * h * w))) (g : Vec (N * nC)) :
                        cnxHeadChTiedGB N xN epsStr cotN dN ε hng hnbt Wfc bfc xhead g

                        The stem wrapper — @[irreducible] #

                        Without it the capstone's refine ⟨cnx_stem_ch_tiedGBAt …, ?_, …⟩ times out in whnf at the default budget. The block, downsample and head ties need no wrapper: the capstone names cnxBlockChTiedGB / cnxDownChTiedGB / cnxHeadChTiedGB directly.

                        @[irreducible]
                        def Proofs.CnxTieGB.cnxStemChTiedGBAt (N : ℕ) {c h w : ℕ} (xN epsStr cotN : String) (ε : ℝ) (Wst : Kernel4 c 3 4 4) (psb psng psnbt : Vec c) (bf16 : Bool) (x : Vec (N * (3 * (2 * (2 * h)) * (2 * (2 * w))))) (dyStem : Vec (N * (c * h * w))) :
                        Equations
                        Instances For

                          Every cotangent the capstone threads is a certified VJP backward #

                          The capstone below threads three per-example constructors: the head's cnxHeadDyXheadChN, each block's cotInD at its site and each downsample's cnxDownCotInChAt. Per example, each is the backward of its stage's certified VJP (CnxTieBlk.fwdODHasVJP, cnxDownChWHasVJP, and cnxHeadHasVJP below); lifted by batchMapAux_eq_batchMapHasVJPAt (the block's by batchMapAuxIdx_eq_batchMapIdxHasVJPAt), the batched cotangent is the backward of the lifted stage. ConvNeXt has no kink, so the only hypothesis is the LayerNorm's 0 < ε.

                          theorem Proofs.CnxTieGB.cnxDownCotInChAt_eq_vjp {ci co h w : ℕ} (ε : ℝ) (hε : 0 < ε) (dng dnbt : Vec ci) (Wd : Kernel4 co ci 2 2) (bd : Vec co) (xin : Vec (ci * (2 * h) * (2 * w))) (dyOut : Vec (co * h * w)) :
                          CnxTie.cnxDownCotInChAt ε dng dnbt Wd bd xin dyOut = (cnxDownChWHasVJP h w { ε := ε, γ := dng, β := dnbt, W := Wd, b := bd } hε).backward xin dyOut

                          A downsample's input cotangent is its certified VJP's backward. One rewrite: chanLNTensor3Back is the channel-LN VJP's backward.

                          noncomputable def Proofs.CnxTieGB.cnxHeadHasVJP (h w : ℕ) {nC : ℕ} (ε : ℝ) (hε : 0 < ε) (hng hnbt : Vec 768) (Wfc : Mat 768 nC) (bfc : Vec nC) :
                          HasVJP (dense Wfc bfc ∘ rowLNVecFlat 1 768 ε hng hnbt ∘ globalAvgPoolFlat 768 h w)

                          The head dense ∘ head LN ∘ GAP as one certified VJP, at any class count.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem Proofs.CnxTieGB.cnxHeadDyXheadChN_eq_vjp {h w nC : ℕ} (ε : ℝ) (hε : 0 < ε) (hng hnbt : Vec 768) (Wfc : Mat 768 nC) (bfc : Vec nC) (xhead : Vec (768 * h * w)) (g : Vec nC) :
                            cnxHeadDyXheadChN ε hng hnbt Wfc bfc xhead g = (cnxHeadHasVJP h w ε hε hng hnbt Wfc bfc).backward xhead g

                            The head's input cotangent — the last block's dyOut — is its certified VJP's backward, at any loss cotangent g.

                            theorem Proofs.CnxTieGB.cnxBlockCotInB_eq_vjp {gf : GeluForm} (N : ℕ) {c cExp h w : ℕ} (ε : ℝ) (hε : 0 < ε) (p : CnxTie.CnxTieBlk c cExp) (sd : Option (Vec N)) (xin : Vec (N * (c * h * w))) :
                            StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf p ε (exampleSite sd n)) xin = (batchMapIdxHasVJPAt (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf p ε (exampleSite sd n)) xin (fun (n : Fin N) => (CnxTie.CnxTieBlk.fwdODHasVJP gf p ε hε (exampleSite sd n)).toHasVJPAt (Mat.unflatten xin n)) ⋯).backward

                            Batched: a block's cotangent at its drop site is the lifted block VJP's backward. Example n runs the block at its own mask entry, so the lift is the indexed one; cotInD_eq_vjp per example. At none it is the drop-free block's (cotInD_none, fwdOD_none).

                            theorem Proofs.CnxTieGB.cnxDownCotInB_eq_vjp (N : ℕ) {ci co h w : ℕ} (ε : ℝ) (hε : 0 < ε) (dng dnbt : Vec ci) (Wd : Kernel4 co ci 2 2) (bd : Vec co) (xin : Vec (N * (ci * (2 * h) * (2 * w)))) :
                            StableHLO.batchMapAux N (CnxTie.cnxDownCotInChAt ε dng dnbt Wd bd) xin = (batchMapHasVJPAt (cnxDownChW h w { ε := ε, γ := dng, β := dnbt, W := Wd, b := bd }) xin (fun (x : Fin N) => (cnxDownChWHasVJP h w { ε := ε, γ := dng, β := dnbt, W := Wd, b := bd } hε).toHasVJPAt (Mat.unflatten xin x)) ⋯).backward

                            Batched: a downsample's batchMapAux cotangent is the lifted downsample VJP's backward.

                            theorem Proofs.CnxTieGB.cnxHeadDyB_eq_vjp (N : ℕ) {h w nC : ℕ} (ε : ℝ) (hε : 0 < ε) (hng hnbt : Vec 768) (Wfc : Mat 768 nC) (bfc : Vec nC) (xhead : Vec (N * (768 * h * w))) :
                            StableHLO.batchMapAux N (cnxHeadDyXheadChN ε hng hnbt Wfc bfc) xhead = (batchMapHasVJPAt (dense Wfc bfc ∘ rowLNVecFlat 1 768 ε hng hnbt ∘ globalAvgPoolFlat 768 h w) xhead (fun (x : Fin N) => (cnxHeadHasVJP h w ε hε hng hnbt Wfc bfc).toHasVJPAt (Mat.unflatten xhead x)) ⋯).backward

                            Batched: the head's batchMapAux cotangent is the lifted head VJP's backward.

                            The whole-net capstone — all 182 params through the REAL batched forward + composed cotangent #

                            The fused file's thread, lifted: block inputs are per-example lifts of the forward prefixes (a block at its site, batchMapIdx), and the backward cotangents lifts of the per-example chain, composed from the smoothed loss g down through the head, every block's backward with the residual fan-in + dyOut at each of the eighteen identity-skip merges, the channel-LN-back at each of the three downsamples, and the stem LN's own back before the patchify conv's gradients.

                            def Proofs.CnxTieGB.cnxSd {N : ℕ} (sd : Option (Fin 18 → Vec N)) (k : Fin 18) :

                            Block k's stochastic-depth masks (of the eighteen, in render order; the downsamples carry none), when the render carries stochastic depth.

                            Equations
                            Instances For
                              @[simp]
                              theorem Proofs.CnxTieGB.cnxSd_none {N : ℕ} (k : Fin 18) :
                              @[reducible, inline]
                              abbrev Proofs.CnxTie.CnxTieBlk.TiedGB (gf : GeluForm) {c cExp h w : ℕ} (p : CnxTieBlk c cExp) (N : ℕ) (xN epsStr cotN : String) (ε : ℝ) (bf16 : Bool) (sd : Option (Vec N)) (xin dyOut : Vec (N * (c * h * w))) :

                              The block's batched tie (cnxBlockChTiedGB), over its CnxTieBlk record.

                              Equations
                              Instances For
                                theorem Proofs.CnxTie.CnxTieBlk.tied_gb {gf : GeluForm} {c cExp h w : ℕ} (p : CnxTieBlk c cExp) (N : ℕ) (xN epsStr cotN : String) (ε : ℝ) (bf16 : Bool) (sd : Option (Vec N)) (xin dyOut : Vec (N * (c * h * w))) :
                                TiedGB gf p N xN epsStr cotN ε bf16 sd xin dyOut
                                @[reducible, inline]
                                abbrev Proofs.CnxTie.CnxTieDown.TiedGB {ci co h w : ℕ} (p : CnxTieDown ci co) (N : ℕ) (xN epsStr cotN : String) (ε : ℝ) (bf16 : Bool) (xin : Vec (N * (ci * (2 * h) * (2 * w)))) (dyOut : Vec (N * (co * h * w))) :

                                The downsample's batched tie (cnxDownChTiedGB), over its CnxTieDown record.

                                Equations
                                Instances For
                                  theorem Proofs.CnxTie.CnxTieDown.tied_gb {ci co h w : ℕ} (p : CnxTieDown ci co) (N : ℕ) (xN epsStr cotN : String) (ε : ℝ) (bf16 : Bool) (xin : Vec (N * (ci * (2 * h) * (2 * w)))) (dyOut : Vec (N * (co * h * w))) :
                                  p.TiedGB N xN epsStr cotN ε bf16 xin dyOut
                                  theorem Proofs.CnxTieGB.cnx_net_tiedGB {gf : GeluForm} (N : ℕ) {nC : ℕ} (xN epsStr cotN dN aStr negAK bStr logN ohN : String) (ε α B : ℝ) (w : CnxTie.CnxTieWeights nC) (bf16 : Bool) (sd : Option (Fin 18 → Vec N)) (x : Vec (N * (3 * 224 * 224))) (t : Vec (N * nC)) :
                                  have ib1 := StableHLO.batchMap N (CnxTie.cnxStemFwdO ε w.sW w.sb w.sγ w.sβ) x; have ib2 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b1 ε (exampleSite (cnxSd sd 0) n)) ib1; have ib3 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b2 ε (exampleSite (cnxSd sd 1) n)) ib2; have ibD0 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b3 ε (exampleSite (cnxSd sd 2) n)) ib3; have ib4 := StableHLO.batchMap N (w.d0.fwdO ε) ibD0; have ib5 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b4 ε (exampleSite (cnxSd sd 3) n)) ib4; have ib6 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b5 ε (exampleSite (cnxSd sd 4) n)) ib5; have ibD1 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b6 ε (exampleSite (cnxSd sd 5) n)) ib6; have ib7 := StableHLO.batchMap N (w.d1.fwdO ε) ibD1; have ib8 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b7 ε (exampleSite (cnxSd sd 6) n)) ib7; have ib9 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b8 ε (exampleSite (cnxSd sd 7) n)) ib8; have ib10 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b9 ε (exampleSite (cnxSd sd 8) n)) ib9; have ib11 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b10 ε (exampleSite (cnxSd sd 9) n)) ib10; have ib12 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b11 ε (exampleSite (cnxSd sd 10) n)) ib11; have ib13 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b12 ε (exampleSite (cnxSd sd 11) n)) ib12; have ib14 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b13 ε (exampleSite (cnxSd sd 12) n)) ib13; have ib15 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b14 ε (exampleSite (cnxSd sd 13) n)) ib14; have ibD2 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b15 ε (exampleSite (cnxSd sd 14) n)) ib15; have ib16 := StableHLO.batchMap N (w.d2.fwdO ε) ibD2; have ib17 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b16 ε (exampleSite (cnxSd sd 15) n)) ib16; have ib18 := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b17 ε (exampleSite (cnxSd sd 16) n)) ib17; have xhead := StableHLO.batchMapIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.fwdOD gf w.b18 ε (exampleSite (cnxSd sd 17) n)) ib18; have gapB := StableHLO.batchMap N (globalAvgPoolFlat 768 7 7) xhead; have hnB := StableHLO.batchMap N (rowLNVecFlat 1 768 ε w.hG w.hT) gapB; have logitsB := StableHLO.batchMap N (dense w.Wfc w.bfc) hnB; have g := StableHLO.den (smoothedLossCotGraphDiv N nC α B aStr negAK bStr logN ohN logitsB t); have dyO18 := StableHLO.batchMapAux N (cnxHeadDyXheadChN ε w.hG w.hT w.Wfc w.bfc) xhead g; have dyO17 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b18 ε (exampleSite (cnxSd sd 17) n)) ib18 dyO18; have dyO16 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b17 ε (exampleSite (cnxSd sd 16) n)) ib17 dyO17; have dyD2 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b16 ε (exampleSite (cnxSd sd 15) n)) ib16 dyO16; have dyO15 := StableHLO.batchMapAux N (w.d2.cotIn ε) ibD2 dyD2; have dyO14 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b15 ε (exampleSite (cnxSd sd 14) n)) ib15 dyO15; have dyO13 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b14 ε (exampleSite (cnxSd sd 13) n)) ib14 dyO14; have dyO12 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b13 ε (exampleSite (cnxSd sd 12) n)) ib13 dyO13; have dyO11 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b12 ε (exampleSite (cnxSd sd 11) n)) ib12 dyO12; have dyO10 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b11 ε (exampleSite (cnxSd sd 10) n)) ib11 dyO11; have dyO9 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b10 ε (exampleSite (cnxSd sd 9) n)) ib10 dyO10; have dyO8 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b9 ε (exampleSite (cnxSd sd 8) n)) ib9 dyO9; have dyO7 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b8 ε (exampleSite (cnxSd sd 7) n)) ib8 dyO8; have dyD1 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b7 ε (exampleSite (cnxSd sd 6) n)) ib7 dyO7; have dyO6 := StableHLO.batchMapAux N (w.d1.cotIn ε) ibD1 dyD1; have dyO5 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b6 ε (exampleSite (cnxSd sd 5) n)) ib6 dyO6; have dyO4 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b5 ε (exampleSite (cnxSd sd 4) n)) ib5 dyO5; have dyD0 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b4 ε (exampleSite (cnxSd sd 3) n)) ib4 dyO4; have dyO3 := StableHLO.batchMapAux N (w.d0.cotIn ε) ibD0 dyD0; have dyO2 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b3 ε (exampleSite (cnxSd sd 2) n)) ib3 dyO3; have dyO1 := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b2 ε (exampleSite (cnxSd sd 1) n)) ib2 dyO2; have dyStem := StableHLO.batchMapAuxIdx N (fun (n : Fin N) => CnxTie.CnxTieBlk.cotInD gf w.b1 ε (exampleSite (cnxSd sd 0) n)) ib1 dyO1; cnxStemChTiedGBAt N xN epsStr cotN ε w.sW w.sb w.sγ w.sβ bf16 x dyStem ∧ CnxTie.CnxTieBlk.TiedGB gf w.b1 N xN epsStr cotN ε bf16 (cnxSd sd 0) ib1 dyO1 ∧ ⋯ ∧ ⋯

                                  The whole [3,3,9,3] ConvNeXt-T train step, tied at the batched index, the gradient nodes and the smoothed loss. Threading the real channel-LN / per-channel layer-scale forward as per-example lifts of the prefixes, and the label-smoothed loss cotangent (smoothedLossCotGraphDiv, at a general target t) down through the head and every block's cotangent chain as the lift of the per-example chain — each the backward of its stage's lifted certified VJP (cnxHeadDyB_eq_vjp, cnxBlockCotInB_eq_vjp, cnxDownCotInB_eq_vjp) — GELU masks, the residual fan-in at every identity skip, the channel-LN-back at every downsample and at the stem — the 18 ConvNeXt blocks, the 3 downsamples, the 4×4/s4 stem with its LN and the GAP → LN → dense head all denote the certified batched Σ_n gradient. All 182 parameters, at the gradient nodes convnext_adam_train_step.mlir and every convnextin_* train step emit — bf16 selects the conv, depthwise, strided-conv and patchify weight nodes' kind, false the f32 artifacts', true the *bf16 ones', read over ℝ at the identity rounding (Bf16Erasure); the right-hand side is the same certified gradient at either value.

                                  N and nC are binders and there is no smoothness hypothesis: the folds are ∀ cot statements instantiated at explicitly constructed cotangents, and ConvNeXt has no kink. The batch enters only through the per-example lifts, because no ConvNeXt op couples examples. The statement is at one replica: in convnextin_adamdp* every gradient node feeds allReduceMeanF, and DataParallel.Node composes the per-replica statement with the replica mean. sd is stochastic depth: none the drop-free artifacts' chain, some the *drop* artifacts' — convnextin_adamdpwxclipdroperfbf16's, the book's run — each block's nodes at the dropped cotangent and its skip at the raw one, so the book's ConvNeXt job is reached at every gradient node.