liveBook · Manning

Chapter 9: Advanced quantization techniques

What you will learn in chapter 9 of Domain-Specific Small Language Models

The introduction explains why specialized language models can exceed available inference hardware capacity even after quantization, motivating the chapter’s advanced techniques.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains why specialized language models can exceed available inference hardware capacity even after quantization, motivating the chapter’s advanced techniques.

Key terms: domain-specific language models, inference hardware capacity, quantization

9.1 FlexGen

This section explains how FlexGen uses offloading and compression to run large language models with limited GPU memory, then shows how to configure it through its CLI or Python API.

Key terms: offloading, weights, activations, attention KV cache, 4 bits, latency, throughput, I/O, large batches, flex_opt

9.2 SmoothQuant

This section explains how SmoothQuant makes INT8 quantization of both LLM weights and activations practical, then compares its effect on smaller and larger OPT models.

Key terms: activation outliers, mixed-precision decomposition, FP16, INT8, SmoothQuant, per-channel scaling transformation, activation smoothing, W8A8, smooth_lm, model scales

9.3 BitNet

This section explains BitNet’s 1-bit Transformer design and summarizes reported comparisons with FP16 transformers and post-training quantization methods.

Key terms: BitNet, BitLinear, 1-bit weights, attention layers, scaling curves, loss, FP16 transformers, optimization stability, convergence, learning rate

9.4 BitNet and Python

This section shows how to run BitNet models from Python, use a PyTorch implementation, and replace linear layers in existing models.

Key terms: BitNet, Python bindings, PyTorch port, CUDA, BitLinear, BitNetTransformer, BitNet Attention, FeedForward, replace_linears_in_hf, BitNet linear layers

9.5 Summary

Concepts explained in this chapter

← Chapter 8: Generating protein structures Chapter 10: Profiling insights →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.