Lipschitz constants for the linear softmax-CE loss #
The missing hypothesis of sgd_descends, discharged for the Chapter-1 net:
the gradient of v ↦ crossEntropy(dense(unflatten v, b, x), label) is
segment-Lipschitz with the explicit constant 2a²/(1 − 2aD) (pixels
bounded by a, step ℓ1-radius D, small-step condition 2aD < 1).
No Hessian appears. The route is the same elementary ratio argument as
FloatBridge.lean's: the loss gradient is xᵢ·(softmax(z)ⱼ − onehotⱼ)
(linear_loss_gradAt, assembled from the suite's certified
lossWeightGrad_eq_sum + pdiv_dense_W), the logits move linearly in the
parameters (dense_unflatten_drift), and FloatModel.softmax_perturb +
the γ-form FloatModel.exp_sub_one_le turn the logit drift into a gradient
drift that is linear in t along the segment — exactly the shape
descent_segment consumes.
linear_sgd_descends is the capstone: an η-accurate gradient oracle
(e.g. the float budgets), the small-step condition, and the two dominance
conditions ⇒ one inexact SGD step on the MNIST-linear classifier
provably decreases the cross-entropy loss by ≥ lr·‖∇L‖₂²/2. Every
hypothesis is checkable arithmetic; smoothness is proven, not assumed.
Closed form of the linear softmax-CE loss gradient at any parameter
point: ∂L/∂W_{ij} = xᵢ·(softmax(z)ⱼ − onehotⱼ) — the suite's
certified contraction (lossWeightGrad_eq_sum + pdiv_dense_W),
re-expressed through gradAt.
Segment-Lipschitz gradient for the linear softmax-CE loss, explicit
constant. Under the small-step condition 2aD < 1, the gradient
entries drift by at most (2a²/(1−2aD))·(t·D) along [v, v+d] — the
exact shape descent_segment consumes. The exponential softmax
perturbation is linearized by the γ-form, not the mean value theorem.
One inexact SGD step on the MNIST-linear classifier provably
decreases the cross-entropy loss. All of sgd_descends' hypotheses
discharged for the Chapter-1 net: differentiability is
lossWeightMap_differentiable, the segment-Lipschitz constant is the
explicit C = 2a²/(1−2aD) at step radius D = lr·(‖∇L‖₁ + mn·η).
Remaining hypotheses are checkable arithmetic: the oracle accuracy η
(supplied by the float budgets), the small-step condition, and the two
dominance conditions. Conclusion: the loss drops by ≥ lr·‖∇L‖₂²/2.
The binary32 gradient of the MNIST-linear loss, exactly as the
rendered trainer computes it: float forward logits z̃ = M.dense W b x,
the rounded softmax−onehot cotangent head, and one final rounded
multiply by the (exact) input xᵢ to form the outer-product weight
gradient ∂L/∂Wᵢⱼ = xᵢ·(softmax(z)ⱼ − onehotⱼ). Flattened to the
Vec (m*n) parameter layout that gradAt/linear_sgd_descends use.
Equations
- M.linearFloatGrad W b x fexp label = Proofs.Mat.flatten fun (i : Fin m) (j : Fin n) => M.mul (x i) (M.softmaxCECotF fexp (M.dense W b x) label j)
Instances For
The binary32 gradient is within mulErr u a 1 0 (cotErr …) of the
certified real gradient, per entry. The head accuracy is the existing
softmax_ce_cot_close (cotErr); the final input-multiply is one
mul_close with an exact left operand (ea = 0) bounded by a, and a
right operand softmax−onehot ∈ [−1,1] (C = 1). This is the bridge
that discharges linear_sgd_descends' abstract η.
One binary32 SGD step on the MNIST-linear classifier provably
decreases the cross-entropy loss — with NO abstract gradient-accuracy
parameter. This is Item D / G1, the η-composition: the descent side
(linear_sgd_descends) and the rounding side (FloatBridge's
cotErr/mulErr head budget) are fused into one statement. The
gradient gh is the actual float-computed gradient
(M.linearFloatGrad), and its accuracy η = mulErr u a 1 0 (cotErr …)
is proven by linear_grad_close, not assumed.
What remains as hypotheses is exactly the honest residue: the input
bound a, 0 ≤ lr, the GPU exp accuracy eexp and the a-posteriori
logit drift δ (the documented FloatModel → kernel trust boundary,
softmax_ce_cot_close), and the checkable-arithmetic small-step + two
dominance conditions. Depth-1 means there is no per-layer η-threading —
the clean pilot for the chain binary32 → proximity → smoothness → descent, closed end-to-end for one net.