Skip to content

Update experimental Megatron Lite package - #1

Merged
ISEEKYAN merged 6 commits into
devlitefrom
lite_update
Jun 6, 2026
Merged

Update experimental Megatron Lite package#1
ISEEKYAN merged 6 commits into
devlitefrom
lite_update

Conversation

@ISEEKYAN

@ISEEKYAN ISEEKYAN commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Update the experimental Megatron Lite package from the latest BB Lite cleanup.
  • Keep the runtime backend name as mlite while keeping model implementations named lite.
  • Replace Qwen3.5 with the native lite implementation, add FSDP2 optimizer primitives, and add a runnable VERL SFT example.
  • Pin the VERL example requirement to the latest GitHub release tag, verl-project/verl@v0.8.0.
  • Support both FSDP2 offload modes:
    • runtime context offload through PARAM_OFFLOAD / OPTIMIZER_OFFLOAD, which moves model parameters and optimizer state between CPU and GPU when VERL switches modes;
    • optimizer update-state offload through offload_fraction=1.0, which keeps FSDP2 optimizer update state on CPU during forward/backward.

Implementation Notes

  • All new user-facing code remains under experimental/lite, with imports exposed through megatron.lite when users add experimental/lite to PYTHONPATH.
  • The VERL example uses backend=mlite; model implementations remain impl=lite.
  • experimental/lite/examples/verl/REQUIRED_VERL.txt is now requirements-style and pins verl @ git+https://github.com/verl-project/verl.git@v0.8.0.
  • FSDP2 model offload uses module-level device movement instead of direct param.data reassignment, which avoids invalid DTensor/FSDP2 storage transitions.
  • FSDP2 optimizer runtime offload now includes DTensor optimizer state by default; offload_fraction=1.0 remains a separate CPU-update path.

Validation

  • Compile:
    • PYTHONPATH=mlite/experimental/lite python -m compileall -q mlite/experimental/lite/megatron/lite/runtime/megatron_utils.py mlite/experimental/lite/examples/verl/verl_mlite/engine/mlite_engine.py mlite/experimental/lite/tests/unit/primitive/test_fsdp2_offload_gpu.py
    • Earlier package compile/import checks for experimental/lite/megatron/lite and experimental/lite/examples.
  • VERL release pin:
    • GitHub verl-project/verl latest release checked on 2026-06-06: v0.8.0.
  • FSDP2 offload unit tests:
    • Local no-CUDA run skips as expected.
    • Slurm single-node single-GPU container job 12579939: 2 passed
      • test_fsdp2_runtime_model_and_optimizer_offload_roundtrip_single_gpu
      • test_fsdp2_offload_fraction_keeps_optimizer_update_state_on_cpu_single_gpu
  • 100-step VERL SFT validation from this branch before the offload follow-up:
    • Qwen3-30B-A3B, engine=mlite, impl=lite, optimizer=fsdp2, 4 nodes x 8 GPUs, job 12537468, rc=0, step100 train/loss 0.0958933, val/loss 0.4291660.
    • Qwen3.5-35B-A3B, engine=mlite, impl=lite, optimizer=fsdp2, 4 nodes x 8 GPUs, job 12545533, rc=0, step100 train/loss 0.2139087, val/loss 0.3420881.

Merge Readiness

  • Ready for review on devlite.
  • The FSDP2 offload change is covered by focused single-GPU tests for both offload modes.
  • If reviewers want full system coverage for runtime PARAM_OFFLOAD=True, the next validation should be a 100-step Qwen3.5 VERL SFT run with both PARAM_OFFLOAD=True and OPTIMIZER_OFFLOAD=True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant