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
Audit of main @ a16977e. Two places read AWQ packed tensors with the wrong column order and give silently wrong numerics.
1. AWQ 8-bit through Marlin (and Machete) un-interleaves data that was never interleaved
gptqmodel/utils/marlin.py:1115-1135 (awq_to_marlin_zero_points) undoes [0,2,1,3] when num_bits == 8.
gptqmodel_ext/marlin/awq_marlin_repack.cu:104 does the same (undo_pack[4] = {0,2,1,3}).
This repo's pack_awq only interleaves 4-bit; other widths use _pack_contiguous, and reverse_awq_order is a no-op for bits≠4. AwqTorch and AllSpark read 8-bit as natural order.
So AwqMarlinLinear (SUPPORTS_BITS=[4,8]) swaps columns 1↔2 within every 32-bit word, for both weights and zeros.
Repro: same packed buffers, K=512, N=256, gs=128.
AwqTorch: max err 0.02. AwqMarlin: 52–106, with output magnitude ~71.
With gs=-1, AllSpark is 0.024 and Marlin is 125.
Re-packing the words with order [0,2,1,3] drops Marlin to 0.013.
nn_modules/qlinear/machete_awq.py:35-45,172,183 (_undo_awq_interleave) has the same 8-bit assumption. It wasn't run here (no SM90).
Fix: for bits==8, either re-interleave to [0,2,1,3] before awq_marlin_repack / awq_to_marlin_zero_points, or skip the 8-bit undo in both the Python and CUDA repack paths. Do the same for Machete.
2. model_dequant.convert_awq_file skips the AWQ nibble reverse-order and hardcodes 4-bit
gptqmodel/utils/model_dequant.py:1557-1569 unpacks qweight/qzeros with generic unpack_cols (nibble i → column i) and never applies AWQ_REVERSE_ORDER. bits = 4 is also hardcoded, ignoring the config.
dequantize_model on any AWQ GEMM checkpoint therefore writes a dense model with output channels permuted inside every group of 8.
Repro: 64×16, gs=32, 4-bit, packed with pack_awq.
dequantize_gemm: max err 0.004.
convert_awq_file: max err 23 (another shape: 0.256 vs ref max 0.133).
The existing test (tests/test_model_dequant_fp8.py:413) only covers ignored layers. GEMV/GEMV_FAST layouts are probably mis-decoded too (unverified).
Fix: reuse unpack_awq + reverse_awq_order (or dequantize_gemm) and read bits from the config.
Activity
docs(awq): link packed-layout page to its pull request (#3974)
fix(awq): decode 8-bit packed readers in natural order (#3974) (#3993)
Qubitium commentedon Nov 14, 2026
Follow-up review of the merged fix found remaining problems; see #4002.