Add opt-in rowwise-only quantized primary weights - #3468
Open
xiuhu17 wants to merge 3 commits into
Open
Conversation
Backward overrides run dgrad with high-precision or dequantized weights, so primary quantized parameters do not need a columnwise representation. Initialize only rowwise storage for these modes while preserving bidirectional storage for quantized backward. Add coverage for MXFP8 and 1D NVFP4 before and after backward. Signed-off-by: xiuhu17 <zhihao.wang@perplexity.ai>
Signed-off-by: xiuhu17 <zhihao.wang@perplexity.ai>
Contributor
Greptile SummaryAdds an experimental
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified. The opt-in is constrained to backward modes that do not consume columnwise primary-weight storage, default behavior remains unchanged, nested state is restored, and incompatible runtime recipe switches are rejected during forward preparation. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[quantized_model_init] --> B{Omit columnwise storage?}
B -- No --> C[Allocate rowwise and columnwise weight]
B -- Yes --> D{Backward override configured?}
D -- No --> E[Reject initialization]
D -- Yes --> F[Allocate rowwise-only weight]
F --> G[Module forward preparation]
G --> H{Current recipe uses override?}
H -- No --> I[Reject runtime recipe switch]
H -- Yes --> J[Forward and overridden backward]
Reviews (1): Last reviewed commit: "Merge branch 'NVIDIA:main' into fp8_para..." | Re-trigger Greptile |
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.
Description
quantized_model_initnormally allocates both rowwise and columnwise storage for primary quantized weights when autograd is enabled. The columnwise representation is required by the default quantized dgrad, but it is not consumed when a fixedbackward_override="high_precision"or"dequantized"mode computes dgrad from a high-precision or dequantized weight.This matters for LoRA-style training with a large frozen quantized base: the base still participates in dgrad, while an unused columnwise copy remains attached to every primary weight.
This PR adds an explicit experimental opt-in:
When enabled, primary quantized weights allocate only the rowwise representation required by forward. The option requires an initialization recipe whose
backward_overrideis"high_precision"or"dequantized".Compatibility and safety
False, so existing callers retain bidirectional primary-weight storage, including callers that switch from a backward override to default quantized backward at runtime.For block-scaled formats, omitting one persistent direction saves approximately 1.03 bytes/parameter for MXFP8 and 0.56 bytes/parameter for 1D NVFP4 before shape padding. The NVFP4 test explicitly uses one-dimensional scaling, which cannot synthesize columnwise storage from rowwise storage.
Type of change
Changes
omit_columnwise_primary_weight_storagetoquantized_model_initand preserve it across nested context state.Validation
git diff --checkpassed.TemplateStr; the changed source files pass the pinned Pylint independently.Checklist