Unit 4 of 12 · about 4 hours · explain, derive

Packing overhead, accumulator precision and fused dequantization kernels

Nominal width is not served width, and unpacked weights are not faster weights. The kernel decides whether quantization pays; the packing decides what it costs.

You'll be able to

  • Compute served bits per weight from code width, group scales, zero points and alignment for one layout.
  • Explain why INT8 products accumulate in INT32 and where overflow would first appear.
  • Distinguish fused dequantization-free kernels from dequantize-then-compute paths, and check support on your GPU.

Covers

Packing, metadata and alignment overheadAccumulator precision and dequantizationFused dequantization and hardware kernel support
1

Read

In this order, only the parts listed

0 of 4 done

  1. Packing, fusion and on-the-fly dequantizationAWQ: Activation-Aware Weight Quantization for LLM Compression and Acceleration

    AWQ arXiv:2306.00978v6, Section 4.2 Deploy AWQ with TinyChat: on-the-fly weight dequantization, SIMD-aware weight packing with the reordered layout figure, and kernel fusion of QKV and position embeddings

  2. Mixed-precision kernels and quantization hardware notesHands-On LLM Serving and Optimization - Quantization (Chapter 6) and Speculative Decoding (Chapter 7)

    Chapter 6 (printed pp. 211 to 213): the Marlin kernel for Ampere and Machete kernel for Hopper paragraph, the W4A16 with GPTQ or AWQ versus W8A8 table entries, and FP8 Is Not Always Applicable with the E4M3 and E5M2 table

    The FP8 Is Not Always Applicable box names only Hopper and Blackwell; Ada GPUs (compute capability 8.9) also have FP8 Tensor Cores, and the vLLM v0.31.0 table lists FP8 W8A8 for Ada and Hopper.

  3. Fusing dequantization into the execution graphAI Systems Performance Engineering - Chapters 15 and 16, speculation and quantization

    Chapter 16, Quantization Approaches for Real-Time Inference: Fusing Quantization-Dequantization Steps into the Execution Graph, with weight packing and the CUDA and Triton kernel notes

  4. Day 13 Part 4: microscaled block overhead100 Days of LLM Inference - Days 13, 14 and 15

    Notebook day13/quantization-number-formats.ipynb, Part 4 NVFP4: quantize_nvfp4_block with block size 16 and the effective-bits accounting

2

Focus on

  • Packing reorders sub-byte codes so vector loads stay aligned; the layout in the AWQ figure exists so one instruction feeds many lanes. Count the scale bytes beside the code bytes.
  • An INT8 product reaches , and a dot product over thousands of terms overflows INT16 quickly. Accumulate in INT32, then scale once at the end.
  • Fused kernels multiply INT4 or FP8 weights against FP16 activations in one pass. Dequantize-then-compute paths pay full high-precision arithmetic plus conversion overhead.
  • Hardware support is a table lookup, not a trend. In the vLLM v0.31.0 table FP8 W8A8 needs Ada or Hopper (compute capability 8.9 and up), Marlin covers Turing through Hopper, and GGUF, built for CPU and Apple Silicon runtimes, is listed on GPUs.
Common mistakes · 3
  • Benchmarking unpacked reference code and calling it the quantized result. Without the packed layout and fused kernel the numbers describe dequantization overhead, not the method.
  • Accumulating in the quantized width. Saturation looks like a quality regression but is an arithmetic bug; widen the accumulator first.
  • Assuming an FP8 model runs anywhere. The weights load but the Tensor Core path is missing, so execution falls back or fails; check the support table before planning a run.
3

Try it yourself

Closed-book, before checking anything

Closed-book, compute the served rate for group-64 INT4 with one FP16 scale and one INT8 zero point per group, and state the smallest dot-product length at which INT16 accumulation of INT8 products can overflow, with codes in .
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Group-64 INT4 stores one FP16 scale and one INT8 zero point per group. What is the served rate?Answer

    bits per weight, before any alignment padding.

  2. 2.Why must INT8 products accumulate in INT32?Answer

    One product already reaches 16,129, and a 4096-term dot product can approach , beyond INT16 range. INT32 holds it; scale back after the sum.

  3. 3.What distinguishes the Marlin and Machete kernels from a naive dequantize-then-multiply path?Answer

    They fuse quantized weight access into the matrix multiplication, so low-bit weights meet FP16 activations in one pass without materializing a full-precision copy.

  4. 4.NVFP4 reports about 4.5 effective bits. Where does the half bit come from?Answer

    Each block of 16 values shares an FP8 scale: bits per value on top of 4 code bits.

5

Practice

  • 100 Days of LLM Inference Day 13: block-scale accounting

    Part 4 NVFP4 cells: vary the block size in quantize_nvfp4_block, measure error and effective bits per weight, and state which block size your error budget allows

    Keep the error tensor and the bit accounting in the same table; one without the other proves nothing.

You're done when

You compute served bits for any group layout without notes and can say for a stated GPU whether the INT4 and FP8 paths are fused, emulated or absent.

Only when you can do this without notes.

Leads to

Notes

Resources · 4 for this unit, 9 more in the section

Also in this section