-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[Was PR1912][Dev] feat(moe): Fine-grained activation offloading #1969
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
lhb8125
merged 15 commits into
NVIDIA:dev
from
lhb8125:hongbinl/activation_offloading_github
Oct 28, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5c209c3
support fine-grained activation offloading
lhb8125 784a34c
update years in copyright
lhb8125 6e5c29e
update copyright
lhb8125 50b5f36
Merge branch 'dev' into hongbinl/activation_offloading_github
lhb8125 e853ad8
Merge branch 'dev' into hongbinl/activation_offloading_github
lhb8125 42ed938
Merge branch 'dev' into hongbinl/activation_offloading_github
lhb8125 d2b8eb5
fix ft and import error
2770d2b
address comments
lhb8125 118e00a
format
lhb8125 beaa27a
update golden values on eos
lhb8125 ee670e0
Merge branch 'dev' into hongbinl/activation_offloading_github
lhb8125 a74f12c
Merge branch 'dev' into hongbinl/activation_offloading_github
lhb8125 f5de821
minor fix
lhb8125 f128365
Merge branch 'hongbinl/activation_offloading_github' of https://githu…
lhb8125 e2c36dd
format
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
31 changes: 31 additions & 0 deletions
31
docs/source/api-guide/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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,3 +22,4 @@ API Guide | |
| optimizer_cpu_offload | ||
| multi_token_prediction | ||
| tokenizers | ||
| fine_grained_activation_offloading | ||
Binary file added
BIN
+325 KB
...source/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.
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you mention which modules are available for fine-graind recomputation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.