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
[NUMERICS] bf16 accuracy deviations: ParoQuant rounds after every Givens stage, MACaQ W4A16/Torch W4A4 skip FP32 reduce, MLX QQQ narrows bf16 to fp16 #4221
1. ParoQuant bf16 rotation rounds after each Givens stage (about 3× the error of one rounding)
Where:utils/paroquant.pyapply_paroquant_rotation_reference / _vectorized cast cos/sin and the output to the activation dtype at each of the krot stages. The fused CUDA/HIP op behaves similarly for gs -1 and 16.
Measured (bf16, CUDA and ROCm):
Quantity
Per-stage rounding (current)
Single rounding
Rotated activation error
1.1–1.3e-2
1.6–3.3e-3
ParoLinear output error
9.2e-3 (sweep worst 1.4e-2)
3.0e-3
ParoQuantTritonLinear sweep worst
1.7e-2
—
fp16 is fine.
2. MACaQ W4A16 and Torch W4A4 use a plain bf16 F.linear
Where:nn_modules/qlinear/macaq.py_forward_torch and utils/macaq_triton.pymxfp4_w4a16_linear (last line) skip the repo's linear_fp32_reduce helper (_numerics.py), so cuBLAS uses reduced-precision bf16 reduction.
Measured: K=11008, N=512, M=256: 6.5e-3 vs 3.3e-3 with an fp32-reduce matmul (about 1.7 ulp) on CUDA. ROCm is fine.
3. MlxQQQLinear narrows bf16 activations to fp16 before quantizing (static read, no Apple hardware)
Where:nn_modules/qlinear/mlx_qqq.py__call__ does x.astype(mx.float16).
Found during an AI-assisted review (Claude Code) of 9dad249; repros were run on RTX 4090/5090 (CUDA 13) and/or Radeon AI PRO R9700 (ROCm) unless marked static/suspected.
Activity
fix: round ParoQuant bf16 once, use FP32-reduce MACaQ matmuls, keep M…