AdaGrad 2026-11-05
AdaGrad is a family of adaptive gradient methods that derives update geometry from accumulated gradient information. Its diagonal form uses a separate cumulative squared-gradient history for each coordinate. John Duchi, Elad Hazan and Yoram Singer's original paper develops diagonal and full-matrix versions, including constrained and regularized settings.[ref]
For an unconstrained diagonal specialization, start with and use
where is the base learning rate, keeps the denominator positive, and is a gradient or suitable subgradient. The additive stabilizer is outside the square root in this declared variant. The accumulator belongs to the optimizer state and must be retained to reproduce later updates.
For an original history example, supply two-coordinate gradients
After 100 observations,
Choose and . The effective coordinate learning rates are then
Although the recent supplied gradients agree, the early large first-coordinate value still strongly reduces its update scale.
Each is nondecreasing, so with fixed and the corresponding effective learning rate is nonincreasing. For a constant nonzero supplied scalar gradient , the history is and the update magnitude is
This tends to zero as the cumulative history grows. Adam instead uses a decaying squared-gradient history, giving old observations a different influence. The choice between these histories is part of the algorithm, rather than merely a different initial learning rate.
Adam 2026-11-05
Adam, named for adaptive moment estimation, is an adaptive gradient method that scales a running gradient estimate by a running squared-gradient estimate. Diederik P. Kingma and Jimmy Lei Ba presented it as a first-order method for stochastic optimization. Its state makes the next optimizer update depend on gradient history as well as the current parameters.[ref]
Starting from , the basic minimization rule is
Here is the supplied gradient, is the learning rate, , and . The Hadamard product, square root and division act coordinatewise. Adam bias correction supplies the two normalization factors. The accumulator concerns a raw second moment, rather than a centered variance.[ref]
For an original scalar calculation, choose , , and , and supply , . The first step has
The second has
Equal and opposite supplied gradients have not undone one another: the running histories give the second step a different magnitude. Plain gradient descent with the same constant learning rate would return to zero for this sequence.
The calculation specifies the recurrence, rather than a convergence guarantee for an unspecified objective function. An optimization checkpoint needs these histories and the step count to reproduce subsequent steps. AdamW adds decoupled weight decay; feeding a penalty gradient into Adam instead implements coupled L2 regularization and changes the histories.
AdamW 2026-11-05
AdamW combines the adaptive update of Adam with decoupled weight decay. It maintains exponentially weighted histories of the supplied data gradient and its componentwise square, while applying parameter shrinkage separately. Ilya Loshchilov and Frank Hutter presented the method in their work on decoupling decay from gradient-based regularization.[ref]
For minimization without optional algorithm variants, initialize . In the convention documented by PyTorch, step uses
The product is a Hadamard product; square roots and division are also coordinatewise. Assume , and the stated learning rate . The decay coefficient is . This explicitly fixes epsilon placement and the decay convention.[ref]
The denominators and perform Adam bias correction for zero-initialized histories. For a constant supplied scalar gradient , the corresponding geometric sums give and . Their corrected values are therefore and . The squared-gradient quantity concerns a raw second moment, rather than a centered variance: a constant gradient of 2 has square 4 even though its variance is zero.
For an original first-step example, choose , , , , , and . Then
and
The constants are chosen for transparent arithmetic. Feeding into the same adaptive formulas instead, with no separate shrinkage, would give approximately . That coupled L2 regularization also changes the stored histories. Resuming AdamW therefore requires the relevant optimizer state and step count as well as the parameter values and settings.
Adaptive gradient method 2026-11-05
An adaptive gradient method uses information from supplied gradients to adjust subsequent optimizer updates, often with a different scale for each coordinate. A useful diagonal form is
where is the current gradient, is a scalar learning rate and is a positive diagonal matrix computed from gradient history. A learning rate schedule can still control independently of the coordinate adaptation. The broader family includes AdaGrad, Adam and AdamW.
The 2011 AdaGrad paper by John Duchi, Elad Hazan and Yoram Singer formalized adaptive geometry from accumulated gradient information, including diagonal and full-matrix constructions.[ref] An unconstrained diagonal specialization maintains
Here specifies additive stabilization outside the square root. The accumulator is part of the optimizer state, rather than determined by the current parameters alone.
For an original example, start at and supply , with and . Both accumulated entries are positive, so the denominators are defined. The first step gives
Plain gradient descent with the same scalar learning rate would instead give . If the next supplied gradient is again , then and each coordinate's additional movement is . These are explicit supplied-gradient calculations, rather than a convergence claim.
In this cumulative version, an accumulated squared-gradient entry never decreases, so its effective coordinate learning rate does not increase. Other adaptive gradient methods retain decaying averages instead, changing how strongly old gradients influence later updates. Adaptation therefore specifies both the state recurrence and how that state transforms the gradient; the word “adaptive” alone does not determine either.
Anne G. E. Collins 2026-11-05
Anne G. E. Collins studies learning, decision making and executive function using behavioural experiments and computational models. With Robert C. Wilson, she coauthored a 2019 methods paper explaining how to build, simulate, fit and test models of behavior.[ref]
An illustrative reinforcement learning rule updates a prediction after outcome by , where is a learning rate. Starting at with , gives , whereas gives . This arithmetic shows what a model parameter does; it does not establish that an experimental participant uses that exact rule.
The joint paper emphasizes testing models through computer simulation and parameter recovery, so a fitted parameter is interpreted in light of what the task can actually identify.[ref]
A computational model of cognition is an explicit set of mathematical or algorithmic rules connecting inputs and previous experience to predictions about behaviour. Its variables can represent internal quantities, while its predictions concern observable choices, reaction times or other measurements. This makes a proposed cognitive mechanism precise enough to simulate and test.[ref]
A simple reinforcement learning example updates a predicted value after a reward :
The learning rate controls the contribution of the reward prediction error . With , constant reward and , successive values are , and . Equivalently, . These are model predictions for constructed inputs, not measured human responses.[ref]
Predicting choices additionally requires a rule linking values to actions. Parameter estimation can fit such a model, but a good fit alone does not establish that its internal variables are uniquely recoverable. Parameter recovery tests this by simulating data from known parameters and checking whether the fitting procedure retrieves them.[ref] This distinguishes a useful formal account from a merely suggestive verbal description.
A cosine learning rate schedule varies the learning rate along a segment of a cosine curve. For a single decreasing segment, declare to count completed schedule advances and choose a duration . With no competing rate updates, set
It starts at , reaches the midpoint of the two bounds at , and ends at . This is the cosine segment used in SGDR; repeating such segments with restarts is an additional policy, not part of the single-segment formula.[ref]
For an original example, let , and . At the rates are approximately . Differentiating the continuous interpolation gives
Thus the rate decreases throughout the interior when the upper bound exceeds the lower bound, and its interpolation has zero slope at both ends. A smooth rate curve does not by itself prove convergence of the learning procedure.
The clock must be declared: advancing once per training epoch differs from advancing after every parameter update. The PyTorch CosineAnnealingLR documentation explicitly distinguishes its implementation without restarts from SGDR. Its example advances the scheduler after the training and validation operations. To stop at the lower bound, stop or hold the schedule at the declared endpoint; indefinitely extending the cosine formula is not a permanently decreasing rule.[ref]
Decoupled weight decay 2026-11-05
Decoupled weight decay applies a parameter-shrinkage contribution separately from the optimizer's processing of the data gradient. Write for the processed data-gradient direction, including any algorithm-specific optimizer state. Using the coefficient convention documented for PyTorch AdamW,
The shrinkage term uses the pre-update parameter and is not inserted into the gradient moments.[ref]
This differs from coupled L2 regularization, which processes as a single gradient input. Decoupled weight decay was introduced for adaptive optimization in the AdamW work; the original paper also writes decay coefficients with the learning-rate factor absorbed differently, so its coefficient must be translated before comparing equations.[ref]
An original limiting case isolates the shrinkage. Suppose the processed direction is zero at every step and are constant. Repeated substitution gives
With , and , one update gives 0.98 and 50 updates give approximately 0.36417. For varying learning rates, the corresponding factor is
Thus the same numerical decay coefficient can have a different accumulated effect under a different learning rate schedule. In this zero-direction model, gives sign-preserving shrinkage; other factors have different behaviour.
The update order is also part of the definition. For , , and , the stated formula gives . Applying shrinkage after first taking the gradient step would instead give . Both operations may be described informally as decay plus a step, but they are different recurrences. An optimization checkpoint must retain the relevant state and settings to reproduce the chosen one.
Effective batch size 2026-11-05
The effective batch size counts the example contributions combined in one optimizer update, including gradient accumulation and contributions from parallel workers. With workers, accumulated groups per worker and examples in each full group,
The PyTorch documentation uses this count to specify when accumulated gradients are unscaled and the optimizer is stepped.[ref]
For an original example, two workers each process three groups of four examples before updating: . For an additive per-example loss function, the desired gradient is , evaluated at unchanged parameters . If each worker accumulates the three group-mean gradients divided by three, then averaging the two workers' results gives that normalization. Summing the workers instead would double the gradient.
Incomplete groups require their actual counts. Group sizes on each of two workers give , and the combined mini-batch gradient weights each group mean by its example count. Dividing all six group means by six would overweight the two-example groups.
The count describes contributions, not necessarily distinct examples. If both workers process the same twelve example identifiers, there are 24 contributions but only twelve distinct examples. The usual inverse-count reduction of variance requires assumptions about independent random variables; duplication can violate them. Nor does this bookkeeping by itself establish a rule for changing the learning rate.
Learning rate 2026-11-05
A learning rate controls the size of an iterative learning update. In gradient descent, it scales a direction obtained from the gradient of a loss:
A stochastic gradient descent update uses an estimated gradient in this expression. The documented SGD algorithm makes the learning rate an explicit multiplier; momentum and other modifications add separate behavior.[ref]
A scalar example shows why size matters. For , the gradient is , so a constant learning rate gives
For nonzero initial value, convergence to zero occurs exactly when , or . With and , the values are . With , they begin : increasing the step has made the iteration diverge rather than merely learn faster.
This threshold belongs to the stated quadratic. Changing curvature changes the allowed scale: for with , the same proof gives . A numerical learning rate therefore has meaning only together with the objective and update rule.
In reinforcement learning, an incremental value estimate can instead use the update . For an illustrative , observed target and , the new estimate is . Here the learning rate weights new evidence against the previous estimate, showing the same step-size idea without requiring a gradient calculation.
A learning rate schedule can vary the rate with iteration. Report the schedule, objective scaling and other update settings when comparing results; the rate alone does not determine stability or final accuracy.
Learning rate schedule 2026-11-05
A learning rate schedule specifies how the learning rate changes during an iterative learning procedure. Its rule can depend on the update count, a training epoch count or another declared event. The rule and the clock must both be stated: changing a rate every parameter update is different from changing it after a complete pass through the training data.
A simple step-decay example is
where counts completed schedule advances from zero. The values at are , those at are , and the value at is . The StepLR implementation documents periodic multiplication by a specified factor; its example advances the scheduler after the training and validation operations.[ref]
A different schedule admits an exact convergence calculation. For gradient descent on , take . With no other update terms,
Multiplying the successive ratios gives a telescoping product:
Starting at gives . This proves convergence for the stated deterministic quadratic, rather than for every objective or noisy learning procedure.
The underlying stochastic gradient descent update also depends on its gradient estimate and any additional terms, not just the scheduled scalar.[ref] Report the initial index, update order and any external changes to the rate. The StepLR documentation explicitly permits other changes alongside its own, so the isolated step formula above assumes that no competing rule intervenes.[ref]
Momentum buffer 2026-11-05
A momentum buffer stores an accumulated history of gradients for an optimization algorithm. In one common convention, a parameter vector , supplied gradient , learning rate and constant coefficient obey the recurrence relation
The buffer belongs to the optimizer state: it remembers earlier inputs even when the current parameters are unchanged. This is the undampened momentum convention used by PyTorch stochastic gradient descent with weight decay and the Nesterov accelerated gradient method disabled; its documented first buffer is the first gradient, agreeing with this recurrence from . Other conventions absorb the learning rate into the stored buffer, so a buffer value needs its update convention to be interpreted.[ref]
Repeated substitution gives the exponentially weighted gradient history
To verify this identity, substitute its expression for into : multiplication by raises every old exponent by one, and the added is precisely the new exponent-zero term. The formula holds at because its sum is empty, completing the mathematical induction.
For an original scalar example with and a constant supplied gradient , the geometric series yields . At , and the limit is 10. The buffer is an unnormalized sum: multiplying it by changes its scale, and would require a corresponding learning rate adjustment to preserve these parameter updates.
The same memory explains why momentum can temporarily oppose the current gradient. If , and the new scalar gradient is , then . With a positive learning rate, the parameter still decreases, although the present negative gradient alone would call for an increase. Persistence can carry motion through rapidly alternating gradients, but this example also shows why the rule need not decrease the objective function at every step.
A momentum buffer can retain enough earlier history that it points against the current gradient. For the undampened rule
the parameter step is for positive learning rate . If , then the directional derivative in direction is . The actual update direction is therefore locally uphill for a differentiable objective function, even though gradient descent would use the opposite direction. This history-dependent recurrence is the non-Nesterov momentum convention documented for stochastic gradient descent with dampening and weight decay disabled.[ref]
For an original scalar example, let , current , stored buffer , coefficient and . The new gradient is 1, but
The objective increases from to . This is a fully specified finite step, not only a first-order prediction.
More generally,
An old buffer sufficiently opposed to the new gradient makes this negative. At , that mechanism disappears. The example explains why a momentum method need not decrease the objective at every step; it does not imply that retaining gradient history always harms convergence. A descent direction test concerns the direction at the current point, while a convergence claim concerns an entire sequence.
Optimization checkpoint 2026-11-05
An optimization checkpoint is a saved description of an ongoing optimization algorithm from which its optimizer updates can resume. It combines the current parameters with the relevant optimizer state. The practical criterion is optimizer restart equivalence: after restoring the saved information and supplying the same subsequent inputs, the chosen update rule should produce the same subsequent states.
For a deterministic scalar example, minimize the quadratic function with gradient , learning rate and momentum buffer recurrence , followed by . Start with . After one step the saved pair is . Restoring both gives and . Restoring only and initializing a new momentum buffer to zero gives and . Equal saved parameters can therefore lead to unequal continuations. These numbers are an original calculation for the declared recurrence.
In PyTorch, a general training checkpoint commonly serializes separate model and optimizer dictionaries, together with the training position. The model dictionary contains learned parameters and registered model buffers; the optimizer dictionary contains its own changing state and group settings.[ref] Restoring the optimizer state-to-parameter association also matters: the optimizer loader pairs stored identifiers with parameters in group order, without independently establishing that they denote the same mathematical parameters.[ref]
The required checkpoint boundary depends on the computation being resumed. A changing learning rate schedule, the next position in the training data, and the state of a pseudorandom number generator can influence future updates. Matching them is part of computational reproducibility; a saved parameter vector alone does not specify the whole training process.
Optimizer state 2026-11-05
The optimizer state is information retained by an optimization algorithm beyond the current parameter values. It can include a momentum buffer and algorithm-specific counters or running estimates. Consequently, two runs with identical parameters and current gradients can produce different next optimizer updates if their stored states differ.
For an original scalar example, minimize with the recurrence
This is the momentum form with dampening, decay and the nesterov flag disabled in the PyTorch stochastic gradient descent implementation.[ref] At , and , a stored gives and . A stored instead gives and . The current parameter and gradient were identical; the difference came from history.
An optimization checkpoint that saves only the parameters cannot reproduce that next step. In PyTorch, Optimizer.state_dict() stores per-parameter state and parameter-group settings such as learning rate, but not the parameter values themselves. Its parameter identifiers associate state with ordered parameter groups and are not a check of semantic parameter identity during loading.[ref] Save and restore the corresponding parameters separately and keep the state-to-parameter association consistent. Reproducing an entire training run may additionally require the data order and other changing state.
Figure 1.
Original deterministic quadratic model: keeping or resetting the momentum buffer gives different trajectories from the same parameter value
. Details.
Optimizer update 2026-11-05
An optimizer update changes the adjustable parameters of an optimization problem according to an algorithm's current information. Evaluating a loss function, computing its gradient and changing the parameters are distinct operations. A general update may also change an optimizer state, such as stored information from previous steps:
Here is the supplied gradient and a learning rate. The PyTorch interface makes this separation explicit with gradient computation followed by optimizer.step().[ref]
For plain gradient descent with no extra state, . In an original scalar example, choose , and . The gradient is 2, so the update gives and lowers the loss from 2 to 1.62. Recompute the gradient at the new parameter value to obtain . Reusing the old gradient 2 instead would give 1.6. This explicitly locates where the algorithm obtains its information.[ref]
An update is not automatically an improvement: using for the first step above gives and loss 8. With gradient accumulation, several gradient calculations instead contribute before a single optimizer update; their weighting sets the effective batch size. Track the update count separately from the number of processed groups, particularly when applying a learning rate schedule.
Robert C. Wilson 2026-11-05
Robert C. Wilson investigates computational accounts of learning and decision making. His 2019 methods paper with Anne G. E. Collins presents practical ways to test whether a behavioural model and its fitting procedure support the intended scientific inference.[ref]
A central check is parameter recovery: generate synthetic observations using known settings, then fit the model and compare estimated settings with their known values. Model recovery asks a different question: when synthetic data come from one candidate model, does the comparison procedure select that model over its competitors?[ref]
For an invented example, a program given data generated with learning rate might repeatedly estimate values near . That failure could indicate a coding problem, insufficient task information or confounding between parameters. A numerical optimizer returning an answer is therefore not enough to establish a useful psychological measurement. The example illustrates the methodological contribution without assigning an observed human difference to a parameter by name alone.
Training epoch 2026-11-05
A training epoch is conventionally one pass through the training data used by an iterative learning procedure. Several parameter updates can occur within that pass. A mini-batch supplies a group of examples for an update, while the epoch counts progress through the data collection rather than counting individual updates.[ref]
Suppose there are training examples. Visit each exactly once per pass, form mini-batches of at most examples and retain the smaller final group. Their sizes are . With one update for every mini-batch, an epoch has
updates. Five epochs therefore make fifteen updates and fifty example visits. Fifty visits do not mean fifty distinct examples: the same ten examples are reused.
Changing the mini-batch size changes the update count. Taking all ten examples together gives one update per epoch under the same rule, while groups of two give five. An epoch count alone consequently does not specify the number of stochastic gradient descent steps, the amount of computation or the final fitted model.
The finite-pass assumption matters. Dropping an incomplete final group in this example gives two updates and only eight visits during that iterator traversal. Reordering the examples on later passes can change which examples are omitted. Sampling with replacement can repeat some examples before visiting others, so a chosen number of sampled updates need not be a literal once-per-example pass. Report those conventions rather than assuming that every loop named epoch guarantees full coverage.
The learning rate schedule needs a declared clock too: changing the learning rate once per epoch differs from changing it once per mini-batch. The optimization tutorial separates the outer loop from the operations that clear gradients, perform backpropagation and update parameters inside the training loop.[ref] Keeping data passes and update steps distinct makes training runs easier to compare.
Weight decay 2026-11-05
Weight decay supplies a parameter-shrinkage contribution to an optimizer update, with a coefficient commonly denoted . Two implementations must be distinguished. Coupled L2 regularization adds the penalty to the objective function, replacing its data gradient by . Decoupled weight decay applies parameter shrinkage separately from the optimizer's processing of the data gradient. These operations are equivalent for plain gradient descent with matched coefficients, but not in general for an adaptive gradient method.[ref]
Use the PyTorch convention here: a decoupled update shrinks parameters by , where is the learning rate. A source writing instead has absorbed the step-size factor into its decay coefficient. For an unmodified gradient step,
In AdamW, the decay contribution does not enter the stored first- or second-moment estimates of the gradient.[ref]
An original fixed-scaling example exposes the difference. Let , , , and diagonal matrix . Applying the same scaling to the entire coupled gradient gives
Separating uniform parameter shrinkage gives
The second coordinate receives different shrinkage. This is an illustrative fixed matrix, not a full AdamW simulation. With history-dependent scaling, coupling the penalty into the gradient can also alter the optimizer state. State the update equation and coefficient convention when reporting a decay setting; the label alone does not specify either.
Yoram Singer 2026-11-05
Yoram Singer coauthored the 2011 AdaGrad paper with John Duchi and Elad Hazan. Their adaptive gradient methods use past subgradients to change the geometry of later optimizer updates.[ref]
An unconstrained diagonal specialization uses a diagonal AdaGrad accumulator
with learning rate and stabilization outside the square root. The accumulator is part of the optimizer state.[ref]
For an original supplied-gradient example, let the current accumulator be , the current gradient be , and choose , . These accumulator values include the current gradient. The next displacement is
The identical current gradient coordinates produce different movements because their histories differ. Plain gradient descent with the same learning rate would move by . This calculation exposes the mechanism without asserting that either update improves every possible objective function.
The example also explains why saving only the parameter vector is insufficient to reproduce a later adaptive step. Two runs at the same , receiving the same , can move differently if their stored accumulators differ.
Figure 1.
Yoram Singer, portrait linked from his personal research homepage
. [ref]