You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] TorchFusedAwqLinear's dequantization fallback returns NaN for a finite result #5367
On CPU, the AWQ fused kernel's differentiable fallback dequantizes packed weights using FP16 scales before casting them to the activation dtype. A finite decoded coefficient can overflow at that step, causing a NaN even when the expected output is representable in FP16.
To reproduce
Reproduced at 72cef9bac on CPU with PyTorch 2.15.0+cu132.
The result is NaN. The scalar reference is 0.25 * (15 - 0) * 8192 == 30720, which the portable AwqTorchLinear gives for the same data. The fallback also returns NaN with an FP16 input.
Additional context
awq_weight_dequantize() decodes using self.scales and casts the result afterwards. Decode, fallback matmul.
Suggested mitigation
The fallback in gptqmodel/nn_modules/qlinear/torch_fused_awq.py could reuse the portable AWQ range-aware multiplication, or decode and accumulate in a wider dtype before the final output cast. A dense weight used for fallback can stay local to that forward.
The existing fixture can compare FP16 and FP32 activation outputs against the independent result 30720 and check an input gradient. When the portable backend is available, AWQ_TORCH avoids the observed fused fallback.
Activity
ZX-ModelCloud commentedon Nov 19, 2026
Agent claim released:
agent-d5b6d2ed133afinished this issue.Pull request: #5495
Reproducing the TorchFusedAwqLinear FP16 fallback NaN on current main
fix(awq): decode CPU dense fallbacks in a range-safe dtype (#5367)
fix(awq): decode CPU dense fallbacks in a range-safe dtype (#5367) (#…