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]
Saving and Loading Models in the PyTorch tutorials. What is a state_dict?; Saving & Loading a General Checkpoint for Inference and/or Resuming Training
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]torch.optim in the PyTorch documentation. PyTorch2.15, Optimizer.state_dict, state/param_groups and loading note
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 restart equivalence 2026-11-05
Optimizer restart equivalence means that restoring an optimization checkpoint reproduces the uninterrupted optimizer's parameter sequence for a specified subsequent computation. State the optimizer update rule, continuation inputs and intended notion of equality. Exact mathematical equality and agreement within a numerical tolerance are different claims.
For a deterministic algorithm modeled by , equality of the restored full state at step , together with the same update rule and future inputs , is sufficient. One application of gives equal next states; mathematical induction then gives equal continuations. This is a sufficient condition for the chosen observations, not a claim that every internal field must always affect them.
For an original exact example, take andFrom , one step gives . Restoring that pair gives and , exactly as uninterrupted execution. Resetting the buffer while restoring gives and . Thus a parameter-only save is not restart-equivalent for this recurrence.
Practical checkpoints must also retain the optimizer state-to-parameter association and the relevant settings, update position, learning rate schedule, data position and pseudorandom number generator state.[ref]
Saving and Loading Models in the PyTorch tutorials. General checkpoint for resuming training: model and optimizer dictionaries and training position
Fixing a random seed alone does not specify all of this continuation. Floating-point arithmetic and nondeterministic operations can additionally affect exact reproduction across environments; the primary documentation does not guarantee identical results across releases or platforms.[ref]Reproducibility in the PyTorch documentation. PyTorch2.15, opening reproducibility statement and controlling randomness
Optimizer state-to-parameter association 2026-11-05
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]
torch.optim in the PyTorch documentation. PyTorch2.15, Optimizer.state_dict, state/param_groups and loading note
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 givesIf a reversed parameter ordering attaches the same saved buffers to the wrong scalar parameters, the result is insteadBoth 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]
Saving and Loading Models in the PyTorch tutorials. What is a state_dict?; Saving & Loading a General Checkpoint