Repository navigation
fix(awq): pin Torch forward precision regressions and restore non-half dequantize - #3802
Merged
Merged
Conversation
Dequantize at the stored half precision when the compute dtype is not half, so the ParoQuant dense fallback keeps working instead of raising the half-weight assertion. Make the regression oracle use the original checkpoint-precision scales/bias instead of the live buffers, and run each forward before the buffer assertions, so the numeric corruption is pinned rather than only the buffer dtype. Correct the reference page: post_init also initializes the adapter, and a BF16 forward after post_init sees the FP16-narrowed -inf bias (the -65536/0 case only applies to a runtime cast without post_init).
ZX-ModelCloud
force-pushed
the
fix/awq-forward-review-followup
branch
from
November 12, 2026 09:42
ca386fb to
2181b0c
Compare
Collaborator
|
Review of PR #3802 at
The remaining GitHub CodeQL check is still in progress; I will merge after it completes successfully. |
Qubitium
approved these changes
Nov 12, 2026
Qubitium
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the FP32 scale fallback, independent checkpoint oracle, ParoQuant forward regression, storage lifetime, and focused CUDA/CPU tests. The precision gap found during review is fixed in 9184d10; review notes and validation are in the PR discussion.
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.
Follow-up to #3800 (merged as
8cc5ae3d4).Review findings and fixes
module.scalesandmodule.bias. The old bug corrupts those buffers, so the oracle reproduced the corruption. The tests now decode the packed INT4 words independently and compare forwards with the original checkpoint-precision scales and bias before checking stored buffers._dequantize_weight_for_inferencehelper originally asserted that every dequantized weight was half precision. The first revision of this PR avoided the assertion for a ParoQuant FP32 input by dequantizing in FP16 and widening afterward. Review found that this turned a valid FP32 scale of1e-40into zero and65536into infinity. The helper now dequantizes at the caller's FP32 dtype for that fallback. Torch AWQ forward continues to use FP16/BF16 compute dtype.post_initadapter initialization, the BF16 bias behavior afterpost_init, the FP32 ParoQuant fallback, and the actual adapter/cast order.Runtime flow
flowchart TD A["AwqTorchLinear.forward: FP16 or BF16 compute"] --> H["_dequantize_weight_for_inference"] P["ParoLinear._forward_dense: caller FP32 input"] --> H H --> S["_scales_for_compute: call-local scales in caller dtype"] S --> G["dequantize_gemm: call-local dense weight"] G --> D{"weight dtype is FP16, BF16, or FP32?"} D -- yes --> M["caller consumes weight and releases reference"] D -- no --> X["AssertionError"] M -. "stored scales unchanged" .-> K["checkpoint precision retained"] classDef failure fill:#fce8e6,stroke:#a33,color:#111 class X failuretests/kernels/test_awq_torch.py:154)0orinfgptqmodel/nn_modules/qlinear/torch_awq.py:180)Validation
nvccbuild fails before they run. The original PR head reported 12 AWQ cases passing on AMD ROCm; the two new FP32 boundary cases have not been rerun there.1,1e-40, and65536; the new ParoQuant FP32 forward case checks the65536scale and no retained dense weight (rtol=atol=0).PYTHON_GIL=0AWQ FP32 dequantization probe: 3 separate processes passed, each with 8 threads × 4 iterations across two NVIDIA PG506 GPUs.The earlier head also reported 66 nearby CUDA cases, 137 CUDA bias/fusion cases, and 196 ParoQuant unit cases passing; those larger groups were not rerun after the review commit.