-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(moe): Fine-grained activation offloading #1913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ko3n1g
merged 71 commits into
NVIDIA:main
from
lhb8125:hongbinl/activation_offloading_github_main
Jan 15, 2026
Merged
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
b671ca7
support fine-grained activation offloading
lhb8125 e8fd17f
update years in copyright
lhb8125 85548e6
update copyright
lhb8125 5dd6841
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 f5bf8c4
fix ft and import error
0321e20
address comments
lhb8125 9068805
format
lhb8125 61af7fd
update golden values on eos
lhb8125 b67a0ed
minor fix
lhb8125 a11d351
format
lhb8125 b84b5ff
renaming golden values
lhb8125 2f76430
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 c320e5b
fix bug: accuracy issu because of recomputing and offloading same modul
lhb8125 896c02f
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 ccb2f8a
Merge branch 'hongbinl/activation_offloading_github_main' of https://…
lhb8125 aa4c86c
format
lhb8125 92ce540
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 5787848
update golden values
lhb8125 7eaec4d
update golden values
lhb8125 3c68f79
update model_config and golden values
lhb8125 ee53677
format
lhb8125 1c1d9c8
remove old golden values
lhb8125 30f8dec
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 b2a261f
update golden values
lhb8125 50dc90b
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 0a9b694
support new TE version
lhb8125 950b26f
move set_ideal_affinity_for_current_gpu to pipeline/util
lhb8125 495032a
format
lhb8125 2123564
format
lhb8125 bd69216
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 8d05dfc
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 9d23103
update golden value
lhb8125 7b6ebb3
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 743ac56
code refactor
lhb8125 6829963
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 4b96d05
Merge branch 'hongbinl/activation_offloading_github_main' of https://…
lhb8125 7d8929b
format
lhb8125 480cbfa
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 83058e4
bug fix when cuda graph is disabled and fix for dumping offloading info
9605a67
refactor and update ut
lhb8125 b7a25ac
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 cb612c7
format
lhb8125 64ae361
remove unrelated changes
lhb8125 a8dfa65
fix ut
lhb8125 2c63e1d
fix ut
lhb8125 f52069e
fix ut
lhb8125 0643e55
update ut
lhb8125 d57ccb0
format
lhb8125 eadb8a3
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 ff4a2cd
update golden values
lhb8125 6dc9e2f
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 9555702
fix ut
lhb8125 9895754
Merge branch 'hongbinl/activation_offloading_github_main' of https://…
lhb8125 fd2d3fd
add version check
lhb8125 f8c09fa
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 84d13e9
minor refactor for fine_grained_activation_offload.py
lhb8125 49f3643
Merge branch 'hongbinl/activation_offloading_github_main' of https://…
lhb8125 1d1e0ca
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 483d87a
format
lhb8125 a498067
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 2f42e91
fix doc
lhb8125 469cef0
code refactor
lhb8125 c1fdba4
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 b93d212
remove group_start() calls
lhb8125 16d4114
format
lhb8125 1964268
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 6263630
add comments
lhb8125 9423c6b
fix min_offload_size and update golden values
lhb8125 cc28dd7
rename group_commit
lhb8125 b7153fa
Merge branch 'main' into hongbinl/activation_offloading_github_main
lhb8125 871bdaf
fix test_mamba_moe_model.py
lhb8125 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+325 KB
docs/images/fine_grained_activation_offloading/offloading_and_recomputing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions
31
docs/user-guide/features/fine_grained_activation_offloading.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Fine-grained Activation Offloading (collaborated with rednote) | ||
|
|
||
| Memory capacity is more and more important with the rising of extreme sparse MoE models like DeepSeek-V3 and Qwen3-235B. Fine-grained recomputing reduces the memory footprint at the cost of extra recomputation, while offloading could utilize the host-device bandwidth to achieve nearly zero-overhead. Fine-grained Activation Offloading targets at offloading the activation at the granularity of specific modules, so that we can calibrate the amount of offloading activation to maximize the training throughput. | ||
|
|
||
| Currently, the supported offloading modules are `"attn_norm", "core_attn", "attn_proj", "mlp_norm", "expert_fc1", "moe_act"`, which could work with fine-grained recomputation to release almost all activations of a transformer layer. | ||
|
|
||
| **Features** | ||
| * Support PP=1/PP/Interleaved PP | ||
| * Compatible with fine-grained recomputation | ||
| * Support FP8 | ||
| * Support MTP | ||
| * Support mixed dense & moe layer | ||
| * Support A2A Overlap | ||
| * Support CUDA Graph | ||
| * (Temporary) cuda graph scope cannot contains the offloading modules | ||
|
|
||
| **Usage** | ||
| ```bash | ||
| # Enable fine-grained activation offloading | ||
| --fine-grained-activation-offloading | ||
|
|
||
| # Specify which modules are going to offload its input | ||
| # Choices: "attn_norm", "core_attn", "attn_proj", "mlp_norm", "expert_fc1", "moe_act". | ||
| --offload-modules expert_fc1 | ||
| ``` | ||
| **Compatible with Fine-grained Recomputation** | ||
| - For modules with minor perf overhead like layernorm or moe_act, use recomputing to reduce memory footprint; | ||
| - For other modules, use offloading to reduce memory footprint; | ||
| - Make sure the offloading/reloading could be overlapped with computing; | ||
|
|
||
|  | ||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.