Hardware-Aware Additive Quantization for LLM Inference on AMD Zen 5
Summary
Many quantization methods prioritize reconstruction quality and adapt the resulting representation to available hardware. This proposal instead begins with a specific hardware primitive and derives the quantization format and kernel around it.
Permaq is my proposed additive quantization format built around AVX-512 VBMI and its VPERMI2B instruction, which treats two 64-byte registers as a 128-entry byte table addressed by 7-bit indices. Permaq uses that 128-entry boundary directly. In its initial configuration, each group of eight weights is represented by two 7-bit indices, each selecting an 8-dimensional codeword from one of two learned 128-entry codebooks. Adding the two selected codewords approximates the original weight group. This requires fourteen index bits per eight weights, or 1.75 bits per weight before codebooks and other model overhead.
For each activation group x, the kernel computes the dot product of x with every codeword in both codebooks, producing two 128-entry projected tables whose values are quantized to a signed byte representation suitable for register lookup. If the projected tables contributing to an output accumulation can use a common scale, encoded weights can then be evaluated by unpacking their indices, retrieving the corresponding projected values, and accumulating them in integer form. The proposal tests whether codebooks, packing, data layout, numerical representation, and kernel execution designed together around this SIMD primitive can produce a better quality-throughput tradeoff than an additive format designed primarily for reconstruction accuracy.
Design
Low-batch CPU inference is often constrained by memory bandwidth, so reducing weight traffic can justify additional/more difficult computation during decoding. AQLM and QuIP# have demonstrated the viability of additive and structured quantization at very low bit rates. Permaq focuses on how such a representation maps onto the processor by fixing each codebook at 128 entries, the largest byte table directly addressable by the intended VPERMI2B lookup. A 256-entry design using the same register-resident lookup strategy would require additional permutation and selection instructions. Permaq therefore gives up some representational capacity in exchange for a simpler lookup path, with its value depending on whether that execution advantage exceeds the associated quality and decoding costs. The choice of target is quite important here, because Zen 5 carries two 512-bit byte-granular shuffle units and sustains even the most expensive of those shuffles at roughly two per cycle, which is the throughput the entire proposed design depends on.
The basic computation can be expressed as pseudocode:
derive shared_scale from calibrated activation statistics
for each activation group g:
for k in 0..127:
T1[g][k] = quantize_int8(dot(C1[k], x[g]), shared_scale)
T2[g][k] = quantize_int8(dot(C2[k], x[g]), shared_scale)
for each output row r:
acc = 0 # int32
for each activation group g:
i1, i2 = unpack_7bit_codes(encoded[r][g])
acc += sign_extend(T1[g][i1]) + sign_extend(T2[g][i2])
output[r] = row_scale[r] * shared_scale * acc
Each projected table contains 128 byte values, so a single table occupies two 512-bit registers and both tables together occupy four. The lookup uses VPERMI2B rather than VPERMT2B because VPERMI2B overwrites the register holding the indices and leaves both table registers intact, which is exactly what reuse of a table across many output rows requires. Table construction occurs once per activation group, so the layout must reuse each table across many output rows. That reuse requirement also constrains threading, because partitioning output rows across threads would force every thread to rebuild the same tables while weight traffic stays fixed, making table construction grow with core count. Partitioning instead along the input dimension, with each thread building tables only for its own activation groups and contributing partial sums to a final reduction, keeps total table construction constant. Packing two indices into fourteen bits reduces the nominal index payload relative to two byte-aligned codes but requires unpacking before lookup, and retrieved signed byte values must be extended to a wider integer type for accumulation. Summing signed bytes is not a single cheap operation, so accumulation needs explicit widening or a multiply-add against a vector of ones, with periodic promotion to thirty-two bit accumulators to avoid overflow across long input dimensions. Tiling, index packing, table reuse, and vectorization therefore need to be optimized and measured together.
Quality and Numerical Constraints
Restricting each codebook to 128 entries reduces its representational capacity. AQLM suggests that larger effective state spaces can improve approximation quality at a fixed index budget, so Permaq may incur greater reconstruction error. Training the codebooks under the final codebook size, group size, numerical range, and execution constraints may recover enough of that loss to preserve a useful quality-throughput tradeoff. The use of two 7-bit codes over eight weights is only the initial configuration, and other group sizes or codebook counts can retain the same 128-entry lookup structure if they provide a better balance of reconstruction quality, index payload, table construction, and throughput.
Projected-table scaling introduces a second constraint. Different activation groups can produce substantially different dynamic ranges, and rescaling individual groups inside the accumulation loop would add cost to the critical path. Randomized Hadamard preprocessing, as used in QuIP#, may suppress outliers enough for the projected tables contributing to an output accumulation to use a common compact integer scale. Wider integer entries, limited outlier handling, grouped accumulation with a small number of scales, or a training penalty on projected-value range provide fallback approaches if a single byte-valued scale cannot preserve sufficient accuracy.
Prior Research
AQLM and QuIP# establish the viability of extreme additive and structured quantization. T-MAC explores lookup-based low-bit CPU inference, CodeGEMM and EVA precompute activation-codeword products for indexed retrieval, and Quicker ADC demonstrates SIMD register lookup for sub-byte codes on AVX-512. GPTVQ applies the same hardware-first reasoning on a different instruction set, capping index width at five bits because wider indices would double the number of ARM TBL instructions required. The precomputation of activation-codeword products is therefore not novel here. Permaq combines these lines of work in a specific Zen 5 design whose contribution is the constraint that those precomputed tables stay register-resident within a single instruction's addressing limit, with 128-entry additive codebooks, 7-bit indices, packing, projected numerical representation, and execution kernel all derived from the VPERMI2B lookup structure.
Evaluation
The primary comparison should probably be a byte-aligned additive baseline at a similar effective bit rate on the same processor. Measurements must account for total model memory rather than packed indices alone, including codebooks, scales, metadata, and components stored at other precisions. Packing two 7-bit codes reduces the nominal index payload by 12.5 percent relative to two byte-aligned codes, but the actual memory-traffic reduction will depend on packing, alignment, cache behavior, and vectorized loading. Attention, KV-cache traffic, normalization, sampling, and other model operations remain unchanged. Any throughput advantage must therefore exceed the combined costs of index unpacking, projected-table construction, lookup, sign extension, and accumulation.
Table construction introduces fixed work for every new activation vector, making large matrix-vector products more favorable than narrow projections or routing layers. The initial design is aimed at low-batch decoding, where projected tables can be reused across many output rows and reduced weight traffic matters most. Batched inference is likely to provide a weaker case because each activation vector requires its own projected tables.
Evaluation would measure VPERMI2B lookup cost, 7-bit index handling, projected-table dynamic range, and quantization error with and without Hadamard preprocessing. Kernel-level benchmarks would compare unpacking, lookup, sign extension, and accumulation against byte-aligned storage using the same 128-entry codebooks. A second baseline using larger conventional codebooks would isolate the cost of restricting the representation to the VPERMI2B lookup boundary.
End-to-end evaluation would ideally compare model quality, token-generation throughput, and total memory footprint across processor and thread configurations. Each result would identify the exact processor and thread configuration, since AVX-512 VBMI implementations differ in vector width and shuffle throughput, and reduced-width Zen 5 variants do not carry the same SIMD execution resources as the full core. Expectations should stay modest, because GPTVQ's ARM lookup kernel delivered large footprint reductions but only about two to thirteen percent lower decode latency than a 4-bit integer baseline, which is a reasonable prior for how much of a memory-traffic advantage survives into wall-clock throughput.
Potential Impact
CPU systems can often be provisioned with more memory at a lower cost per gigabyte than GPU systems, and if Permaq improves low-bit CPU inference enough, it could make better use of that existing cost advantage for private and offline deployment. A faster CPU kernel could make larger models practical on hardware that individuals and organizations already own.
Beyond the specific Zen 5 kernel, Permaq provides a test of hardware-first quantization design and may clarify when representational constraints imposed by an instruction set are offset by simpler and faster execution.
Additional Comments
This proposal is intentionally brief and does not attempt to specify every low-level implementation detail. It also does not assume that low-bit CPU inference will become the dominant approach to local LLM deployment. Permaq is simply a proposed focused research and engineering experiment that could inform future quantization methods, CPU inference kernels, and hardware-aware AI software. If you have any thoughts or suggestions you'd like to share, feel free to drop me an email at [email protected].
Related work
- Opens in a new tab
Extreme Compression of Large Language Models via Additive Quantization (AQLM)
Foundational learned additive multi-codebook quantization for LLMs at very low bit rates. Permaq inherits the additive-codebook idea but constrains the representation around a specific CPU lookup primitive.
- Opens in a new tab
QuIP#: Even Better LLM Quantization with Hadamard Incoherence and Lattice Codebooks
Demonstrates extreme structured/vector quantization and randomized Hadamard preprocessing, which Permaq considers as a possible way to control projected-table dynamic range.
- Opens in a new tab
Quicker ADC: Unlocking the Hidden Potential of Product Quantization with SIMD
Closest low-level precedent for 5-, 6-, and 7-bit SIMD lookup on AVX-512 and for handling non-byte-aligned codes. It targets nearest-neighbor product quantization rather than LLM inference.
- Opens in a new tab
GPTVQ: The Blessing of Dimensionality for LLM Quantization
Strong precedent for hardware-first vector quantization. GPTVQ chooses 6-bit indices and 64-entry codebooks specifically to match a mobile CPU LUT instruction, narrowing the novelty of Permaq's general hardware-first philosophy.
- Opens in a new tab
T-MAC: CPU Renaissance via Table Lookup for Low-Bit LLM Deployment on Edge
Demonstrates lookup-based low-bit LLM inference directly on CPUs without conventional weight dequantization. Its bit-wise LUT formulation differs from Permaq's learned additive codebooks.
- Opens in a new tab
CodeGEMM: A Codebook-Centric Approach to Efficient GEMM in Quantized LLMs
Very close computational precedent. It precomputes activation-centroid inner products into a table and retrieves them using weight indices instead of reconstructing weights. It targets GPU GEMM rather than a Zen 5 VPERMI2B kernel.
- Opens in a new tab
EVA: Accelerating LLM Decoding via an Efficient Vector Quantization Architecture
Directly computes input-codebook dot products and then performs indexed lookups, closely matching Permaq's projected-table transformation. EVA targets a specialized accelerator architecture rather than stock x86 CPUs.
- Opens in a new tab
LutMac: Bit-Serial Lookup Table Engine for LLM Inference
Experimental CPU LLM engine using bit-serial LUT kernels, Hadamard rotation, and x86 lookup instructions including VPERMI2B. It does not use Permaq's learned 128-entry additive-codebook representation.
- Opens in a new tab
Project Zero: CPU-Optimized LLM Inference Engine
Includes an AVX-512 VBMI kernel for quantized/ternary LLM inference, showing that using VBMI for low-bit LLM kernels is existing engineering art. Its representation and kernel are substantially different from Permaq.
- Opens in a new tab
PolyQ: Codesigning End-to-End Quantization Framework for Scalable Edge CPU LLM Inference
CPU quantization/compiler co-design built around SIMD- and LUT-compatible representations. It explicitly discusses 5–7-bit LUT sizes, including 128-entry tables, but uses a different mixed-precision scheme rather than additive VQ.
- Opens in a new tab
Vec-LUT: Vector Table Lookup for Parallel Ultra-Low-Bit LLM Inference on Edge Devices
Extends LUT-based CPU LLM inference to parallel tokens using vector lookup tables. It overlaps Permaq's lookup-oriented execution motivation but targets ultra-low-bit scalar/ternary-style representations rather than learned additive codebooks.
- Opens in a new tab
The AI Compute Extensions (ACE) for x86
Particularly important hardware prior art. AMD and Intel explicitly describe 512-bit VPERMI2B as a 128-entry LUT supporting formats up to 7 bits and discuss its use with codebook-style ML storage encodings. This means the 7-bit/128-entry mapping alone is not novel.