Repository navigation
Conversation
The residency branch compared the requested format to the literal "nvfp4" and then constructed a default NVFP4Quantizer, so asking for mxfp4 was a silent no-op: no error, no residency, weights stayed bf16 and were quantized per GEMM instead of stored 4-bit. Measured on a full model load: mxfp4 without this change settles at 153,820 MiB (identical to the bf16-expert configuration), with it 92,480 MiB -- below the 97,520 MiB of nvfp4, the direction the half-width scale grid implies. The branch also passed no scale dtype, so even the nvfp4 path could only ever be NVFP4. It now selects E8M0 for mxfp4 and keeps E4M3 otherwise. The comment claiming an E8M0 block-32 tensor cannot be a parameter described the reference implementation, whose NVFP4TensorRef lacks detach and requires_grad_; the production quantizer returns an NVFP4Tensor that carries both.
This branch has not been deployed
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.
Makes MXFP4 available to the resident 4-bit parameter path, which until now silently ignored it.
The defect
TransformerEngineBaseModulegated residency on the literal string:A caller asking for
mxfp4fell through the whole branch — no error, no log, no residency. Theweights stayed bf16 and were quantized per GEMM instead of being stored 4-bit, so the memory
saving simply never appeared.
The same branch also constructed
NVFP4Quantizer()with no scale dtype, so even the acceptednvfp4value could only ever produce NVFP4 (E4M3, 16-element blocks).The change
The format now selects the scale, and both 4-bit formats are accepted:
mxfp4kFloat8E8M0nvfp4kFloat8E4M3Measured
Full model load, same host and checkpoint, three configurations:
nvfp4mxfp4before this changemxfp4with this changeThe 5,040 MiB below
nvfp4is the half-width scale grid (2304/32 = 72 scale columns against2304/16 = 144), so the direction of the difference corroborates that the format really changed
rather than just that nothing raised.
Quantization checked directly on a
(2304, 2560)bf16 tensor:_columnwise_data (2560, 1152) uint8,_columnwise_scale_inv (2560, 72) uint8.Note on the removed comment
The branch carried a comment saying an E8M0 block-32 tensor has no parameter-capable type here,
citing
detachfailures. That was true of the reference implementation(
custom_recipes.reference_nvfp4.NVFP4TensorRef), not of the production quantizer, whoseNVFP4Tensorcarriesdetach,requires_grad_,numelanddata. The replacement commentrecords the measurement instead.