RAdam optimiser — Rectified Adam (Liu et al., 2019).
Computes a variance-based rectification factor derived from the simple moving average length . When exceeds a threshold (the paper uses ) the adaptive learning rate is well-conditioned and we apply the standard bias-corrected Adam step scaled by ; otherwise we fall back to a plain momentum step using only , which avoids the early-training divergence caused by an under-sampled second moment.
Math
If :
otherwise (fallback to plain momentum):
References
Liu, Jiang, He, Chen, Liu, Gao & Han, "On the Variance of the Adaptive Learning Rate and Beyond" (ICLR 2020, arXiv 2019).
See Also
Adam, AdamW, NAdam.
Attributes
lr_float1e-3.beta1_ , beta2_ , eps_ , weight_ decay_floatAdam.m_ , v_Storage[]Notes
and depend only on (the parameter's own update count) and , so they are computed once per parameter outside the element loop. Weight decay (if non-zero) is added to in the standard L2 form.
Constructors
1Construct an RAdam optimiser bound to params.
Parameters
paramsvector of TensorImpl shared pointerslrfloat= None1e-3.beta1, beta2float= None0.9 / 0.999.epsfloat= None1e-8.weight_ decayfloat= None0.Static methods
1check_hyperparams
void check_hyperparams(double lr, double beta1, double beta2, double eps, double weight_decay)Check RAdam's hyper-parameters — the reference framework's constructor checks, run by the constructor and set_hyperparams.
Raises
InvalidArgumentlr, eps or weight_decay is negative or NaN, or a beta lies outside [0, 1).Virtual methods
2Methods
5Allocate zero-initialised and buffers for this slot.
set_hyperparams
void set_hyperparams(double lr, double beta1, double beta2, double eps, double weight_decay)Replace the hyper-parameters between steps; nothing is applied when check_hyperparams rejects them.
Schema identifier for state_dict serialisation.
Returns
str"radam_v1".
Compute and ; apply the rectified adaptive update when , else fall back to a plain momentum update.