verl icon indicating copy to clipboard operation
verl copied to clipboard

Is "common state dict differs from rank 0" normal during checkpoint saving for Megatron Qwen3-VL-MoE?

Open DBMing opened this issue 8 months ago • 2 comments

I am training a Qwen3-VL-MoE model with Megatron, with parallelism roughly like cp1_tp4_pp8_ep8_bsz64.

During checkpoint saving, I see warnings like:

WARNING:2026-03-16 07:26:58,272:Rank 7 common state dict differs from rank 0 common state dict. Keys only on rank 0: [('optimizer', 0, 'param_state', 30), ('optimizer', 0, 'param_state', 31), ...] WARNING:2026-03-16 07:26:58,548:Rank 32 common state dict differs from rank 0 common state dict. Keys only on rank 0: [('optimizer', 0, 'param_state', 21), ('optimizer', 0, 'param_state', 22), ...] WARNING:2026-03-16 07:26:58,547:Rank 9 common state dict differs from rank 0 common state dict. Keys only on rank 0: [('optimizer', 0, 'param_state', 15), ('optimizer', 0, 'param_state', 16), ('optimizer', 0, 'param_state', 17), ...]

Is this expected / normal for MoE + Megatron training during checkpoint saving?

DBMing avatar Mar 16 '26 08:03 DBMing

This is expected behavior for MoE models with expert parallelism (EP). Each rank only holds a subset of expert parameters, so the optimizer state keys differ across EP ranks. The warning indicates rank 0's state dict is being used as the reference for checkpoint aggregation, which is the correct approach. As long as you're using use_dist_checkpointing=True or Megatron's distributed checkpoint format, the full model state will be correctly reconstructed from all ranks during load.

Kirrito-k423 avatar Mar 17 '26 09:03 Kirrito-k423

This is expected behavior for MoE models with expert parallelism (EP). Each rank only holds a subset of expert parameters, so the optimizer state keys differ across EP ranks. The warning indicates rank 0's state dict is being used as the reference for checkpoint aggregation, which is the correct approach. As long as you're using use_dist_checkpointing=True or Megatron's distributed checkpoint format, the full model state will be correctly reconstructed from all ranks during load.

Thanks for the clarification.

DBMing avatar Mar 17 '26 11:03 DBMing