Repository navigation
Conversation
|
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 |
milesial
left a comment
There was a problem hiding this comment.
Verdict: changes requested.
I checked the PR premise against the upstream nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4 metadata (config.json quantization_config and hf_quant_config.json, fetched from the HF hub today). It does not match the PR description, and the new resolver fails on it:
| projection | FP8 | NVFP4 | unlisted (of 40 E layers) |
|---|---|---|---|
| shared_experts.up_proj | 39 | 0 | 1 |
| shared_experts.down_proj | 37 | 1 | 2 |
| fc1_latent_proj | 3 | 0 | 37 |
| fc2_latent_proj | 1 | 0 | 39 |
- Shared experts are FP8 in nearly every layer, not NVFP4. The latent projections are mostly unlisted, not excluded (
ignore/exclude_modulesare empty). - Because the listing is partial and layer-dependent,
_projection_modesraisesdifferent precision across layersfor every projection. Loading this checkpoint from the hub or a local download, which worked before this PR, now fails. See inline comments. - The bundled
model_configs/*Nemotron-3-Super*NVFP4*and*Ultra*NVFP4*files carry onlyquant_algo: NVFP4with noquantized_layersorconfig_groups, so the default bundled path is a no-op. The unit test uses syntheticconfig_groupsmetadata and does not exercise either real shape.
I could not fetch the Ultra 550B NVFP4 upstream metadata (gated), so the Ultra numbers are unverified.
Optional (not required):
_iter_mixed_precision_layer_algos:quant.get("config_groups")is no longer guarded byisinstance(quant, dict); a string-valuedquantization_configwould raise where the old code tolerated it.- The
# shortcut:comment style on thecreatebranch is not used elsewhere in this module. helpers.pyrefactor itself is behavior-preserving as far as I can tell.
milesial
left a comment
There was a problem hiding this comment.
Ready from code review; no required changes found.
Reviewed 0c58048 against main at bf373a1. Traced metadata collection, exclusions and aliases, explicit-mode precedence, both operation pipelines, and the Rust-backed GEMM precision handoff. The new tests cover the principal success and rejection paths. The documented limits are clear: bundled metadata keeps the global mode, and layer-dependent precision requires an explicit override.
Host-cost assessment: resolution runs during construction; literal layer declarations are indexed, avoiding a full listing scan for every projection/layer. No added per-query resolution was found. This is a source assessment, not a measured performance result.
Validation: git diff --check passed and the checkout is clean. Fast CI passed; broader CI was still pending when inspected. Tests, builds, benchmarks, and the reported E2E results were not rerun or independently reproduced under this read-only review.
…sion from checkpoint Shared experts and the fc1/fc2 latent projections inherited the global GEMM mode. Read their precision from the checkpoint metadata: quantized_layers listings, config-group and Linear targets, exclusions, and model/backbone/ language_model path prefixes. An unlisted projection is BF16 only for a targets-only MIXED_PRECISION export; other metadata keeps the global mode. NVFP4 resolves to nvfp4_wo on non-Blackwell systems. Explicit gemm_quant_mode and non-latent MoE keep the current behavior. Layers that disagree are rejected because one aggregated operation cannot represent them. Signed-off-by: Alexandre Milesi <milesial@users.noreply.github.com>
6f28796 to
28b18f6
Compare
Emit one same-name GEMM per checkpoint precision, counting the MoE layers at that precision, instead of rejecting layers that disagree. Same-name ops fold additively, so the buckets sum to the per-layer cost. Conflicting or unsupported algorithms for one module path are still rejected. Signed-off-by: Alexandre Milesi <milesial@users.noreply.github.com>
517590e to
089afa7
Compare
|
Superseded by #617, which now contains both commits of this PR unchanged. |
Before this change, latent-MoE Nemotron-H models priced the shared-expert and
fc1/fc2latent projections with the global GEMM precision, usually FP8, even when the checkpoint gave them a different precision. After this change, the SDK reads the precision of these projections from the checkpoint metadata, for example NVFP4 shared experts and BF16 latent projections. In a simulated GB200 / vLLM 0.31.0 prediction at TP1, the predicted mean TTFT goes down by 4.84% and the mean TPOT goes up by 1.68%. These are simulator predictions, not hardware measurements.Why and what changed
sdk/models/nemotron_h.pyreads the precision of the four projections fromquantized_layerslistings and from exclusions. It also reads config-group targets andLinearclass targets. It accepts themodel,backboneandlanguage_model.*path prefixes.helpers.pyalready cites (fix: model nvidia/GLM-5.3-NVFP4 ModelOpt MIXED_PRECISION targets-only quantization #610). For other metadata, an unlisted projection keeps the global precision.nvfp4_wo, fromModelConfig.system. This is the existing policy for the global precision. Blackwell keeps nativenvfp4.gemm_quant_modeand MoE models without a latent projection keep the current behavior.helpers.py:_collect_mixed_precision_layer_algosnow uses the new_iter_mixed_precision_layer_algosgenerator, which calls_mixed_precision_layer_algofrom fix: model nvidia/GLM-5.3-NVFP4 ModelOpt MIXED_PRECISION targets-only quantization #610. The result does not change.Review map
_projection_modesandNemotronHModel.createinsdk/models/nemotron_h.py.docs/perf-model/limitations.mddescribes this.Evidence
tests/unit/sdk/models/test_nemotron_mixed_precision.pyhas 38 tests on synthetic metadata. They cover uniform NVFP4 and mixed FP8/NVFP4 metadata throughTask.build_model_configon Hopper and Blackwell, in prefill and decode. They also cover exclusions, explicit overrides and the packaged Super and Ultra configs. For a 40-layer partial listing, they check the per-precision layer counts, weight bytes against a per-layer reference, and latency against single-precision references.tests/unit/sdk/modelsandtests/unit/sdk/task_v2pass. Ruff passes.maind9620e0, same patches).gemm_quant_modeprices all four projections with one mode. Metadata that is not MIXED_PRECISION keeps the global precision for an unlisted projection. Hopper resolves NVFP4 tonvfp4_wo, and the Hopper cases fail without that fix.aisimulate predictCLI and theRustForwardPassPerfModelAPI. The target is simulated gb200 with vLLM 0.31.0 in strict op-level mode (SILICON, fallback deny). Base ismain17625dc. The head is the earlier PR head 6f28796. That checkpoint gives every MoE layer the same precision, so 517590e prices it the same way. Both use the same native build and identical table data. The model metadata comes from a pinned checkpoint that lists the shared experts as NVFP4 and excludes the latent projections. Not every public Super export has this layout.fc1andfc2change from FP8 to BF16. The dense projections do not change.MoE data missing. The packaged gb200 vLLM 0.31.0 tables have no MoE rows for this shape, so no strict latency exists.MoE data missing.nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4(revision ff433f54) andnvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B-NVFP4(revision 02462641) configs were used as local inputs only. They are not part of this PR. With them, the previous head 28b18f6 fails to load Super ("different precision across layers", shared up FP8 in 39 layers and BF16 in 1). This head loads Super on Blackwell and Hopper with exact per-precision layer counts. Strict TP1 succeeds with the added MoE rows, and the public CLI completes 8 of 8 requests with 128 output tokens. Ultra gives one precision per projection and behaves the same on both heads. These Super numbers use the export's own uneven precision, so they do not compare with the pinned-checkpoint table above.Modeling or data provenance
sol).fp8_staticGEMMs are estimated from FP8 rows.Tracking
nemotron_h.pyandhelpers.pysections. This PR takes only the projection precision part, with no Mamba controls. fix: model nvidia/GLM-5.3-NVFP4 ModelOpt MIXED_PRECISION targets-only quantization #610 is merged into this branch.