Repository navigation
fix(personaplex): round the SwiGLU gate product once - #1794
Closed
chaofengw-nv wants to merge 1 commit into
Closed
chaofengw-nv wants to merge 1 commit into
chaofengw-nv wants to merge 1 commit into
Conversation
The reference gating kernel computes SiLU(gate) * up in FP32 from the Half (or BF16) projections and rounds only the product. The family graph applied the sigmoid, the SiLU product and the up product in the work dtype, rounding SiLU(gate) to Half before the multiply. add_swiglu_activation now casts the projections to FP32 for the pointwise math and rounds the result once to their dtype; add_swiglu_mlp and the dual-profile _swiglu_mlp both use it. FP32 networks are unchanged. A GPU test drives the MLP's normal output with gate 7/64 and up 1.5, where the reference gives 0.08648681640625 and the old rounding 0.0865478515625. Fixes NVIDIA#1793 Signed-off-by: chaofengw <chaofengw@nvidia.com>
|
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 |
This was referenced Oct 18, 2026
chaofengw-nv
added a commit
to chaofengw-nv/TensorRT-Model-Connect-fork
that referenced
this pull request
Oct 20, 2026
Evaluate SiLU and its gate product in FP32, casting the combined result to the projection dtype once. Closes NVIDIA#1793 Refs NVIDIA#1794 Signed-off-by: chaofengw <chaofengw@nvidia.com>
3 of 11 tasks
Collaborator
Author
chaofengw-nv
added a commit
to chaofengw-nv/TensorRT-Model-Connect-fork
that referenced
this pull request
Oct 21, 2026
Evaluate SiLU and its gate product in FP32, casting the combined result to the projection dtype once. Closes NVIDIA#1793 Refs NVIDIA#1794 Signed-off-by: chaofengw <chaofengw@nvidia.com>
chaofengw-nv
added a commit
that referenced
this pull request
Oct 21, 2026
* fix(personaplex): decode with the FP32 Mimi codec Build the Mimi decoder in FP32, matching the encoder and native codec for every language-model precision. Closes #1750 Signed-off-by: chaofengw <chaofengw@nvidia.com> * fix(personaplex): keep RMSNorm epsilon in FP32 Create RMSNorm epsilon in FP32 so the 1e-8 value survives Half network construction. Closes #1779 Refs #1780 Signed-off-by: chaofengw <chaofengw@nvidia.com> * fix(personaplex): preserve Half embedding additions Sum audio embeddings before text and round each addition to Half for Half temporal engines. Closes #1778 Refs #1781 Signed-off-by: chaofengw <chaofengw@nvidia.com> * fix(personaplex): round the FP16 depth input like the reference Round depth projection weights, inputs, projection output and token embedding additions at the reference Half boundaries. Closes #1788 Refs #1789 Signed-off-by: chaofengw <chaofengw@nvidia.com> * fix(personaplex): preserve reference RoPE precision Construct RoPE angles and rotation in FP32, then restore the input dtype across the family decoder variants. Closes #1790 Refs #1791 Signed-off-by: chaofengw <chaofengw@nvidia.com> * fix(personaplex): round the SwiGLU gate product once Evaluate SiLU and its gate product in FP32, casting the combined result to the projection dtype once. Closes #1793 Refs #1794 Signed-off-by: chaofengw <chaofengw@nvidia.com> * fix(personaplex): build the FP16 profile with a Half core Remove component-promotion selectors from the primary FP16 manifest. Preserve the declared BF16 E2E reference and all existing thresholds. Refs #1786 Refs #1795 Signed-off-by: chaofengw <chaofengw@nvidia.com> * fix(personaplex): preserve residual input rounding Preserve rounded branch outputs before residual addition across the family decoder variants. Closes #1796 Refs #1797 Signed-off-by: chaofengw <chaofengw@nvidia.com> * fix(personaplex): store RMSNorm weights in the model dtype Round RMSNorm scale weights to the model dtype before the FP32 normalization computation. Closes #1799 Refs #1800 Signed-off-by: chaofengw <chaofengw@nvidia.com> --------- Signed-off-by: chaofengw <chaofengw@nvidia.com>
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.
Background
Fixes #1793. The pinned Moshi gating kernel (
gating_forward_kernel) istorch.compiled. It takes the Halfgateandupprojections, computesSiLU(gate) * upin FP32, and rounds the product to Half once. The family SwiGLU instead computed the sigmoid, theSiLU product and the up product in the work dtype, so
SiLU(gate)was rounded to Half before the multiply.Exit Criteria
applies to both family implementations:
graph_blocks.add_swiglu_mlpand the dual-profile_swiglu_mlp.exact comparison.
Implementation
New family-local helper
graph_blocks.add_swiglu_activation(network, gate, up). It casts both projections to FP32,applies sigmoid, multiplies by
gateand then byup, and casts back once.add_swiglu_mlpanddefault_dual_profile_decoder._swiglu_mlpcall the helper. The projection GEMMs and the downprojection are unchanged.
New test
families/personaplex/tests/test_swiglu_precision.py(markersgpuandtrt; it skips without CUDA). Thesetup is:
gate = 7/64andup = 1.5, exact in Half and BF16.The expected value is the reference formula evaluated in CUDA FP32,
Half(SiLU(gate) * up) = 0.08648681640625; the oldrounding gives
0.0865478515625. The FP32 product sits about 600 FP32 ULPs from a Half rounding boundary. The testcovers both implementations, with 3 fresh engine builds each, and compares with
rtol=0, atol=0.Change categories
Validation
Commands and Results
Original/fixed control on GB300. The setup:
main9a8b545 and of this change, each with the identical new test (sha256be3c147d...);families.personaplexis the module imported;python -m pytest -q families/personaplex/tests/test_swiglu_precision.py.Results:
6.1035e-05 (one Half ULP).
graph_blocks.pybd4c21a1...,default_dual_profile_decoder.py39f3b001...).Actual reference data (diagnostic, reference FP16 run of audio-parity clip 7, temporal layers 0/15/31, steps
0/27/28):
The other two (layer 0 at steps 0 and 27) differ in 53 and 59 elements, cause not verified.
accumulation-order differences in the projections, but that is unverified.
ruff checkandruff format --checkon the new test andgraph_blocks.py: clean.git diff --check: clean.Hardware, Environment, and Revisions
GB300 (SBSA), CUDA 13.0, TensorRT 11.2.0.113, PyTorch from the product container. Tested head
8a011cf9b2bf3d7f9d53f8d8c4b20754f107a330. Reference data: checkpointnvidia/personaplex-7b-v1revisionfdaf4090a61cb315c138a1faee287ffd6c716309, run with the pinned PersonaPlexreference environment in FP16.
Not Run / Remaining Gaps
the same
add_swiglu_mlp, but no separate BF16 or TP evidence was collected.(5.58 dB, RMS ratio 0.851), with the first token split unchanged (step 28, codebook 1). That run combined an inline
diagnostic SwiGLU patch, which is implementation-equivalent but not this head's files, with the pending fix(personaplex): preserve reference RoPE precision #1791 (rotary),
fix(personaplex): round the FP16 depth input like the reference #1789 (depth input) and FP32 RMSNorm epsilon changes. It is not exact-head model validation. No accuracy gate or baseline
was changed.
default_dual_profile_decoder.pyalready failsruff format --checkonmain(blank lines elsewhere in the file).This PR leaves that unrelated formatting unchanged.
Contributor Self-Review
Notes For Future Readers
SiLU(gate)to the work dtypeseparately. The reference is a fused kernel, not the eager composition.
Risk level
Medium: this changes the FP16 and BF16 SwiGLU arithmetic in the family toward the reference semantics. FP32 networks
are unchanged.