Rust in Everything
← Papers

MACaQ: Fast, Model Agnostic Calibrated Quantization for Low-Precision Weights and Activations

Lorenz K. Muller, Philippe Bich, Chiara Boretti, Hyun-Min Chang, Jiawei Zhuang, Lukas Cavigelli

2026-11-11▲ 22arXiv 2611.10649v1Hugging FaceCode

AI-generated from the full paper (deepseek-flash). It may contain mistakes; check the original.

TL;DR

MACaQ is a strictly layer-local MXFP4 W4A4 post-training quantization method that keeps a per-channel scale and block-Hadamard transform online, combined with Hessian-weighted exponent selection and a Flip-Refinement coordinate-descent step over FP4 codes.

Problem

Weight-activation quantization to MXFP4 can cut inference memory and compute, but existing methods rely on expensive optimization and on propagating the activation-side basis transform through the network, which creates cross-layer dependencies. Absorbing a transform outside the linear layer requires finding an absorption target per layer and modifying normalization parameters, preceding projections, or residual branches. The paper argues this engineering burden and quantization-time cost can be avoided by tolerating a small online transform cost in exchange for complete layer locality.

Method

Each linear layer is treated independently: activations are scaled per channel by t and rotated by a block-diagonal Hadamard transform of block size 32, while the inverse scale and rotation are absorbed into the weights offline, leaving the unquantized product unchanged. The per-channel scale uses t_j = (sigma_j^W)^alpha / (rms_j^x)^(1-alpha) with alpha = 0.75, computed from weight column standard deviations and from the diagonal of the input Hessian. Block E8M0 exponents are then chosen by screening offsets {+1,0,-1} around the block-maximum exponent and minimizing a diagonal-Hessian-weighted reconstruction error per row and block. Flip-Refinement starts from this round-to-nearest assignment and greedily moves individual FP4 codes to adjacent E2M1 levels, accepting the highest-gain move per output row using gain(i,j,Delta) = 2*Delta*g_ij - Delta^2*(H_f)_jj and updating the gradient incrementally rather than recomputing the full matrix-vector product. Calibration statistics are accumulated with forward hooks and layers are quantized one at a time, with only the current layer resident on the GPU.

Results

  • MACaQ reaches lower perplexity than DuQuant++ and MR-GPTQ and matches their best perplexity on Llama-3-8B in 11x less quantization time. §Abstract
  • On OCP MXFP4 W4A4 WikiText-2 / C4 perplexity, MACaQ gives the best quantized result in every column, e.g. 6.90 / 11.01 on Llama-3-8B versus 7.13 / 11.37 for MR-GPTQ and 7.48 / 11.84 for DuQuant++, against 6.14 / 9.46 for FP16. §Perplexity
  • Quantizing Qwen3.5-122B-A10B on a single 96 GB GPU reached 32.5 GB peak GPU memory and took 64 minutes with 32 flips and 512K calibration tokens, producing WikiText-2 perplexity 5.14 versus 5.06 for full precision; the MXFP4 model requires 74 GB and runs on the same GPU. §Large-Model Quantization
  • On Qwen3-32B at batch 1 the MACaQ MXFP4 implementation decodes at 69.8 tok/s versus 22.8 for FP16, and at batch 256 at 5252.8 versus 3061.5 tok/s, giving up to 3x end-to-end speed-up over FP16. §End-to-End Speed
  • On FLUX.2 Klein 4B, MACaQ MXFP4 is closer to the BF16 model than the official NVFP4 checkpoint on all four fidelity metrics and ties on VRAM. §Image Diffusion
  • Ablation on Llama-3-8B shows each component lowers WikiText-2 perplexity from RTN 8.28 to 6.87 for the full MACaQ configuration. §Ablation

Limitations

  • Paper-stated: keeping everything layer-local means cross-layer error compensation is impossible; a secondary pass with cross-layer statistics could be added but would likely incur the slower quantization times of other methods.
  • Paper-stated: in the MoE experiments only expert layers were quantized, for practicality reasons.
  • Paper-stated: for the smallest model tested (0.6B parameters) the online basis transform overhead climbs to 8%.
  • Left open by the experiments: overhead figures are measured only for a limited set of models and kernel shapes; the paper notes the arithmetic ratio is not a wall-clock estimate and that measured overhead depends on kernel fusion, memory traffic, and launch overhead.

Key points

  • Prior work propagates the activation-side change of basis outside the linear layer, requiring an absorption target per layer and creating inter-layer dependencies; MACaQ keeps the transform online to preserve layer locality. §Introduction
  • The per-channel scale t_j = (sigma_j^W)^alpha / (rms_j^x)^(1-alpha) attenuates outlying activation channels while balancing weight columns, with alpha = 0.75 chosen on a wikitext-2 train validation subset. §Online Scaling
  • The Hadamard rotation is restricted to blocks of size 32 to match the MXFP4 microscaling block size, avoiding spreading an outlying channel across multiple independently scaled blocks; the scale is applied before rotation because channel weighting must happen in the unrotated domain. §Online Micro-Rotation
  • The block E8M0 exponent is chosen per weight row and block by minimizing a diagonal-Hessian-weighted error over offsets {+1,0,-1} around the exponent derived from the block maximum, and is then held fixed during Flip-Refinement. §Hessian-Weighted Exponent Selection
  • Flip-Refinement accepts at most one flip per output row per iteration, processes rows in parallel, drops rows with no positive-gain move from the active set, and updates the gradient incrementally instead of recomputing the full matrix-vector product. §Flip-Refinement
  • For block size 32 the online-to-matmul arithmetic ratio is 3/m, giving below 0.3% for the smallest output dimension m = 1024 among quantized Llama-3-8B layers. §Cost of Online Transforms
  • Forward hooks accumulate per-layer input Hessians over calibration chunks, after which the original layer is replaced by a packed MXFP4 implementation, with remaining weights kept in host memory. §Quantization Procedure
  • Kernel-level overhead of enabling scale and rotation is at most about 6% for the smaller layer tested and below 3% for the larger layer, decreasing with layer size as predicted. §Kernel-Level Speed

Mind map

MACaQ
Problem
Cross-layer transform propagation
Expensive optimization and engineering
Method
Online per-channel scale
Online block-Hadamard, block size 32
Hessian-weighted exponent selection
Flip-Refinement over FP4 codes
Layer-at-a-time streaming quantization
Experiments
WikiText-2 and C4 perplexity
IFEval and MATH-500 generation
FLUX.2 image diffusion
Kernel and end-to-end speed
Ablation and 122B quantization
Limitations
No cross-layer error compensation
MoE experts only
8% overhead on 0.6B model