arXiv(opens in a new tab)cs.LGSep 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2609.02652

Unfolding the Leech Lattice: Fused Multi-Shell Decoding and VRAM Layouts for 2-Bit LLM Weights

Pier-Jean Malandrino

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

What a combinatorial index costs to serve, measured against deployed 4-bit and 2-bit GEMV kernels

PIER-JEAN MALANDRINO, Scub, France

Leech-lattice vector quantization holds the strongest reported 2-bit quality under its own evaluation protocol. Its kernel decodes one shell; we found no implementation of the multi-shell decoder the rate requires. This paper supplies one and measures its serving cost for decode-phase GEMV at batch 1. First, a serving path for the full 301-class codebook: an offline expansion into GPU layouts and a fused dequantize-plus-matvec kernel reading them without warp divergence, verified against f64. Second, the in-VRAM rate is a design axis distinct from the on-disk rate. Four bit-exact layouts timed in one process show binary bit planes beating one-hot masks on size and speed at constant bandwidth (4.80 bits per weight, 2.15× FP16). Below 4.3 bits a second, irregular stream enters; at 3.6 the decode stops being shifts and masks. Third, deployed four-bit (AWQ) and two-bit (QTIP) GEMV kernels run in the same process. The trellis kernel reads 2.40× fewer bytes than our served layout and runs 2.27× faster at near-equal fractions of their byte bounds: the time gap tracks the traffic gap, the price of unfolding a codebook too large for a lookup table. Fourth, the validity envelope: the trellis kernel outruns our no-weights control, so our launch geometry sets that floor, and on a second memory hierarchy every lattice arm falls below FP16. With the output head held identical across arms, the kernel-and-format path gains 1.11×, 1.29× and 1.41× end to end at 4B, 8B and 14B; with an int8 output head the served 4B reaches 87.0 tok/s in 2.60 GB. The quality cost, ×1.38 perplexity and 14.7 MMLU points at 4B, shrinks across the three sizes measured.

CCS Concepts: • Computing methodologies → Massively parallel algorithms; Machine learning; • Computer systems organization → Single instruction, multiple data.

Additional Key Words and Phrases: Post-training quantization, vector quantization, Leech lattice, GPU kernels, memory layout, GEMV, large language models, roofline

1 Introduction

The number of bits per weight is the only rate that changes the class of model a given machine can load. At 16 bits a 70B-parameter model needs 140 GB of weights; at 2 bits the same model occupies about 20 GB on disk and fits in the memory of a workstation. That figure is the on-disk rate. The rate served from VRAM is higher, because the kernel reads a format it can decode inside a matvec, and that rate is the subject of §3. For deployments whose constraint is sovereignty (capable models on hardware one owns), the 2-bit operating point decides whether the model loads at all.

The strongest reported 2-bit quality, under its own evaluation protocol, comes from Leech-lattice vector quantization (LLVQ) [29]: weights are grouped in blocks of 24, normalized, and snapped to the nearest point of the Leech lattice Λ24\Lambda_{24}. The systems half of that paper stops short. Its CUDA kernel decodes a single lattice shell (m=3m = 3, “for simplicity”), is reported slower than QTIP’s kernel [26], and low-level optimization is deferred as “largely orthogonal” to the contribution. The decoder the 2-bit rate requires is a union of shells: 301 coordinate-permutation classes for the ball Λ24(12)\Lambda_{24}(12), whose 47-bit index names one of 1.1×10141.1 \times 10^{14} lattice points. A branch per class would diverge across every warp. We found no prior implementation of that decoder, the original work included.

Author's Contact Information: Pier-Jean Malandrino, Scub, Bordeaux, France, pierjean.malandrino@scub.net.

Figure

This work is licensed under a Creative Commons Attribution 4.0 International License.

Malandrino

This paper supplies it and measures, for decode-phase GEMV at batch 1, what a combinatorial lattice index costs to serve. Four contributions:

C1 The fused multi-shell decoder (§2): to our knowledge the first publicly documented serving implementation of the full multi-shell Λ24(12)\Lambda_{24}(12) codebook (301 classes): an offline expansion into divergence-free GPU layouts, and a fused dequantize-plus-matvec kernel that reads them with shifts, masks and a predicated table lookup, the same instruction sequence on every lane whatever the class. The combinatorial index itself is never decoded inside the matvec. Every output row is verified against an f64 reference before any timing; on an L40S the kernel reaches 65% of its byte bound, measured against the FP16 control's bandwidth (§3).

C2 The in-VRAM rate as a design axis (§3), distinct from the on-disk rate (2.07 effective, §5). Four bit-exact layouts timed in one process span 5.51, 4.80, 4.34 and 3.59 bits per weight. Binary bit planes beat one-hot masks on size and speed at constant bandwidth: Planes14, the served layout, reads 4.80 bits per weight at 2.15×2.15\times an FP16 matvec. The curve turns between 4.8 and 4.3 bits per weight, where a second, irregular stream (the exception side channel) enters, and collapses at 3.6, where the decode stops being shifts and masks.

C3 The cost of a combinatorial index, located (§3.3): a same-process comparison with deployed 4-bit (AWQ w4g128) and 2-bit (QTIP) GEMV kernels. The trellis kernel reads 2.40×2.40\times fewer bytes than Planes14 (0.91 against 2.18 GB) and runs 2.27×2.27\times faster. Kernel efficiency is close (61% against 65% of bound); in this comparison the time gap tracks the byte ratio. As shipped, launch geometry is not equalized between the two kernels; §3.4 recovers 11.7% of Planes14's time by fusion, so the byte-driven residual is somewhat under 2.27×2.27\times. A codebook of 1.1×10141.1\times 10^{14} points cannot live in a lookup table, where E8P- and IQ2-style codebooks hold at most 2162^{16} entries, so it is unfolded at load time into a 4.80-bit stream.

C4 The validity envelope, measured (§3.4, §3.5, §4). A no-weights control runs the same launches over the same shapes and reads no weight bytes; the trellis kernel outruns it, so our launch geometry and not the card sets that time. An attribution of the gap to the DRAM floor places 39% in launch geometry, and fusing q/k/v and gate/up (144 launches instead of 252) recovers 11.7% of the Planes14 kernel time and 1.061×1.061\times end to end on the served path. On a second memory hierarchy (A100) every lattice arm falls below FP16. End-to-end serving is measured on three model sizes.

With the output head held identical in both arms, the kernel-and-format path gains 1.11×1.11\times, 1.29×1.29\times and 1.41×1.41\times end to end at 4B, 8B and 14B; with an int8 output head the served 4B configuration reaches 87.0 tok/s in 2.60 GB of VRAM (§4). At 4B, two bits cost ×1.384\times 1.384 perplexity and 14.7 MMLU points where a 4-bit baseline keeps full quality; the deficit shrinks at 8B and 14B, and three points support no scaling law (§5, Appendix A). Every figure regenerates from CSV files committed with the source, and the tables are checked against those files on every build.

References (16)