Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Contributor
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## kaix/linear-attention-state-nvfp4 #2829 +/- ##
=====================================================================
+ Coverage 68.13% 68.99% +0.86%
=====================================================================
Files 665 656 -9
Lines 75689 72186 -3503
=====================================================================
- Hits 51567 49808 -1759
+ Misses 24122 22378 -1744
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kaix-nv
force-pushed
the
kaix/tensor-quantizer-rounding
branch
from
October 19, 2026 20:23
1eeb2cd to
0709db1
Compare
This was referenced Oct 14, 2026
kaix-nv
force-pushed
the
kaix/tensor-quantizer-rounding
branch
from
October 19, 2026 22:19
037cd27 to
e62473c
Compare
kaix-nv
changed the base branch from
kaix/linear-attention-qat-m4
to
kaix/linear-attention-state-nvfp4
October 19, 2026 22:19
kaix-nv
force-pushed
the
kaix/tensor-quantizer-rounding
branch
from
October 26, 2026 20:21
de413a4 to
a8e2c74
Compare
Signed-off-by: Kai Xu <kaix@nvidia.com>
kaix-nv
force-pushed
the
kaix/tensor-quantizer-rounding
branch
from
October 26, 2026 20:28
a8e2c74 to
b35886d
Compare
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.
What does this PR do?
Type of change: New feature.
Add
rounding="nearest" | "stochastic"toQuantizerAttributeConfigandTensorQuantizer. Rounding remains independent of format and scale grouping, and nearest remains the default.The stochastic policy is unbiased between adjacent representable values. It supports built-in integer and FP8 E4M3 fake quantization with unquantized scales, including blockwise grouping, plus dynamic block16 NVFP4. For NVFP4, E2M1 values are rounded stochastically while E4M3 block scales retain nearest rounding. Exact range endpoints remain exact.
Integer, FP8, and NVFP4 quantization share a rounding primitive after constructing the format grid. Stochastic rounding uses the PyTorch device RNG and preserves the configured straight-through gradient. The policy is saved and restored through existing ModelOpt quantizer metadata; training code remains responsible for saving RNG state.
Calibration and weight folding force nearest rounding so their results remain deterministic. Unsupported real/custom quantization, quantized-scale formats other than dynamic block16 NVFP4, learned scales, fused GDN/attention/FP8 GEMM paths, and inference export reject stochastic rounding rather than silently falling back to nearest. ReplaySSM and serving integration remain separate follow-ups.
Usage
Validation
Current head
b35886db2b:96 passedin the focused CPU TensorQuantizer suites.pre-commit run --from-ref origin/kaix/linear-attention-state-nvfp4 --to-ref HEADpassed, including Ruff, mypy, RST validation, and Bandit.git diff --checkpassed.Before your PR is "Ready for review"