Prady Prakash

LLMs, efficiently

Memory, compute, and bandwidth are the only three budgets there are. Every technique for training and serving large language models — checkpointing, flash attention, GQA, quantization, ZeRO, tensor and pipeline parallelism, speculative decoding — spends one to buy back another. This is that ledger, derived rather than listed.

Built on the outline of Gauri Gupta's LLM optimization notes — an excellent index of this material that this book tries to add depth to. Every technical claim here is written from the primary sources, cited throughout.

01

The Three Budgets

Roofline, arithmetic intensity, and the one ratio that explains why decoding and training feel like different machines.

02

Where the Memory Goes

Parameters, gradients, optimizer state, activations — and why an 8B model needs 128 GB before it stores a single activation.

03

Activation Checkpointing

The autograd tape, sublinear memory, and why selective recompute beats the full version by an order of magnitude.

04

Flash Attention

Derive online softmax first and tiling falls out of it. An exact algorithm, not an approximation.

05

The KV Cache

MHA, MQA, GQA, MLA, paged attention, prefix caching — one problem and six responses to it.

06

Precision & Quantization

Bit layouts, emergent outliers, GPTQ, AWQ, SmoothQuant, and training through a non-differentiable rounding step.

07

Data Parallelism & ZeRO

Ring all-reduce from first principles, then ZeRO's three stages accounted in both memory and network traffic.

08

Tensor Parallelism

Why Megatron splits column-then-row, what sequence parallelism buys, and why this never leaves the node.

09

Pipeline Parallelism

The bubble, derived. GPipe versus 1F1B, weight staleness, zero-bubble schedules, and what Llama 3 actually changed.

12

Serving

Continuous batching, chunked prefill, disaggregation, and why speculative decoding is provably lossless.

13

What Lost, and Why

An honest postmortem on efficient-attention research, plus the full bibliography.