Add Megatron FA4 CP/GDN CP, streaming offload, and optimized LoRA publishing#716
Merged
Conversation
# Conflicts: # pyproject.toml # src/art/local/backend.py # src/art/megatron/compile_workarounds.py # src/art/megatron/flex_attention.py # src/art/megatron/jobs.py # src/art/megatron/lora.py # src/art/megatron/offload.py # src/art/megatron/provider.py # src/art/megatron/runtime/backend.py # src/art/megatron/service.py # src/art/megatron/setup.sh # src/art/megatron/train.py # src/art/pipeline_trainer/trainer.py # src/art/preprocessing/tokenize.py # src/art/tinker/renderers.py # src/art/tinker/server.py # src/art/unsloth/service.py # src/art/unsloth/train.py # src/art/vllm/patches.py # tests/integration/megatron/model_support/oracle_worker.py # tests/unit/test_preprocessing_tokenize.py # tests/unit/test_vllm_patches_contract.py # uv.lock
4c42ebd to
25e0a7f
Compare
bradhilton
approved these changes
Jun 5, 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
This PR adds production Megatron support for the FA4/context-parallel training path, GDN CP execution, streaming weight offload for memory reduction, and optimized LoRA publishing for vLLM serving.
Flex attn with FA4 backend is significantly faster than the old Triton backend. Context parallelism is very efficient in memory and throughput, being nearly linear in throughput and superlinear in memory/max packed sequence length (workload is repeated though, not growing quadratically).
Most lines of code are blackboxed in the
context_parallelandgdnmodules, which implement the actual custom context parallelism operations. Other major source is tests.Highlights
train.pyclean.Validation
Headline Throughput
Qwen3.5-35B-A3B on H200, packed shared-prefix workload:
tp1 ep1, seq57344,6.05k tok/stp1 ep1 dp2, seq57344,11.26k tok/stp1 cp2 ep2, seq122880,15.22k tok/s+35%tp1 ep2, seq73728,21.25k tok/stp1 cp4 ep2, seq262144,27.88k tok/s+31%tp1 ep8, seq81920,29.52k tok/stp1 cp8 ep8, seq581632,47.96k tok/s+62%