Skip to content
class

Adadelta

extendsOptimizer
Adadelta

Adadelta optimiser — Adagrad without a fixed learning rate.

Replaces Adagrad's monotonically growing accumulator with an EMA of squared gradients E[g2]E[g^2] and additionally maintains an EMA of squared parameter updates E[Δθ2]E[\Delta\theta^2]. The ratio of the two acts as a self-tuning step size, so lr only serves as a global scale and is conventionally left at 1.0.

Math

E[g2]t=ρ E[g2]t−1+(1−ρ) gt2 E[g^2]_t = \rho\,E[g^2]_{t-1} + (1 - \rho)\,g_t^2 Δθt=− E[Δθ2]t−1+ϵE[g2]t+ϵ  gt \Delta\theta_t = -\,\frac{\sqrt{E[\Delta\theta^2]_{t-1} + \epsilon}} {\sqrt{E[g^2]_t + \epsilon}}\; g_t E[Δθ2]t=ρ E[Δθ2]t−1+(1−ρ) Δθt2 E[\Delta\theta^2]_t = \rho\,E[\Delta\theta^2]_{t-1} + (1 - \rho)\,\Delta\theta_t^2 θt+1=θt+η Δθt \theta_{t+1} = \theta_t + \eta\,\Delta\theta_t

References

Zeiler, "ADADELTA: An Adaptive Learning Rate Method" (arXiv:1212.5701, 2012).

See Also

Adagrad, RMSprop

Parameters

paramsvector of TensorImpl
Parameters to optimise.
lrfloat, default 1.0
Global scale on Δθt\Delta\theta_t. Typically kept at 1.0.
rhofloat, default 0.9
EMA decay ρ\rho shared by both running averages.
epsfloat, default 1e-6
Numerical stabiliser inside both square roots.
weight_decayfloat, default 0.0
L2 penalty coefficient.

Attributes

sq_avg_vector of Storage
Per-parameter EMA of g2g^2.
accumulated_update_vector of Storage
Per-parameter EMA of (Δθ)2(\Delta\theta)^2.

Notes

Adadelta's unit-matching argument: the ratio E[Δθ2]/E[g2]\sqrt{E[\Delta\theta^2]} / \sqrt{E[g^2]} has the same units as θ\theta (rather than θ/g\theta / g), which is the original motivation for the method.

Constructors

1
ctor

Adadelta

void Adadelta(int)

Construct the optimiser and resize per-slot state vectors.

Parameters

paramsvector of TensorImpl
Parameters to optimise.
lrfloat, default 1.0
Global scale on the unit-matched update.
rhofloat, default 0.9
EMA decay shared by both running averages.
epsfloat, default 1e-6
Numerical stabiliser.
weight_decayfloat, default 0.0
L2 penalty coefficient.

Static methods

1
static

check_hyperparams

void check_hyperparams(double lr, double rho, double eps, double weight_decay)

Check Adadelta's hyper-parameters — the reference framework's constructor checks, run by the constructor and set_hyperparams.

Raises

InvalidArgument
If lr, eps or weight_decay is negative or NaN, or rho lies outside [0, 1].

Virtual methods

2
virtconst

lr

→float
double lr()

Return the current learning-rate scale.

Returns

float

Active value of η\eta.

virt

set_lr

void set_lr(double lr)

Set the active learning rate (global scale).

Parameters

lrfloat
New scale factor applied to the unit-matched update.

Methods

5
fn

init_state_slot

void init_state_slot(int i, const int & p)

Allocate the two per-slot EMA buffers for parameter i.

Parameters

iint
Slot index.
Parameter whose shape/dtype/device dictates the buffer layout.

Notes

Both sq_avg_[i] and accumulated_update_[i] are zero-initialised.

fn

set_hyperparams

void set_hyperparams(double lr, double rho, double eps, double weight_decay)

Replace the hyper-parameters between steps; nothing is applied when check_hyperparams rejects them.

fnconst

state_dict_id

→str
int state_dict_id()

Return the versioned state-dict identifier.

Returns

str

"adadelta_v1".

fn

update_one

void update_one(int i, int & p, const int & g)

Apply one Adadelta update to parameter i.

Parameters

iint
Parameter slot index.
Parameter tensor (updated in place).
gStorage
Gradient for p on this step.

Notes

Both running averages are advanced and the unit-matched step is applied in a single fused pass.