EfficientNet-B0 block backward graphs — the residual and squeeze-excite fan-ins #
Backward StableHLO graphs for B0's MBConv blocks and the theorems that they denote the proven
VJPs. B0 has two branching ops the dense-chain nets do not: the residual skip (additive fan-in)
and the squeeze-excite gate (multiplicative fan-in). SHlo's backward constructors are unary, but
both fan-ins are spelled with forward elementwise combinators: addV for the residual, and
layerScaleF (Hadamard by a known activation) + addV for the SE gate.
Contents #
- SE:
seBlockBackGraph, the generic multiplicative fan-in; bnBack_faithful_fn, the function-level BatchNorm backward bridge;- batched capstones:
mbBodyBackBatchedGraph(stride-1 body),mbDownBodyBackBatchedGraph(strided depthwise, no residual) andmbResidBlockBackBatchedGraph(body + skip).
Each …_faithful states den (graph) = the certified backward.
Backward graph for an SE block x ↦ x ⊙ gate x, given a subgraph
gateBack rendering the gate sub-network's input-cotangent at the
SE-specific cotangent x ⊙ dy. The main (identity) path contributes
gate x ⊙ dy, rendered as a Hadamard (layerScaleF) of the cotangent
by the gate activation; addV sums the two paths. The renderable image
of seBlockHasVJP's elemwiseProduct (bi-cotangent) backward.
Equations
- Proofs.StableHLO.seBlockBackGraph gateBack gateVal dy = (Proofs.StableHLO.SHlo.layerScaleF "%segate" gateVal (Proofs.StableHLO.SHlo.operand "%dy" dy)).addV gateBack
Instances For
SE multiplicative fan-in backward faithfulness (general).
If gateBack denotes the gate path's VJP backward at the cotangent
x ⊙ dy (den gateBack = hg.backward x (x ⊙ dy)), then the SE backward
graph denotes the proven seBlockHasVJP backward, which is
gate x ⊙ dy + gate.backward x (x ⊙ dy). Like the residual brick the
proof is structural — the composition is delegated to gateBack, so the
only definitional facts are layerScaleF/addV denotation and the
identity main-path backward.
Function-level BatchNorm backward bridge. bnBack denotes bnGradInput,
which is NOT rfl-equal to (bnHasVJP …).backward (the witness is built via
a rw [bnForward_eq_compose] cast). They agree through the canonical VJP sum:
bnBack_faithful gives the ∑ pdiv form and bnHasVJP.correct matches it.
This lemma is the one non-rfl bridge the bn-containing stages need.
The batched MBConv body backward graph: the four stage graphs chained at their
cumulative forward activations (cbsB⁻¹ ∘ dwbsB⁻¹ ∘ seB⁻¹ ∘ projB⁻¹).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The batched downsample MBConv body backward graph: the four stage graphs chained
at their cumulative forward activations (cbsB⁻¹ ∘ dwbsSXlaB⁻¹ ∘ seB⁻¹ ∘ projB⁻¹).
Stride-2 analogue of mbBodyBackBatchedGraph (strided depthwise stage graph).
Equations
- One or more equations did not get rendered due to their size.
Instances For
CAPSTONE — the batched EfficientNet DOWNSAMPLE MBConv body: backward graph ↔
the proven mbStridedFwdBHasVJP. The four batched stage backward graphs
(cbsB/dwbsSXlaB/seB/projB) chained at their forward activations, proven
equal to the downsample-body VJP. The stride-2 analogue of
mbBodyBackBatchedGraph_faithful (no residual skip — the downsample block
changes spatial/channels, so the body alone is the block). EfficientNet uses
swish (a global VJP), so this stays in the clean global HasVJP/vjpComp
form (no _at recompute, unlike r34/mnv2's relu blocks).
The whole batched MBConv residual block backward graph (body + identity skip).
Equations
- One or more equations did not get rendered due to their size.
Instances For
CAPSTONE — the whole batched EfficientNet MBConv residual block: backward
graph ↔ the proven mbResidFwdBHasVJP. The four batched stage backward
graphs (cbsB/dwbsB/seB/projB) chained at their forward activations +
the identity skip, proven equal to the repo's batched MBConv block VJP.