Optimizers #
Optimizer configuration records and runtime optimizer constructors.
The default trainer config exposes self-contained core update rules for SGD, momentum SGD, AdaGrad, RMSProp, Adam, AdamW, and Adadelta. Runtime-only extension points live here too:
- Muon is an optimizer, but the public runtime constructor requires an explicit orthogonalization backend. The identity backend is available for proofs and fallback behavior.
- GaLore is exposed as gradient-projection machinery around a base update. The public name is
therefore
optim.galore.projectedSGD, which says exactly which update rule owns the state.
Optimizer algorithm and hyperparameters used by Trainer.
Instances For
Public SGD optimizer configuration.
Instances For
Public AdaGrad optimizer configuration.
Instances For
Momentum SGD, using momentum 0.9 when the configuration leaves it at zero.
Instances For
AdaGrad optimizer config, written optim.adagrad { lr := 0.05 }.
Instances For
RMSProp optimizer config, written optim.rmsprop { lr := 1e-3 }.
Instances For
Adam optimizer config, written optim.adam { lr := 1e-3 }.
Instances For
AdamW optimizer config, written optim.adamw { lr := 1e-3, weightDecay := 0.01 }.
Instances For
Adadelta optimizer config, written optim.adadelta {}.
Instances For
Build the selected optimizer with the defaults used by training commands.
Instances For
Runtime Adam optimizer for module-level training.
Instances For
Runtime AdamW optimizer for module-level training.
Instances For
Runtime SGD optimizer for module-level training.
Instances For
Runtime momentum-SGD optimizer for module-level training.
Instances For
Runtime AdaGrad optimizer for module-level training.
Instances For
Runtime RMSProp optimizer for module-level training.
Instances For
Runtime Adadelta optimizer for module-level training.
Instances For
Orthogonalization backend for a matrix-shaped update.
Muon uses a momentum buffer and then replaces the raw momentum direction by an approximately orthogonalized update, commonly via Newton-Schulz iterations. TorchLean keeps this as an explicit backend so the pure update rule is testable before CUDA kernels are introduced.
Instances For
The identity orthogonalizer, used when Muon is requested without a matrix backend.
Instances For
Runtime Muon-style optimizer for module-level training.
Muon is public at the runtime layer because a meaningful Muon run needs an orthogonalization backend. The default identity backend supports proofs and fallback behavior; production Muon should pass a matrix-shaped orthogonalizer.
Instances For
Identity projector, used when projected SGD is requested without a projection backend.
Instances For
Projected-SGD runtime constructor for GaLore-style gradient projection.
This is a projection strategy wrapped around an SGD update. Full GaLore also needs a policy that constructs and refreshes low-rank projectors for matrix parameters; this constructor exposes the verified update boundary once a same-shape projector is supplied.