liveBook · Manning

Quantization

As explained in Generative AI in Action

Quantization is the reduction of numerical precision used to represent model parameters, typically to reduce memory use and computational cost.

Quantization reduces the precision used to represent model parameters, commonly converting 32-bit or 16-bit floating-point weights and biases to 8-bit or 4-bit values. Smaller representations reduce memory and computation requirements, making large language models easier to deploy and run efficiently. section 9.6.1

Use quantization to improve deployment efficiency, while evaluating its trade-offs:

  • Run smaller models on consumer-class GPUs by reducing memory requirements. section 5.3.2
  • Speed inference and improve energy efficiency, although accuracy loss or hardware inefficiency can result from poor choices. section 5.3.2 section 9.6.1
  • Distinguish quantization from LoRA: quantization reduces numerical precision, whereas LoRA freezes pretrained weights and adds trainable low-rank matrices for adaptation. section 9.6.1

LLM deployment example

A small Code Llama model can run on a consumer-class GPU after quantization. In a related adaptation workflow, QLoRA quantizes low-rank matrices and uses an 8-bit optimizer, reducing parameters while maintaining or improving performance. section 5.3.2 section 9.6.1

How Generative AI in Action covers it

How deep it goes
Defines reduced-precision representation and explains benefits and risks, but stops short of a quantization workflow or hardware-specific implementation.
Examples
Uses Code Llama on a consumer GPU, QLoRA low-rank matrices, and DistilBERT compared with BERT.
What you can do after
Evaluate precision, memory, inference, energy, accuracy, and hardware-efficiency trade-offs when selecting quantized models.
How it connects
Connects quantization to inference, model deployment, LoRA, QLoRA, fine-tuning, and model adaptation.

Also explained in

Compare how 13 books explain quantization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Generative AI in Action. The section links point to the parts of the book it draws on.