#8608·DeepSpeed

Universal checkpoint conversion only knows Adam's state keys, so a Muon checkpoint cannot be converted

Author: alanhuangyooCreated Sep 20, 2026Updated Sep 20, 2026

What happens

Universal checkpoint conversion reads Adam's state keys by name, so a checkpoint written by any other optimizer cannot be converted. Muon keeps momentum_buffer for the matrices it orthogonalizes, so the conversion fails before it writes anything:

File "deepspeed/checkpoint/ds_to_universal.py", line 149, in extract_zero_shards
    exp_avg=state_groups[param_group_id]["exp_avg"],
KeyError: 'exp_avg'

ZeRO-1/2 fail at extract_zero_shards (:149), ZeRO-3 at extract_zero_shards_stage3 (:191). Both reproduce on master at 141ee9f87, 2 GPUs.

Where the assumption lives

Three places, not one:

  • ds_to_universal.py:149 and :191 build flat_state from exp_avg / exp_avg_sq by name.
  • ds_to_universal.py, the merge side: for state in ("fp32", "exp_avg", "exp_avg_sq") in merge_tp_slices and merge_zero3_slices, plus scale_powers, which is keyed by the same three names.
  • stage3.py:3365, the load side: for key in ["fp32", "exp_avg", "exp_avg_sq"], and state_step = optim_sd[...]['state'][0]['step'], which Muon's matrix half does not have.

The load side for ZeRO-1/2 is already generic - load_hp_checkpoint_state takes the state names from the files in the folder - which is why only these three need to change.

One thing worth knowing before fixing it

The state keys differ within a run, not just between optimizers. DeepSpeed splits a Muon run into two param groups: the matrices carry momentum_buffer, everything else takes the Adam half and carries exp_avg / exp_avg_sq / step. So the answer has to be per param group on the way out and per sub-group on the way in. Reading it once for the whole checkpoint sends the ZeRO-3 loader looking for 0.bias/momentum_buffer.pt.

Reproduction

Two GPUs, any 2-D model, {"optimizer": {"type": "muon"}, "zero_optimization": {"stage": 1}} (stage 3 needs "reduce_scatter": false). Train a few steps, save_checkpoint with client_state[UNIVERSAL_CHECKPOINT_INFO] = {}, then run ds_to_universal on the tag.

Where I am with it

I have this working locally: state keys discovered per param group on extract, from the fragment files on merge, and per sub-group in the ZeRO-3 loader. On 2 GPUs, Muon and Adam, stages 1 and 3, with and without a second param group - the optimizer state after a universal resume is element-wise identical to the state before the save in all eight runs.

Two open questions I would rather settle here than in a PR:

  1. scale_powers decides how a tensor-parallel piece is rescaled when it is merged. momentum_buffer is gradient-like, so -1, same as exp_avg. Is that the reading you want? Only an affine-mapped parameter ever consults it, so a plain ZeRO-DP conversion is unaffected either way.
  2. For a state name that is in no table - some future optimizer - should the conversion refuse with a message, or carry the state through unscaled? Refusing is what I have, on the grounds that a silently mis-scaled optimizer state is worse than a failed conversion.

autoep_universal.py has the same three names hard-coded in its own paths; I have left it alone.

Happy to send the PR if the shape above looks right.