Pidoku
13Optimization
On this page

Optimization

Module 1316 lessons~19h 45m

Lessons, in order

13.a Optimization MethodologyModule 13 is a toolbox: quantization (13.b–13.h), KV cache savings (13.i), fusion (13.j), CUDA graphs (13.k), FlashAttention (13.l), compilers (13.m), speculative decoding (13.n–13.o) and … 1h 13.b Quantization Overview and Decision Guide10.k taught the number formats (FP16, BF16, FP8, INT8, INT4, FP4) and 10.l the mechanics of quantization: scales, zero points, granularity, symmetric vs. asymmetric. This lesson assumes both … 1h 30m 13.c Weight-Only Quantization: GPTQ and AWQGPTQ and AWQ are the two standard ways to make 4-bit weights accurate. In 2026 they remain the main 4-bit path on Hopper, Ampere and AMD MI300-class GPUs, and GPTQ's error correction is also … 1h 30m 13.d Activation Quantization and SmoothQuantWeight-only quantization (13.c) makes decode faster but not prefill. To speed up prefill and high-batch serving, the activations must be quantized too, so the tensor cores can run in 8 or 4 … 1h 15m 13.e FP8 and INT8 InferenceThis lesson is the default quantization for modern serving. If you remember one lesson from 13.b–13.h, make it this one. 1h 15m 13.f INT4 and Low-Bit InferenceThis lesson covers integer 4-bit weights and everything below 4 bits. Floating-point 4-bit (NVFP4, MXFP4), which also quantizes activations, is in 13.g. 1h 15m 13.g FP4 Inference: NVFP4 and MXFP413.f covered 4-bit integer weights, which are unpacked to 16 bits before the multiply. This lesson is about 4-bit floating point with hardware support: the multiply itself runs in 4 bits. … 1h 13.h KV Cache QuantizationWeight quantization (13.c–13.g) shrinks a fixed cost. KV-cache quantization shrinks the cost that grows with every user and every token of context, which is why at long context it is often … 1h 13.i KV Cache OptimizationThis lesson is a catalogue and a decision guide. It names every way to shrink the KV cache, says which term of the size formula each one attacks, and tells you which to reach for first. Most … 1h 30m 13.j Kernel and Operator Fusion11.h covered fusion mechanically. This lesson treats it as an optimization decision: which fusions matter in an LLM, roughly what each is worth, how serving engines apply them in 2026, and … 1h 13.k CUDA Graphs in Serving5.f covered CUDA graphs mechanically. This lesson covers the serving decisions: which modes and sizes to capture, what they cost in memory and start-up time, and which features break them. 45 min 13.l FlashAttentionThe most important algorithmic optimization in transformer inference — not because it is the fastest kernel, but because without it, long context is impossible. 2h 13.m Compilers: torch.compile and Beyond11.i covered graph optimization in theory and 11.j static versus dynamic shapes. This lesson is the practical side: how to use torch.compile for inference, what breaks it, what it is worth, … 1h 15m 13.n Speculative Decoding in Practice12.n taught the algorithm and the theory. This lesson is about deployment: which drafter to pick, how to tune it, how it interacts with batching and the rest of the engine, and how to tell … 1h 15m 13.o Speculative Decoding Variants12.n gave the algorithm and a short list of variants; 13.n covered deployment. This lesson is the deep home for the variants: how each family drafts, what it costs, and an honest comparison … 1h 15m 13.p Pruning, Distillation, and Architecture OptimizationThree ways to make the model itself cheaper, rather than making the same model run faster: 1h

About this module

Making inference cheaper and faster without changing what the model says: a method for optimising, quantization from INT8 to FP8 to FP4, KV cache optimisation and quantization, kernel fusion, CUDA graphs in serving, FlashAttention, compilers, speculative decoding in practice and its modern variants, pruning and distillation.

Lessons#

#LessonTime
13.aOptimization Methodology60 min
13.bQuantization Overview and Decision Guide90 min
13.cWeight-Only Quantization: GPTQ and AWQ90 min
13.dActivation Quantization and SmoothQuant75 min
13.eFP8 and INT8 Inference75 min
13.fINT4 and Low-Bit Inference75 min
13.gLow-Bit Inference: FP4 and Beyond60 min
13.hKV Cache Quantization60 min
13.iKV Cache Optimization90 min
13.jKernel and Operator Fusion60 min
13.kCUDA Graphs in Serving45 min
13.lFlashAttention120 min
13.mCompilers: torch.compile and Beyond75 min
13.nSpeculative Decoding in Practice75 min
13.oSpeculative Decoding Variants75 min
13.pPruning, Distillation, and Architecture Optimization60 min

Previous: LLM Inference · Next: Distributed Inference

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in