Post-Norm Decoder Core #
This module builds a decoder-core SSA graph with a fixed additive score bias and proves its VJP
theorem (decoderCore_backpropVec_eq_adjoint_fderiv_at). Map-level composition uses
twoSublayerPostNormBlock_hasFDerivAt from PostNorm.lean.
The concrete graph starts with already projected head tensors. Its merge and FFN affine maps are fixed arguments, not trainable entries in the differentiated context. The score bias is finite real data; it does not implement Boolean hard or causal masking. These are exact-real derivative theorems, not a correspondence theorem for the executable decoder or LibTorch.
The map-level composition theorem accepts differentiable residual-pack maps. The attention
composition theorem in NN.Proofs.Autograd.Tape.Ops.Attention.MaskedMultiHeadSelfAttention
can supply such a map when the caller provides the projection and merge derivative certificates.
It does not construct a full decoder from a token/parameter context automatically.
Concrete fixed-bias decoder-core SSA graph #
The concrete graph below starts after the Q/K/V projection split:
[Q_heads, Kᵀ_heads, V_heads, residual_stream, gamma₁, beta₁, gamma₂, beta₂].
It then adds the fixed bias to the scaled attention scores, merges the head output through a supplied affine map, adds the residual stream, and applies the two post-norm sublayers.
Concrete decoder-core context: head tensors, residual stream, and two LayerNorm parameter pairs.
Instances For
Saved tensors for the concrete fixed-bias decoder-core block.
Instances For
Residual-stream input in the decoder-core context.
Instances For
First LayerNorm scale parameter in the decoder-core context.
Instances For
First LayerNorm shift parameter in the decoder-core context.
Instances For
Second LayerNorm scale parameter in the decoder-core context.
Instances For
Second LayerNorm shift parameter in the decoder-core context.
Instances For
Fixed-bias attention core while carrying residual and LayerNorm parameters.
Instances For
Head output after the fixed-bias attention core.
Instances For
Merged attention output after the supplied output projection.
Instances For
Residual input weakened past the merged attention output.
Instances For
Sum of the residual stream and projected attention output before the first LayerNorm.
Instances For
First LayerNorm input triple for the concrete decoder-core graph.
Instances For
Decoder graph through the first post-norm attention sublayer.
Instances For
First decoder post-norm output.
Instances For
First decoder post-norm output weakened through FFN intermediates.
Instances For
First FFN affine output in the concrete decoder graph.
Instances For
FFN activation output in the concrete decoder graph.
Instances For
FFN projection output in the concrete decoder graph.
Instances For
FFN residual output before the second decoder LayerNorm.
Instances For
Decoder graph through the FFN residual.
Instances For
Second LayerNorm input triple for the concrete decoder-core graph.
Instances For
Concrete SSA graph for one additive-bias decoder-core block.
Instances For
Pointwise analytic correctness for the decoder graph through the FFN residual.
Instances For
Pointwise analytic correctness for the complete concrete decoder-core graph.
Instances For
End-to-end VJP theorem for the concrete additive-bias decoder-core graph.