arXiv:2611.02966cs.LGNov 2026

Manuscript Offprint

arXiv:2611.02966

SHq: Learnable Grids for LLM Weight Quantization

Michael Helcig, Earl Killian, Dan Alistarh

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Block-scaled lookup-table (LUT) formats, which represent weights as indices into a small value set (the grid), have become standard for low-bit LLM quantization, ranging from NF4 and BOF4 to the 3-bit LUT instruction in NVIDIA Rubin. While these formats leave the grid definition flexible, existing implementations rely on fixed grids derived either from numerical data types (INT, FP) or assumed weight distributions (NF, BOF). We demonstrate that no single fixed grid is universally optimal; the best fixed grid varies with bit-width: BOFS at 2 bits, NF at 4 and 5 bits, and INT at 6 bits. We introduce SHq_q, a closed-form family of grids parameterized by two critical degrees of freedom: a comparing strength α\alpha that interpolates level spacing from uniform to floating-point-like, and an offset cc that introduces asymmetry. This offset allows the sign bit of the FP8 block scale, otherwise unused, to select between the grid and its mirror image, up to doubling the number of distinct values available per block. SHq_q modifies only the lookup table contents and serves as a drop-in replacement for the grid in any such format. Across five models ranging from 3B to 35B parameters, including a mixture-of-experts architecture, evaluated at 2–6 bits using RTN and GPTQ, SHq_q achieves the lowest KL divergence in every setting at 3 and 4 bits and in most settings at 2, 5 and 6 bits. It outperforms the best fixed grid by up to 34% and remains superior under mixed-precision configurations. At 4.5 bits per weight, the SHq_q format reduces the KL divergence of NVFP4 by 41–67% while improving downstream accuracy. Grid families incorporating both spacing and offset parameters perform comparably, whereas those lacking an offset exhibit clearly higher error, confirming that these two degrees of freedom drive the observed gains. We therefore propose SHq_q as the standard grid for block-scaled lookup-table formats, replacing fixed grids.

1 INTRODUCTION

Weight quantization has become a standard way to reduce the memory footprint and serving cost of large language models (LLMs) (Dettmers et al., 2022; Frantar et al., 2023; Lin et al., 2024; Dettmers et al., 2023). Specifically, microscaled quantized formats (Darvish Rouhani et al., 2023; Open Compute Project, 2023; NVIDIA et al., 2025) have become very popular: a small block of weights, typically 16 or 32, shares a scale, and each normalized weight is stored as an index into a grid of 2q2^q values. When that index is decoded through a small lookup table (Killian, 2026), the grid need not be an integer or floating-point grid at all, which raises a basic question: which 2q2^q values should the table hold? Lookup-table formats now range from NF4 (Dettmers et al., 2023) and BOF4 (Blumenberg et al., 2026) to the 3-bit lookup-table instruction of NVIDIA Rubin (NVIDIA Corporation, 2026); while these tables can hold arbitrary values, each format fixes them in advance.

Optimal grids. Finding good grids for a given distribution is an old problem. The Lloyd–Max conditions are necessary conditions for the MSE-optimal scalar quantizer of a known source (Lloyd, 1982; Max, 1960). In machine learning, ZipML was among the first to compute variance-optimal quantization levels directly from the data distribution (Zhang et al., 2017). For LLM weights, this line of work has produced multiple families of grids: NF4 places its levels at quantiles of a normal distribution (Dettmers et al., 2023), Student Float derives its levels from a heavier-tailed Student-t distribution (Dotzel et al., 2024a), BOF4 derives Lloyd-style codebooks that minimize the blockwise reconstruction error under absmax scaling (Blumenberg et al., 2026), and SqueezeLLM runs sensitivity-weighted kk-means for each output channel (Kim et al., 2024). Other grids are inherited from number formats, such as INT and the E2M1 grid of NVFP4 (NVIDIA et al., 2025). A related line of work compares integer and floating-point formats per layer, or selects between them (van Baalen et al., 2023; Zhang et al., 2024), and recent formats go further, choosing between two grids for every block (Cook et al., 2026; Egiazarian et al., 2026b). In most of these formats, the grids are fixed before the model is seen.

1^1Department of Computer Science, ETH Zürich, Zurich, Switzerland 2^2Rhoa Research, CA, USA 3^3Institute of Science and Technology Austria, Klosterneuburg, Austria. Correspondence to: Michael Helcig mhelcig@ethz.ch.

Preprint.

Figure

Figure 1. Fixed grid: the lookup table holds a grid derived once for an assumed weight distribution (NF, BOF). Tunable grid (this work): it holds SHq(α,c)_{q}(\alpha, c), with (α,c)(\alpha, c) selected for each model by the calibration KL divergence. Levels at 3 bits before E4M3 rounding; SH parameters as selected for Qwen3-8B.

Limits of current approaches. Fixing the grid in advance has three weaknesses. First, the optimal grid depends on the bit-width: in our experiments, the best fixed grid is BOFS at 2 bits, NF at 4 and 5 bits, and, in half of the settings, INT at 6 bits (Section 4), so no single fixed grid is a safe choice. Second, the optimal grid depends on the surrounding format as much as on the weights: the encoding of the block scale in E4M3 and the search over its values shift the error-minimizing grid (Section 2), whereas NF and BOF are derived from an assumed weight distribution under plain absmax scaling. Third, and more fundamentally, grids are fit to mean-squared error, possibly weighted by activation or curvature statistics; however, a lower layerwise error, weighted or not, does not necessarily yield a lower divergence of the model's output (Yvinec et al., 2023; Blumenberg et al., 2026). Learning the grid for every layer or channel (Kim et al., 2024) removes the distributional assumption, but a learned codebook has 2q2^q free levels per layer and is in practice fit to a layerwise proxy.

This paper. We take a different approach: rather than fixing the grid in advance or fitting it to a layerwise proxy, we select it from a two-parameter family against the end-to-end objective. We use a parametrized grid family, SHq(α,c)_{q}(\alpha, c), whose 2q2^q levels are obtained by sampling sinh⁡(αx)\sinh(\alpha x) on a uniform lattice and shifting by an offset cc. Each grid is described by two continuous parameters rather than 2q2^q free levels, so the space of grids is small enough to be searched by its effect on the model's output (Figure 1). For each model and bit-width, a scan selects (α,c)(\alpha, c) by the KL divergence between the next-token distributions of the quantized and original models on calibration text, and the model is then quantized in that format with RTN or GPTQ. A fixed

4-bit member of the family, with α=1.5\alpha = 1.5 and c=−0.02c = -0.02, serves as one of the read-only codebooks of a methodology for per-layer lookup-table hardware (Killian, 2026); here we analyze the family as a whole, select its parameters per model and width, and evaluate it end to end against fixed grids. Since only the contents of the lookup table change, SHq_{q} requires no change to storage or decoding, and we propose it as the default grid of block-scaled lookup-table formats.

The SH grid. SH is a companding quantizer in the classical sense (Gersho & Gray, 1992): uniform quantization applied after a smooth compressive map (here asinh), so that its levels are dense near zero, where most normalized weights lie, and sparse in the tails (Figure 2). For c=0c = 0, the parameter α\alpha sets how strongly it compands, interpolating between an almost uniform, INT-like grid as α→0\alpha \to 0 and increasingly geometric, FP-like spacing as α\alpha grows and sinh becomes exponential. The offset cc breaks the odd symmetry of sinh, making the grid asymmetric. Like the grid pairs of recent multi-grid formats (Cook et al., 2026; Egiazarian et al., 2026b), the otherwise idle sign bit of the E4M3 block scale then selects between two grids, here the grid and its mirror image. Their levels interleave: for the 3-bit grid selected for Qwen3-8B, the two provide 16 distinct values, against 8 for SH without an offset, 9 for INT3 and 13 for NF3, at no storage cost. BOF4-S uses the same mirroring, with the sign fixed by the largest weight of the block (Blumenberg et al., 2026). All levels are snapped to FP8 (E4M3), so SH is decoded through a 2q2^q-entry lookup table exactly like NF or BOF, and needs no new arithmetic in hardware.

Contributions. In summary:

Figure

Figure 2. Construction of the 3-bit SH grid selected for Qwen3-8B (α=1.75\alpha = 1.75, c=−0.1875c = -0.1875; levels before E4M3 rounding). A negative block scale selects the mirror image −G-G, whose levels interleave with those of GG: 16 values per block, against 8, 9 and 13 for SH with c=0c = 0, INT3 and NF3.

  • We introduce SHq(α,c)_{q}(\alpha, c), a two-parameter family of asymmetric companding grids that is FP8-representable and lookup-table decodable, and contains near-uniform and near-geometric grids as limiting cases. We show that its error-minimizing parameters depend on the encoding and search of the block scale as much as on the weights, and that its offset lets the sign of the block scale double the number of values available to each block, up to 2q+12^{q+1} (Section 2).

  • We show that these two degrees of freedom, level spacing and offset, account for the gains: two other families with both, NormalFloat with a free width and offset and an arctan compander, come within 3% of SH after GPTQ, whereas NormalFloat without an offset, with or without a free width, remains 8.9–16.7% above it, and removing the sign bit, on which the offset relies, raises the KL of SH by 21–38% at 3 and 4 bits (Appendices F and E). A Lloyd codebook learned for every layer matches SH in calibration KL and is 6.5% lower after GPTQ on Llama-3.1-8B-Instruct, so SH is not optimal in an absolute sense; it exposes the two relevant degrees of freedom in closed form.

  • Across five models from 3B to 35B parameters, including a mixture-of-experts model, at 2 to 6 bits with RTN and GPTQ, SH attains the lowest held-out KL divergence in 45 of 50 settings, including all 20 at 3 and 4 bits, where it is 4.0–34.4% below the best fixed grid (Table 1); differences within the measured run-to-run variation of GPTQ are not interpreted (Appendix B).

The expected acceptance rate follows the KL ordering in 47 of the 50 settings, and downstream accuracy agrees wherever differences exceed noise, except on the mixture-of-experts model at 2 bits after GPTQ (Section 4).

  • At 4.5 bits per weight, the SH4 format lowers the KL divergence of NVFP4 by 40.7–67.4% and attains higher average downstream accuracy in all six model-quantizer combinations evaluated, by 0.1–0.7 points. Much of the KL gap comes from the signed, searched block scale; under the same scale, SH4 lowers the KL of the best fixed grid by a further 4.6–34.4% (Table 3). When RCO (Helcig & Alistarh, 2026) allocates per-layer bit-widths, SH remains the lowest-KL grid after GPTQ (Table 2); tuning the grid for each layer adds little, so a single grid per model and width suffices (Section 4).

References (69)