Coupled L2 regularization 2026-11-05
Coupled L2 regularization adds a quadratic parameter penalty to the objective function and sends its gradient through the same optimizer update as the data gradient. With coefficient , define
Since the gradient of the squared Euclidean norm divided by two is , a supplied data gradient becomes
The factor fixes the convention: a penalty written as instead contributes .
For plain gradient descent, this substitution gives
It is therefore equivalent to decoupled weight decay with the matched coefficient in this particular update. The equivalence need not survive coordinate-dependent processing of the gradient.[ref]
For an original fixed-scaling example, let , , , and diagonal matrix . Applying to the whole coupled gradient gives
The same quadratic penalty produces unequal coordinate shrinkage after this scaling. Uniform decoupled weight decay would instead give . The example isolates a fixed scaling operation, rather than claiming to simulate a complete adaptive gradient method.
Coupling can also change the optimizer state. For example, a momentum buffer formed from stores contributions from along with the data gradient. If an adaptive accumulator uses squared gradient entries, it receives , including a cross term . Subsequent updates can therefore differ even when the next data gradient is the same. State both the penalty convention and the optimizer's gradient-processing rule when describing an L2 setting.
An exponentially weighted gradient history assigns geometrically decreasing coefficients to older supplied gradients. For constant and momentum buffer recurrence ,
Each additional update multiplies an old contribution by . The formula follows by substituting the expression for into the recurrence and adding the newest exponent-zero term. The same undampened recurrence, including its initialization convention, appears in the primary stochastic gradient descent documentation.[ref]
For an original example, choose , and gradients , , . Successive buffers are 2, −1, 3.5. Directly expanding the third buffer gives
The newest contribution has coefficient 1; the oldest has coefficient 1/4. The buffer is a weighted sum, not yet a weighted mean. At , its coefficient sum is the geometric series
Here , so the normalized weighted mean is , rather than the ordinary mean .
The coefficients also give a concrete memory scale. In the infinite geometric sequence, the fraction assigned to the newest gradients is . At , 29 gradients account for at least 95% of that coefficient mass, because whereas . This is a statement about coefficients, not a guarantee that gradients at different times are independent or that the optimizer averages a stationary process.
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 state-to-parameter association identifies which parameter each saved piece of optimizer state belongs to. An optimization checkpoint can contain every stored number and still resume incorrectly if those numbers are attached to different parameters. Equal shapes and data types do not establish mathematical identity.
The PyTorch optimizer dictionary separates per-parameter state from parameter-group settings. Its loader pairs saved parameter identifiers with the current parameters in group order, without independently verifying the intended association.[ref]
For an original two-parameter example, use and . Let the named parameters be and , their current gradients both be 1, and their saved momentum buffers be and . Correct restoration gives
If a reversed parameter ordering attaches the same saved buffers to the wrong scalar parameters, the result is instead
Both buffers had valid scalar shapes, so a shape check would not expose this error.
Consistently permuting the parameters, gradients and state is merely a change of ordering; permuting only the state changes the algorithm's continuation. Record a stable parameter schema and group order with the checkpoint, and check any intentional remapping against that schema. Parameter values and optimizer dictionaries are distinct saved objects, so restoring one does not automatically restore the other's meaning.[ref]
SGDR 2026-11-05
SGDR means stochastic gradient descent with warm restarts. Its learning rate schedule repeatedly lowers the learning rate along a cosine curve, then raises it to begin another cycle while retaining the current parameters. Ilya Loshchilov and Frank Hutter's method uses this warm restart to continue an existing optimization trajectory.[ref]
In cycle , let be elapsed training time since the last restart and the cycle duration, measured in the same units. The cosine learning rate schedule is
It starts at , reaches the midpoint of the two bounds at , and reaches at the cycle endpoint. The original implementation updates the elapsed training epoch count within each mini-batch, allowing fractional epoch progress.[ref]
For an original schedule, choose bounds 0 and 0.1, initial duration epochs and duration multiplier 2. The successive cycle lengths are 4, 8 and 16 epochs, with restart boundaries at total elapsed times 4, 12 and 28. In the first continuous cycle, the rates at are respectively .
Figure 1.
Cosine learning-rate cycles with doubling restart periods
. Own chosen schedule with bounds0 and0.1 and durations4,8,16epochs. Open markers show end-of-cycle limits; filled markers show the rate after restart. The figure plots a schedule, not measured training performance. Details.
A discrete convention must specify which update uses the endpoint. For example, sampling phases in the first cycle and restarting before the next step gives rates approximately , followed by . The zero endpoint in the continuous curve is then a limit, rather than an additional zero-rate optimizer step.
Retaining parameters also has a concrete meaning. In an original deterministic gradient descent example with and current , resetting only the schedule leaves . The next step at learning rate0.1 gives0.45; a step at0.01 would give0.495. The restart changes the next movement rather than drawing a new initial parameter. Handling a momentum buffer is a further state convention; restarting the schedule and discarding all optimizer state are different operations. Record cycle phase, durations and rate bounds with an optimization checkpoint.
A warm restart continues an optimization process from an already obtained solution while restarting specified algorithm controls or history. Its meaning depends on which fields are retained. In SGDR, the current parameters are retained while the learning rate schedule starts another cycle; the original paper explicitly distinguishes this from starting the optimization from scratch.[ref]
Write a complete algorithm state as , where holds parameters, is optimizer state and holds controls such as the schedule phase. A restart map can retain while replacing , or can also replace selected parts of . Saying only “restart” does not specify the next optimizer update.
For an original scalar example, take and the momentum buffer recurrence
At current , stored , and restarted learning rate , retaining the buffer gives
Retaining the same parameters but resetting the buffer to zero gives and . Both runs start the next update at ; they differ in the history carried through the restart.
A schedule-only restart can also change the next step without changing stored parameters immediately. In a plain gradient descent update from , increasing the learning rate from 0.01 to 0.1 changes the next value from 1.98 to 1.8. The change takes effect through the subsequent gradient step.
An optimization checkpoint instead records enough information to reproduce a specified continuation. A deliberate warm restart may intentionally alter some of that information. Record the retained parameter state, the new schedule phase and the policy for buffers or counters before comparing trajectories or claiming optimizer restart equivalence.