Rounded Optimizer Steps for NF #
Concrete instances of RuntimeApprox.Optimizer.NumericalStepContract for TorchLean's rounded
NF runtime. These proofs use the same tensor equations as the public optimizers and the shared
elementwise error transformers; there is no second optimizer implementation in the proof layer.
The first contracts cover SGD and momentum SGD. They already compose with the generic
NumericalStepContract.run_approx theorem over arbitrary finite gradient streams and arbitrary
tensor ranks. Adaptive optimizers build on the positive-division and square-root rules and are kept
in this module so all optimizer numerical contracts share one public home.
The Adam recurrence follows Kingma and Ba, Adam: A Method for Stochastic Optimization, ICLR 2015 (https://arxiv.org/abs/1412.6980). The decoupled decay term follows Loshchilov and Hutter, Decoupled Weight Decay Regularization, ICLR 2019 (https://arxiv.org/abs/1711.05101).
SGD #
Error in the runtime learning-rate scalar stored by SGD.
Instances For
Exact/runtime relation for SGD state.
Instances For
Parameter error after one SGD update, computed from the actual runtime tensors.
Instances For
Numerical refinement contract for TorchLean's plain SGD update.
Instances For
One actual TorchLean SGD parameter update refines its exact-real counterpart.
Momentum SGD #
Exact/runtime relation for momentum SGD state.
Instances For
State and parameter bounds for one momentum-SGD update.
Instances For
Numerical refinement contract for momentum SGD with arbitrary-rank parameter tensors.
Instances For
One public momentum-SGD update refines its exact-real counterpart.
This named corollary exposes the useful one-step statement without duplicating its proof; the
generic momentumSGDContract.updateApprox field remains the source used for finite runs and
graph-level composition.
AdamW #
Error budgets relating exact and rounded AdamW state.
- learningRate : ℝ
Error in the stored learning rate.
- beta1 : ℝ
Error in the first-moment decay coefficient.
- beta2 : ℝ
Error in the second-moment decay coefficient.
- epsilon : ℝ
Error in the denominator stabilizer.
- weightDecay : ℝ
Error in the decoupled weight-decay coefficient.
- firstMoment : ℝ
Infinity-norm error in the first-moment tensor.
- secondMoment : ℝ
Infinity-norm error in the second-moment tensor.
Instances For
Exact/runtime relation for the persistent AdamW state.
Instances For
Errors for scalar expressions derived inside one AdamW step.
They are kept separate from persistent state errors because subtraction, powers, reciprocal, and
the product lr * weightDecay each round in the runtime scalar model.
- oneMinusBeta1 : ℝ
Error in the rounded scalar expression
1 - beta1. - oneMinusBeta2 : ℝ
Error in the rounded scalar expression
1 - beta2. - firstMomentBiasInverse : ℝ
Error in the reciprocal first-moment bias correction.
- secondMomentBiasInverse : ℝ
Error in the reciprocal second-moment bias correction.
- decayScale : ℝ
Error in the rounded product
lr * weightDecay.
Instances For
Composed errors for the intermediate tensors in one AdamW step.
- squaredGradient : ℝ
Error after squaring the gradient.
- firstMoment : ℝ
Error after updating the first moment.
- secondMoment : ℝ
Error after updating the second moment.
- correctedFirstMoment : ℝ
Error after first-moment bias correction.
- correctedSecondMoment : ℝ
Error after second-moment bias correction.
- standardDeviation : ℝ
Error after square root of the corrected second moment.
- denominator : ℝ
Error after adding epsilon to the square-root denominator.
- adaptiveLearningRate : ℝ
Error in the elementwise adaptive learning rate.
- adaptiveUpdate : ℝ
Error in the Adam update before subtraction from parameters.
- decayUpdate : ℝ
Error in the decoupled weight-decay update.
- decayedParameters : ℝ
Error after applying decoupled weight decay.
- parameterError : ℝ
Final parameter error after the full AdamW step.
Instances For
Compute AdamW's complete one-step error trace from runtime values and scalar subexpression budgets. The reduction to one infinity-norm number per tensor keeps the trace independent of rank.
Instances For
One AdamW update is numerically sound on a certified positive second-moment domain.
The hypotheses for the derived scalar expressions expose rounding in 1-β, bias correction, and
the decoupled decay coefficient. η keeps sqrt(vHat) away from its singular derivative at zero;
the two margin hypotheses ensure the rounded second moment and final denominator remain positive.
AdamW contract instance #
Numerical assumptions and positivity margin for one AdamW update.
- derivedErrors : AdamWDerivedErrors
Bounds for rounded scalar subexpressions used by bias correction and decay.
- minimumSecondMoment : ℝ
Strict lower bound on the exact bias-corrected second moment.
Instances For
Complete validity predicate for one AdamW contract application.
Instances For
State and parameter error object produced by one AdamW contract step.
Instances For
AdamW instance of the generic numerical optimizer contract.
Its assumptions are proof data, not a second execution framework.
NumericalStepContract.run_approx therefore composes AdamW over finite runs exactly as it does SGD
and momentum SGD.