feat: add FlashOptim optimizer integration#1492
Merged
hemildesai merged 5 commits intomainfrom Mar 10, 2026
Merged
Conversation
380e30a to
8433588
Compare
Contributor
Author
|
/ok to test 8433588 |
fcd88cf to
b08abc0
Compare
Contributor
Author
|
/ok to test b08abc0 |
- Rewrite L2 test to run two separate torchrun invocations (train + resume) so dataloader state restores correctly in a fresh process - Validator script compares training.jsonl logs: checks num_label_tokens match and losses are within threshold after checkpoint resume - Add llama3_2_1b_squad_flashoptim.yaml config for CI (bf16 model dtype) - Fix Qwen3 MoE flashoptim config: torch_fp32 rms_norm, rope_fusion disabled, remove unsupported foreach param Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: hemildesai <hemild@nvidia.com>
b08abc0 to
507f7a3
Compare
Contributor
Author
|
/ok to test 507f7a3 |
Closed
akoumpa
approved these changes
Mar 9, 2026
Contributor
akoumpa
left a comment
There was a problem hiding this comment.
LGTM, thank you @hemildesai
thomasdhc
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1447
Convergence run - https://wandb.ai/Nemo-automodel/automodel-flashoptim
Need to pin to >=0.1.3 due to databricks/flashoptim#3
FlashAdamW) as a supported optimizer, reducing optimizer memory footprint via compressed master weights (8-bit/16-bit correction terms)qwen3_moe_30b_te_packed_sequence_flashoptim.yaml)L2_FlashOptim_DCP_Roundtrip) that verifies DCP checkpoint save/load fidelity for FlashAdamW's compressed optimizer statesflashoptim>=0.1.3as a dependency inpyproject.tomlDetails
FlashOptim integration:
FlashOptim >= 0.1.3 provides native DTensor support, enabling seamless integration with PyTorch DCP (Distributed Checkpoint) and FSDP2. The
FlashAdamWoptimizer uses quantized correction terms to reduce optimizer memory while maintaining training quality.DCP roundtrip test:
The L2 test trains a model for N steps with FlashAdamW, saves model + optimizer state via DCP, loads the checkpoint into a fresh model/optimizer, and compares continued-training losses between the original and resumed runs. This validates that the quantized optimizer states survive the DCP save/load roundtrip within a configurable loss delta threshold.
The test uses synthetic random data (no dataset download dependency) and runs as part of the existing
L2_HF_DCPCI job.Test plan
L2_HF_DCPCI job passes (includestest_flashoptim_dcp_roundtrip)torchrun --nproc-per-node=2 tests/functional_tests/checkpoint/test_flashoptim_dcp_roundtrip.py --model <model_path>🤖 Generated with Claude Code