Skip to content

fix: round ParoQuant bf16 once, use FP32-reduce MACaQ matmuls, keep MLX QQQ bf16 wide (#4221) - #4264

Merged
Qubitium merged 1 commit into
mainfrom
pr/4221
Nov 16, 2026
Merged

Qubitium merged 1 commit into
mainfrom
pr/4221

Conversation

@Qubitium

@Qubitium Qubitium commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Three bf16 accuracy defects: ParoQuant rounded after every Givens stage (~3× the error), MACaQ W4A16/Torch W4A4 skipped the repo's fp32-reduce matmul, and MLX QQQ narrowed bf16 activations to fp16 (inf → NaN).

What Changed

  • gptqmodel/utils/paroquant.py: bf16 accumulates the whole Givens sweep in fp32 and narrows once; fp16 keeps per-stage rounding (bit-identical to before).
  • gptqmodel/nn_modules/qlinear/macaq.py, gptqmodel/utils/macaq_triton.py: use linear_fp32_reduce.
  • gptqmodel/nn_modules/qlinear/mlx_qqq.py: new _quantization_dtype keeps bf16 wide.
  • Added 3 targeted test files.

Tests

pytest tests/test_paroquant_bf16_rotation_4221.py tests/test_macaq_fp32_reduce_4221.py \
  tests/test_mlx_qqq_dtype_decision_4221.py tests/test_macaq_forward_dtype_4217.py -q
# 40 passed
ruff check <changed files>   # All checks passed

Notes: MLX/Metal was not available (dtype decision tested against stand-in primitives); the CUDA fp32-reduce test ran on GPU.

Rebased onto current main after #4263 (#4217) merged; this PR now contains only the #4221 changes.

Model Support / Module Plan

N/A — no new model types or registry entries.

Verification environment

No compiled GPTQModel extensions are built in this environment (Machete/Marlin/QQQ-CUDA unavailable), so hardware-specific paths are called out explicitly above.

Fixes #4221

Comment thread tests/test_macaq_forward_dtype_4217.py Resolved
Comment thread tests/test_macaq_fp32_reduce_4221.py Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NUMERICS] bf16 accuracy deviations: ParoQuant rounds after every Givens stage, MACaQ W4A16/Torch W4A4 skip FP32 reduce, MLX QQQ narrows bf16 to fp16

1 participant