kernels: nvfp4: support decomposed linear (LoRA outlier compensation)#24
Draft
zhitwang17 wants to merge 2 commits into
Draft
kernels: nvfp4: support decomposed linear (LoRA outlier compensation)#24zhitwang17 wants to merge 2 commits into
zhitwang17 wants to merge 2 commits into
Conversation
test: decomposed_linear: tidy comments and trim SNR matrix
5be4d63 to
4522237
Compare
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.
Support DecomposedLinear (LoRA outlier compensation) under NVFP4
Summary
Enables
DecomposedLinearlow-rank outlier compensation for NVFP4 low-precisiontraining. Quantizing weights to FP4 corrupts a small set of outlier values; a low-rank
U·Σ·Vterm (LoRA-style) recovers that lost signal at negligible cost. This path alreadyexisted for MXFP4 but was never exercised end-to-end under NVFP4 or under TorchTitan's
meta-device model construction, where it crashed during conversion.
The dispatch/quantization wrappers are scheme-agnostic, so no kernel changes are required;
the fixes are confined to
DecomposedLinearconstruction and its test coverage.Changes
from_linear: allocateu/v/sigmaon the source weight'sdevice/dtype (incl.
meta), fixing aset_datacrash during TorchTitan's meta-deviceconversion.
lora_rankvalidation: require a positive multiple of 16 (the FP4 GEMM block size)at construction, replacing an opaque deep-kernel
torch._checkfailure with a fast,actionable error.
and trim the CUDA SNR matrix to
[128, 512]for cheaper CI.Op-level test results
All green; no regressions in the shared dispatch / quantization paths.
tests/unittest/nn/test_decomposed_linear.py(incl. CUDA SNR, NVFP4 + MXFP4)nvfp4/+mxfp4/op-level suites (dispatch guards, linear, quantization)E2E validation (debug model)
Three-way 10,000-step comparison on gpt-oss-debug (~82.8M total / 47.3M active, MoE),
GBS=16, 2 × MI300X. NVFP4 recipes are identical except for the compensation knob
(
lora_rank0 vs 32). All runs were stable: monotonic loss, healthy grad norms, no NaNs.DecomposedLinear closes ~39% of the NVFP4↔BF16 final-loss gap, confirming the
compensation is both correct and effective under NVFP4.