LaProp: Separating Momentum and Adaptivity in Adam¶
LaProp modifies Adam by normalizing the gradient by the square root of the debiased second moment before computing the first moment. This prevents changes in the second moment from rescaling the previously accumulated first moment, improving robustness to sudden changes in gradients. LaProp also weights contributions to the first moment by their learning rates, so gradients accumulated at higher learning rates retain more influence relative to newer gradients as the learning rate decays.
LaProp was introduced by Liu et al in LaProp: a Better Way to Combine Momentum with Adaptive Gradient.
Hyperparameters¶
optimi sets the default \(\beta\)s to (0.9, 0.99) and default \(\epsilon\) to 1e-6. These values reflect current best-practices. Liu et al default to \(\beta\)s (0.9, 0.999) and \(\epsilon\) 1e-15.
If training on large batch sizes or observing training loss spikes, consider reducing \(\beta_2\) between \([0.95, 0.99)\).
By default, LaProp applies decoupled weight decay after the parameter update. Set adam_wd=True to apply weight decay before the update (AdamW-style).
optimi's implementation of LaProp also supports fully decoupled weight decay decouple_lr=True. Remember that weight decay will likely need to be reduced when using fully decoupled weight decay as the learning rate will not modify the effective weight decay.
LaProp ¶
LaProp optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Iterable[Tensor] | Iterable[dict]
|
Iterable of parameters to optimize or dicts defining parameter groups |
required |
lr
|
float
|
Learning rate |
required |
betas
|
tuple[float, float]
|
Coefficients for gradient and squared gradient moving averages (default: (0.9, 0.99)) |
(0.9, 0.99)
|
weight_decay
|
float
|
Weight decay coefficient. If |
0
|
eps
|
float
|
Added to denominator to improve numerical stability (default: 1e-6) |
1e-06
|
decouple_lr
|
bool
|
Apply fully decoupled weight decay instead of decoupled weight decay (default: False) |
False
|
max_lr
|
float | None
|
Maximum scheduled learning rate. Set if |
None
|
adam_wd
|
bool
|
Apply weight decay before parameter update (Adam-style), instead of after the update per LaProp algorithm (default: False) |
False
|
kahan_sum
|
bool | None
|
Enables Kahan summation for more accurate parameter updates when training in low precision (float16 or bfloat16). If unspecified, automatically applies for low precision parameters (default: None) |
None
|
triton
|
bool | None
|
Enables Triton implementation. If unspecified, tries to use Triton as it is significantly faster than the for-loop implementation (default: None) |
None
|
gradient_release
|
bool
|
Fuses optimizer step and zero_grad as part of the parameter's backward
pass. Requires model hooks created with |
False
|
Algorithm¶
LaProp with decoupled weight decay.
optimi's LaProp also supports fully decoupled weight decay and AdamW-style weight decay, which are not shown.