⭐⭐ mnv2InputGradB IS the certified whole-net MobileNetV2 gradient AT BATCH BATCH-NORM #
The per-example seventeen-bottleneck tie (retired 2026-09-19 with MobileNetV2PaperWholeBackCertifiedTie.lean)
closed this for the forward the retired MobileNetV2Render.lean emitted. This file closes it for
the net the shipped trainers run: mobilenetv2ForwardB_full, the same [t,c,n,s] ladder at
bnBatchLA, at a variable batch N. It is tier T6 of
planning/archive/proofs_tier_to_paper_nets.md §4.2, alongside ResNet34BackCertifiedTieB.lean.
⭐⭐ One apex, every stage opaque #
mobilenetv2PaperPC_has_vjp_at (below; it moved here from the retired per-example tie, whose apex
it was) is a twenty-one-stage chain generic in every dimension and in every stage, so the batched
net instantiates it directly: stem at mnv2StemB, the seventeen bottlenecks at the batched
block maps, and the head's three stages at cbrB / batchMap gap / batchMap dense.
opaqueA0 … A17 are OpaquePrefix.lean's. So this file defines no prefix defs —
where ResNet-34's peer had to, because its committed apex bundles the stem's pool into stem and
its head into one stage.
The three pieces #
mnv2StemBBack_eq_vjp_backwardandcbrBBack_eq_vjp_backward— the two concrete conv-BN-relu6 endpoints, onerwof a conv leaf tie and thenrfleach. ⚠ The stem's is the XLA-SAMEleaf (flatConvStride2XlaBack) and the head's the plain one; that is the one convention this net and ResNet-34 do not share.mnv2InputGradB_eq_mobilenetv2B_full_vjpandmnv2InputGradB_correct— the tie, and its reading as∑ pdiv … * dy: the chain IS the Jacobian-transpose of the twenty-one-stage composition, at every batch size.mobilenetv2ForwardB_full_eq_slots— the shape check: those twenty-one stages AREmobilenetv2ForwardB_full, the forwardmobilenetv2FwdGraphB_full_faithful(4.2b) says the typed graph denotes. Without it the tie would be a statement about variables.
⛔ Why the blocks stay opaque, measured on ResNet-34's peer. Instantiating a tie of this shape
at the concrete blocks is a kernel deterministic timeout: the block witnesses are HasVJPAt at
opaqueA{k-1} … x and a caller's are at mnv2PreB{k-1} N w x, which is seventeen defeq
checks between seventeen-deep nested applications spelled through different definition chains.
B0's file takes that step only because swish has no kink, so its witnesses are GLOBAL HasVJP
and carry no point at all. The shape check is what replaces it, and it is the same answer the
per-example file gave.
⚠ It stays a SMOOTH-POINT statement: relu6 is kinked on BOTH sides, so each of the 35 sites
carries ≠ 0 ∧ ≠ 6. ⛔ MobileNetV2's two clauses per block are the expand relu6 and the
depthwise relu6, both INSIDE the body — not ResNet-34's mid-relu and post-residual outer relu.
Those are 4.2b's bundles, reused verbatim; this file adds no hypothesis of its own.
⛔ What this does NOT reach. Every gradient node in mobilenetv2in_rmsdp64 is followed by an
all-reduce emitted as text outside the AST, so this is at the per-replica gradient (§4d). And it
is about the INPUT gradient; the parameter gradients are MobileNetV2StepTieB.lean's tie (§4.2c).
The whole-network MobileNetV2 VJP at opaque stages (moved here 2026-09-19 from the retired per-example tie, whose apex it was). dns ∘ gap ∘ head ∘ b17 ∘ … ∘ b1 ∘ stem. Twenty vjp_comp_diff_ats and nothing else:
MobileNetV2's skips live INSIDE the block maps and its strides inside the strided bodies, so
there is no ChainData list and no separate downsample slot at any depth. Dimension-generic
and parametric in every component.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The STEM tie. batchMap (flatConvStride2XlaBack) ∘ bnBack ∘ reluMaskBack IS mnv2StemB's
certified backward at a smooth point. One rw of the odd-kernel XLA-SAME strided leaf tie,
then rfl — the stage's VJP is vjp_comp_at-built so its backward is already the
composition, and a convolution's backward ignores its primal argument, so the row-wise
batchMap lift matches at every saved input.
The HEAD's conv-BN-relu6 tie. batchMap (convFlatBack) ∘ bnBack ∘ reluMaskBack IS
cbrB's certified backward at a smooth point — the stride-1 peer of the stem's, at the plain
(non-XLA) convolution leaf. ⚠ MobileNetV2's head is NOT hypothesis-free, unlike ResNet-34's:
it puts this relu6 in front of the pool, so the net's 35th kink site is here.
⭐⭐ mnv2InputGradB IS the certified whole-net batch-BN MobileNetV2 gradient. The
committed backward chain, with its two BatchNorm and two relu6-mask slots filled by the
certified per-op backwards and its seventeen bottlenecks left OPAQUE, equals the backward of
mobilenetv2PaperPC_has_vjp_at at those twenty-one stages. unfold, three rws, rfl.
⭐⭐ The batched chain IS the pdiv-contracted Jacobian of the twenty-one-stage net — at
every batch size, every input, every loss cotangent and every input pixel. The tie above read
through the apex's own .correct; mobilenetv2ForwardB_full_eq_slots below is what says
those twenty-one stages are the committed forward.
⭐⭐ THE SHAPE CHECK — the twenty-one slots the tie is about ARE the committed forward.
mobilenetv2ForwardB_full, regrouped into exactly the twenty-one arguments
mobilenetv2PaperPC_has_vjp_at takes: the XLA-SAME stem, b1 the t = 1 bottleneck,
b3/b5/b6/b8/b9/b10/b12/b13/b15/b16 the bodies under the identity skip, b2/b4/b7/b14 the
stride-2 downsamplers, b11/b17 the stride-1 bodies whose channels change, and the head's
three stages.
⛔ This is the theorem that would have caught ResNet-34's wrong pool (§3.10) — the tie
keeps its blocks opaque, so its subject is a chain of VARIABLES and nothing in it says which
net they are. It goes through mobilenetv2ForwardB_full_eq_chain (4.2b) for the depth-17 half
and then unfolds the named prefixes and the head.