You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5bbcd4f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/training/activation-recomputation.md
+49-32Lines changed: 49 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,12 @@ As a rule of thumb:
17
17
18
18
- start with **selective recomputation** before using full recomputation
19
19
- use **full recomputation** only when selective recomputation still does not fit
20
-
- for MoE and long-context training, prefer recomputing smaller modules such as
21
-
normalization, activation, MoE-side, or model-specific up-projection work
22
-
rather than recomputing the whole layer
20
+
- choose selective modules from the model and measured peak: `core_attn` is a
21
+
common standard-attention candidate, MLA often benefits from `mla_up_proj`,
22
+
and grouped MoE often starts with `moe_act` or `layernorm` plus `moe_act`
23
+
- with TE fused or Flash Attention, compare `core_attn` against an empty
24
+
selective module list because the backend already rematerializes attention
25
+
internals
23
26
- revisit recomputation after enabling CUDA graphs, because TE-scoped graphs and
24
27
full recomputation are not always compatible
25
28
@@ -86,7 +89,10 @@ When training with pipeline parallelism:
86
89
87
90
## Self-attention Recomputation
88
91
89
-
Megatron Bridge supports selective self-attention recomputation that checkpoints the inputs of each self-attention block and recomputes the intermediate input activations. This cost-efficient method achieves high memory savings with minimal recomputation cost.
92
+
Megatron Bridge supports selective self-attention recomputation that checkpoints
93
+
the core-attention boundary and recomputes it during backward. This can be a
94
+
cost-efficient choice for standard attention, but it is not the universal first
95
+
boundary for MLA, MoE, or fused-attention workloads.
90
96
91
97
The intermediate layers of the self-attention block account for a large share
92
98
of activation memory because softmax, dropout, and QKV dot-product attention
@@ -105,36 +111,38 @@ from megatron.bridge.models import GPTModelProvider
0 commit comments