Maps to: UC Berkeley CS294-158 Deep Unsupervised Learning (Spring 2024), Lecture 12b · Thu 4/11/2024 · Parallelization in Transformers. That is the last part of the L12 deck (slides 49–74), which repeats the closing “Sharding” section of the L8 guest lecture (Hao Liu, slides 110–137). It covers:
- Hardware: TPU / GPU basics (FLOP/s, HBM size and bandwidth, interconnect) and GEMM on GPUs vs TPUs (systolic arrays).
- Sharding layers: matrix-multiply sharding (rows vs columns), the MLP and attention sharded Megatron-style with the f / g operators.
- Training schemes: data parallelism, fully sharded data parallelism (FSDP), tensor parallelism, FSDP + TP, with the slides’ arithmetic-intensity rules.
- Practical guidelines.
Basis: Megatron-LM (Shoeybi et al., 2019), the “Sharding Techniques” notes the slides cite (Rafi W.), ZeRO / FSDP, and the roofline model.
- Hardware numbers: taken from vendor datasheets and the TPU v4 paper. The interconnect figure for TPU v5e is the one implied by the slides’ “1018 FLOPs/byte”.
- The code: it simulates devices in numpy. Every collective is a real ring algorithm that counts the elements it sends, and every parallel training scheme reproduces single-device training to ~1e-16.
Code:
code/lecture23/(4 scripts +parallel.py; numpy only; every script runs in seconds) Reading time: 2.5 hours including running the code
0. How to read this lecture
0.1 Learning goals
After this lecture you should be able to:
- Hardware. Read a chip’s datasheet as peak FLOP/s, memory size, memory bandwidth and interconnect bandwidth. Compute arithmetic intensity and decide, with the roofline, whether a kernel is compute- or memory-bound.
- Collectives. Explain the three collectives (all-reduce, reduce-scatter, all-gather), their ring algorithms, and their cost of about or the message per device.
- Sharding. Shard a matrix multiply, an MLP and attention across devices, and say which splits need communication (Megatron’s f and g).
- Training schemes. Derive the memory and communication of data parallelism, FSDP, tensor parallelism and FSDP + TP. Apply the slides’ rules (batch per chip > ~1018 for FSDP, > ~1018 for TP) to choose a configuration.
0.2 Prerequisites and scope
| Assumed | Introduced here | Elsewhere |
|---|---|---|
| Lecture 4 (Transformers: attention, MLP blocks) | roofline, arithmetic intensity, systolic arrays | Lecture 16 (KV caches and bandwidth-bound decoding; blockwise and ring attention; MoE) |
| Lecture 16 (scaling laws; 6ND training FLOPs) | collectives and their costs; DP, TP, FSDP, FSDP + TP | |
| Backpropagation for an MLP | Megatron’s f / g operators; memory accounting for GPT-3 |
The slides do not cover pipeline parallelism, sequence parallelism or expert parallelism. They are mentioned in §7 only.
0.3 Map
§1 why parallelize: GPT-3's memory and compute
§2 the hardware: FLOP/s, bandwidth, the roofline, systolic arrays ← code 01
§3 collectives: all-reduce, reduce-scatter, all-gather ← code 02
§4 sharding a matmul, an MLP, attention (Megatron's f and g) ← code 03
§5 training: DP, TP, FSDP, FSDP + TP -- same mathematics, different traffic ← code 04, Part 1
§6 choosing a configuration: memory and the arithmetic-intensity rules ← code 04, Parts 2-3
§7 practical guidelines; what the slides leave out
§8 summary §9 pitfalls §10 exercises §11 further reading §12 next lecture
0.4 Notation
| symbol | meaning |
|---|---|
| the number of devices (chips) | |
| the model width | |
| tokens per chip (the slides’ BATCH_PER_CHIP) | |
| the number of parameters |
Bytes assume bf16 (2 bytes per number) unless said otherwise. “Elements sent” counts the numbers one device sends; multiply by 2 for bf16 bytes.
1. Why parallelize?
Two numbers settle the question for GPT-3: 175B parameters, trained on 300B tokens.
Memory. At 4 bytes per parameter the weights alone take 700 GB (slide 65). An A100 or H100 has 80 GB. Training needs more:
| item | bytes per parameter |
|---|---|
| bf16 weights | 2 |
| bf16 gradients | 2 |
| fp32 master weights and Adam’s two moments | 12 |
| total | 16 |
That is 2.8 TB per copy of the model (script 01), before any activations.
Compute. Training costs about FLOPs (Lecture 16): . One A100 at its peak bf16 rate (312 TFLOP/s) would need seconds, i.e. 32 years. Even a thousand chips at 50% utilization need weeks.
So we need many chips. The question of this lecture is how to split the work so that the chips compute, rather than wait for each other.
2. The hardware
2.1 What a chip offers (slide 50)
Four numbers describe a chip for our purposes:
- peak FLOP/s;
- the size of its high-bandwidth memory (HBM);
- HBM bandwidth;
- the bandwidth of the interconnect to other chips (NVLink, or the TPU’s inter-chip interconnect, ICI).
Script 01, Part 1:
| chip | bf16 TFLOP/s | HBM GB | HBM TB/s | FLOP per HBM byte | FLOP per interconnect byte |
|---|---|---|---|---|---|
| A100 SXM 80GB | 312 | 80 | 2.04 | 153 | 1040 |
| H100 SXM 80GB | 989 | 80 | 3.35 | 295 | 2198 |
| TPU v4 | 275 | 34 (32 GiB) | 1.20 | 229 | — |
| TPU v5e | 197 | 16 | 0.82 | 241 | 1018 |
The last two columns are the key ratios. A chip can do hundreds of FLOPs in the time it reads one byte from its own memory, and about a thousand per byte that arrives from another chip. The slides’ “1018 FLOPs/byte” is the TPU v5e’s peak divided by its interconnect bandwidth.
The NVLink figures (300 / 450 GB/s per direction) are half of NVIDIA’s bidirectional totals. Compute is cheap; moving data is expensive, and every design below follows from that.
2.2 Arithmetic intensity and the roofline
A kernel’s arithmetic intensity is its FLOPs divided by the bytes it moves. A chip with peak and bandwidth can sustain at most This is the roofline: a slanted roof (bandwidth-bound) up to the ridge point , then a flat roof (compute-bound).
For a matrix multiply , the FLOPs are and the bytes are in bf16.
- Square matrices ( times ): . That is 43 for and 2,731 for . Big square matmuls are compute-bound on every chip.
- A weight matrix applied to tokens (a linear layer, ): the weights dominate the bytes, so . For the intensity is 1, 16, 125, 878 for = 1, 16, 128, 1024.
On an H100 a layer is memory-bound until about 300 tokens share each weight read (153 on an A100, about 240 on TPUs). This one fact explains two things:
- Training uses large batches.
- Generating one token at a time is bandwidth-bound (Lecture 16).
Measured on this computer (script 01, Part 3, numpy float32 on the machine that ran the scripts; timings vary run to run):
| case | measured |
|---|---|
| matrix-matrix products, = 1024–8192 | 2.0–2.7 TFLOP/s |
| matrix-vector product, = 1024 (4 MB, fits in cache) | 169 GFLOP/s, i.e. 338 GB/s effective |
| matrix-vector product, = 8192 (256 MB, from DRAM) | 78 GFLOP/s, i.e. 156 GB/s |
Matrix-vector products sit at intensity 0.5. While the matrix fits in the chip’s caches, they run above the DRAM roof: caches are a higher, smaller roof, the same reason FlashAttention keeps tiles in SRAM (Lecture 16).
2.3 GEMM units: many small or few large (slide 51)
GPUs have many small matrix units; the slides’ cartoon shows 8×4×8 tensor-core operations. TPUs have a few large systolic arrays: a TPU v4 TensorCore has four 128 × 128 arrays.
In a weight-stationary systolic array:
- each cell holds one weight;
- inputs stream in from the left, skewed by one cycle per row;
- every cell multiplies, adds the partial sum from above, and passes data to its right and bottom neighbours.
There are no long wires and no memory reads inside the array. That is why such an array packs 16,384 multiply-accumulates into one unit.
Script 01, Part 4 simulates one cycle by cycle. The result equals X @ W to . The array is busy only when many rows stream through: utilization is , which gives 40% for 4 rows through a 4 × 4 array and 97% for 512 rows through an 8 × 8 one. Matrix units want big matrices.
3. Collectives
Every parallel scheme is a pattern of three operations among devices that each hold an array of numbers.
| collective | before | after | ring cost per device |
|---|---|---|---|
| all-reduce | each device holds its own array | every device holds the sum | |
| reduce-scatter | each device holds its own array | device holds piece of the sum | |
| all-gather | device holds piece | every device holds all pieces |
The ring algorithms. Arrange the devices in a ring and cut each array into chunks.
- Reduce-scatter takes steps. In each, every device sends one chunk’s running sum to its neighbour, which adds its own copy of that chunk. After steps, device holds the complete sum of chunk .
- All-gather forwards finished chunks around the ring in the same way.
- All-reduce = reduce-scatter + all-gather.
Each device sends of the array per phase, under one array whatever is. The naive alternative, where everybody sends to device 0 and device 0 sends the sum back, makes device 0 send arrays.
Script 02 (1M-element arrays). Elements sent by the busiest device, as a multiple of :
| devices | ring | naive | ring steps |
|---|---|---|---|
| 4 | 1.500 | 3 | 6 |
| 8 | 1.750 | 7 | 14 |
| 32 | 1.938 | 31 | 62 |
Results are exact up to the order of additions ().
Latency vs bandwidth. A time model with latency per step and bandwidth gives:
- Small messages are latency-bound. With 1 KB on 512 devices, the ring takes 5.1 ms of pure latency, while the naive algorithm’s 2 steps take 0.02 ms. Libraries switch to tree algorithms for small messages.
- Large messages are bandwidth-bound, and the time is nearly independent of . With 10 GB, the ring takes 175 ms on 8 devices and 205 ms on 512 (at = 5 µs, 100 GB/s).
What it means for GPT-3. All-reducing its 350 GB of bf16 gradients once per step takes 2.3 s over A100 NVLink. At 3.2M tokens per step on 1,024 chips, that is about a fifth of the ideal compute time (10.5 s), and it can overlap with the backward pass. Communication is not what kills pure data parallelism; memory is (§6).
4. Sharding a matmul, an MLP, attention
4.1 One matrix multiply (slides 52–59)
Take with of size and of size . There are three ways to split it:
- (a) Split the contraction dimension. Shard by rows and by columns. Each device computes , a partial sum of the whole output, which must be all-reduced (or reduce-scattered if a sharded output is fine).
- (b) Split the output dimension. Shard by columns and replicate . Each device computes some columns of , and no communication is needed.
- (c) Split the batch. Shard by rows and replicate . This is data parallelism; no communication is needed in the forward pass.
Script 03, Part 1: all three equal to . Without the all-reduce, a device’s partial product in case (a) is off by up to 28.7.
4.2 The MLP (slides 60–61)
For there are two approaches.
Approach 1: split by columns and by rows. The pre-activations are then partial sums, and (1.955 vs 1.682 at ). So the devices must all-reduce the pre-activations before the GELU. Skipping that gives an output off by up to 12.9.
Approach 2 (Megatron): split by columns, so each device owns some hidden units and applies the GELU to them locally. Then split by the matching rows, so each device computes a partial sum of the output. A single all-reduce of the output finishes the block. Here that moved 4× less data than approach 1 ().
4.3 Backward: the f and g operators (slide 61)
Megatron writes approach 2 as , with two conjugate operators:
- : all-reduce in the forward pass (sum the partial outputs); identity in the backward pass. The output gradient is the same on every device.
- : identity in the forward pass (the input is replicated); all-reduce in the backward pass. Each device has only a partial gradient with respect to the input, .
Weight gradients never leave their device. Script 03, Part 3 checks every gradient against the single-device one: and match exactly, to .
4.4 Attention (slides 62–63)
Attention’s softmax is a nonlinearity per head, so attention is split by heads:
- , , by columns (each device gets whole heads);
- by rows;
- one all-reduce of the output.
With 8 heads on 4 devices (2 per device), script 03 matches full attention to .
4.5 The cost of a tensor-parallel Transformer layer (slide 71)
A layer needs 4 all-reduces of a activation per training step: attention and MLP, forward and backward.
The slides compute the arithmetic intensity for one matmul whose output is reduce-scattered:
A whole layer has a constant factor more: about in script 03, Part 5. Either way, tensor parallelism pays only for wide layers split few ways. For split 64 ways, the intensity falls to 878 FLOP/byte, below the interconnect’s ~1,000.
5. Training in parallel: same mathematics, different traffic
Script 04 trains one model (4 residual MLP blocks, , hidden 256, 131,136 parameters, batch 256, 30 SGD steps) five ways on 8 simulated devices:
| scheme | final loss | max |param − single device| | elements sent per step | params held | activations stored |
|---|---|---|---|---|---|
| one device | 0.099742 | — | 0 | 131,136 | 589,824 |
| data parallel | 0.099742 | 5.6e-17 | 229,488 | 131,136 | 73,728 |
| tensor parallel (Megatron) | 0.099742 | 6.9e-17 | 229,376 | 16,448 | 131,072 |
| FSDP | 0.099742 | 5.6e-17 | 344,176 | 49,160 | 73,728 |
| FSDP × TP (2 × 4 mesh) | 0.099742 | 1.1e-16 | 131,136 | 16,416 (+32,832 gathered) | — |
All five compute the same thing. The parameters agree to . Parallelism changes where numbers live and what is communicated, never the mathematics. That is also the test every real implementation must pass.
Data parallelism (slides 64–65).
- Layout: each device keeps all parameters and processes of the batch.
- Communication: the gradients are all-reduced, per step (229,488 here). Each device stores of the activations.
- Scaling: the speedup is linear “as long as you scale batch linearly” (slide 64).
- Limit: memory. Every device holds the whole model and its optimizer state.
Tensor parallelism (slides 69–71).
- Layout: each device keeps of every block (Megatron split) and sees the whole batch.
- Communication: 2 all-reduces of the batch’s activations per block per step (229,376 here). This volume is independent of the number of parameters and grows with the batch.
- Memory: activations are replicated, so each device stores more of them than under DP.
FSDP / ZeRO-3 (slides 66–68).
- Layout: each device keeps of every parameter (and of its gradient and optimizer state) and processes of the batch.
- Forward pass: before each layer, the layer’s weights are all-gathered, used, and freed.
- Backward pass: the weights are all-gathered again, the local gradients are reduce-scattered (each device receives the summed gradient of exactly the piece it owns), and each device updates its piece.
Communication is per step: 344,176 here, 1.5× DP’s. In exchange, a device holds only its shard plus one full layer: 49,160 parameters instead of 131,136. The slides’ trick is to overlap the next layer’s all-gather with the current layer’s arithmetic.
FSDP × TP (slides 72–74). On a 2-D mesh, TP runs inside each row of devices, and FSDP shards those TP shards further across rows (and splits the batch across rows). “While processing layer , all-gather layer ; then it just becomes TP.”
Our simulation gathers each TP shard once per step and keeps it through the backward pass. A real FSDP implementation frees it and gathers it again.
6. Choosing a configuration
6.1 Memory (script 04, Part 2)
GPT-3 has + embeddings = 174.6B parameters. At 16 bytes per parameter, per chip:
| chips | scheme | GB per chip |
|---|---|---|
| any | data parallel | 2,793 |
| any | TP only, 16 shards | 175 |
| 256 | FSDP (or FSDP × TP) over all chips | 10.9 |
| 1024 | FSDP (or FSDP × TP) over all chips | 2.7 |
Only full sharding fits an 80 GB chip, let alone a 16 GB TPU v5e. Activations come on top; they are reduced by recomputing them in the backward pass (rematerialization).
6.2 The arithmetic-intensity rules (slides 68, 71, 74)
Communication can be hidden behind compute only if the chip does enough FLOPs per byte communicated.
- FSDP. All-gathering an layer moves bytes and enables FLOPs of the chip’s own work. The intensity is , the tokens per chip, so FSDP needs on TPU v5e.
- TP. The intensity is , so TP needs .
- Both. With both and a safety factor of 2: and .
TP lowers the batch per chip that FSDP needs, because each chip’s tokens are shared by chips. That is the point of combining them. On 256 TPUs as 16 TP × 16 FSDP, the rules give and : the slides’ “E > ~32k, BATCH_PER_CHIP > 125”.
Script 04, Part 3 checks configurations:
| TP shards | tokens per chip | ? | ? | |
|---|---|---|---|---|
| 32,768 | 16 | 128 | yes | yes |
| 32,768 | 16 | 64 | yes | no |
| 12,288 | 16 | 128 | no | yes |
| 12,288 | 4 | 512 | yes | yes |
| 12,288 | 1 (FSDP only) | 3,125 | yes | yes |
For GPT-3’s width only small TP degrees satisfy the TP rule. This is why models of that size use TP within a node (fast links) and FSDP / DP across nodes. GPT-3’s 3.2M tokens per step spread over 1,024 chips gives 3,125 tokens per chip: enough for pure FSDP.
7. Practical guidelines (slide 137), and what the slides leave out
The slides’ advice:
- To scale model and data, use FSDP as much as possible. Use TP (or DP, or sequence parallelism) to reduce the batch per chip when the global batch is not large enough.
- To scale context, use blockwise Transformers to reduce memory, and RingAttention to grow the context arbitrarily (Lecture 16).
Other axes exist, which the slides do not cover:
- Pipeline parallelism (GPipe, PipeDream): consecutive layers live on different devices, and micro-batches flow through them, with “bubbles” at the start and end of each batch.
- Sequence / context parallelism: split the sequence dimension, as RingAttention does.
- Expert parallelism: the experts of a mixture-of-experts layer live on different devices, with all-to-all communication (Lecture 16’s MoE).
Large training runs combine several of these into a multi-dimensional mesh. Compilers such as GSPMD / XLA derive the collectives from sharding annotations, so in practice one writes the sharding of each array and the system inserts what §4 derived by hand.
8. Summary
- Chips do hundreds of FLOPs per byte of memory traffic and about a thousand per byte of interconnect traffic. A kernel is compute-bound only above the ridge point. A linear layer’s arithmetic intensity is the number of tokens sharing each weight read, so training needs a few hundred tokens per chip per weight read.
- All-reduce, reduce-scatter and all-gather have ring algorithms that cost each device about one array per phase, independent of the number of devices, but latency steps.
- Split the output dimension of a matmul and nothing is communicated; split the contraction dimension and partial sums must be all-reduced. Megatron’s MLP (columns, then rows) needs one all-reduce forward (g) and one backward (f); attention splits by heads.
- DP, TP, FSDP and FSDP × TP reproduced single-device training to . They differ in memory and in traffic:
- DP: per step;
- FSDP: per step, holding plus one layer;
- TP: activations, independent of .
- For GPT-3, only full sharding fits in memory (10.9 GB per chip on 256 chips). The intensity rules (tokens per chip > ~1018 for FSDP, > ~1018 for TP) decide how to factor a mesh into FSDP and TP. The slides’ 256-TPU example needs and more than 125 tokens per chip.
9. Common pitfalls
- Quoting peak FLOP/s for memory-bound work: a matrix-vector product runs at bandwidth speed (0.5 FLOP/byte in float32).
- Applying a nonlinearity to partial sums. : split the hidden dimension, not the contraction dimension, before a nonlinearity.
- Forgetting the backward collectives. Megatron’s f is free forward but costs an all-reduce backward. Count both passes.
- Thinking FSDP saves communication. It costs 1.5× DP’s traffic; what it saves is memory.
- Thinking more TP is always better. The intensity falls with every extra shard, and TP’s traffic grows with the batch.
- Measuring “bandwidth” with one core. A single-threaded copy measured a lower bandwidth than a multi-threaded matrix-vector product on the same machine.
- Ignoring latency for small messages. A ring all-reduce of a few KB over hundreds of devices is all latency.
10. Exercises
Exercise 1 (ring all-reduce — derivation). Show that a ring reduce-scatter followed by a ring all-gather sends elements per device, and argue that (for algorithms in which each element of the sum is completed on one device) no all-reduce can send less on average.
Answer
Upper bound. Each of the reduce-scatter steps sends one chunk of elements per device, and so does each all-gather step: in total.
Lower bound. Each of the sums combines inputs held on different devices.
- Reduction. Whichever device completes a sum must receive information from the other devices. Partial sums can merge contributions, but every input except the local one must leave its device at least once. That is elements in total, or per device.
- Distribution. Every device must end with all sums. If the sums are completed evenly over the devices, each device must receive the sums it did not complete.
Together: per device. The ring meets the bound, so it is bandwidth-optimal (Patarasuk & Yuan, 2009). What it gives up is latency: sequential steps.
Exercise 2 (Megatron backward — derivation). For with (columns) and (rows), write and show it is a sum over devices of local terms. That is why f’s backward pass is an all-reduce.
Answer
Let and . Since , the chain rule gives . Each term needs only device ‘s shards and the replicated (g’s backward pass is the identity). The sum over is an all-reduce. The weight gradients and are local.
Exercise 3 (FSDP traffic and memory — derivation). With devices and parameters in equal layers, show that FSDP sends elements per device per step. Show that it holds parameters at most. Compare with DP.
Answer
Traffic. Each layer is all-gathered twice (forward pass, and again in the backward pass because it was freed), and its gradient is reduce-scattered once. Each of these costs of the layer, so summing over layers gives .
Memory. At any moment a device holds its own shards () and one gathered layer (); prefetching the next layer adds another .
DP sends and holds . FSDP trades 1.5× the traffic for an -fold memory reduction. Script 04: 344,176 vs 229,488 elements; 49,160 vs 131,136 parameters.
Exercise 4 (the slides’ FSDP rule — derivation). Derive the arithmetic intensity of an FSDP all-gather of an bf16 weight matrix that is then multiplied by tokens on the chip. Conclude that the batch per chip must exceed the chip’s FLOP-per-interconnect-byte ratio.
Answer
The all-gather brings in about bytes (the whole matrix in bf16, of which the chip already had ). The matmul does FLOPs, so the intensity is .
To hide the all-gather behind the matmul, the matmul must take at least as long: , i.e. . That is 1018 on TPU v5e; the slides ask for “comfortably larger”.
Exercise 5 (TP vs DP traffic). For a Transformer layer of width and a batch of tokens, compare TP’s per-step traffic ( elements) with DP’s ( elements). For which batch sizes does TP communicate less?
Answer
TP communicates less when , i.e. . For that is tokens per TP group per step.
DP’s traffic is fixed by the parameters. TP’s grows with the batch but not with the parameters, which is why TP suits large models with modest per-group batches, and DP / FSDP suit large batches.
Exercise 6 (coding). Change script 04 to 16 devices (with ; the FSDP × TP mesh becomes 4 × 4). Predict the elements sent per step by DP and FSDP before running it.
Answer
DP: . FSDP: (measured 368,760: uneven chunks). TP: 2 all-reduces of per block over 4 blocks, . Measured: 245,880 / 368,760 / 245,760, and the parameters still match the single device to ~1e-16.
Exercise 7 (systolic arrays). Show that a weight-stationary array needs cycles for input rows. How many rows are needed for 90% utilization of a 128 × 128 array?
Answer
Row enters the array’s row at cycle ; its last partial sum reaches the bottom of column after more hops. The last row () finishes at cycle , so the array needs cycles.
Utilization is when for . Large matmuls (or many tokens) keep the MXU busy.
11. Further reading
From the slides
- M. Shoeybi et al. Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism, 2019.
- Rafi W. Sharding Techniques: Single Slice Sharding for Dense LLMs (the source of the FSDP / TP intensity rules on the slides).
- Google Cloud TPU documentation (system architecture, the MXU).
- H. Liu, P. Abbeel. Blockwise Parallel Transformer for Large Context Models, NeurIPS 2023; H. Liu, M. Zaharia, P. Abbeel. Ring Attention with Blockwise Transformers for Near-Infinite Context, 2023 (Lecture 16).
Added by these notes
- S. Rajbhandari et al. ZeRO: Memory Optimizations Toward Training Trillion Parameter Models, SC 2020; Y. Zhao et al. PyTorch FSDP: Experiences on Scaling Fully Sharded Data Parallel, VLDB 2023.
- S. Williams, A. Waterman, D. Patterson. Roofline: An Insightful Visual Performance Model for Multicore Architectures, CACM 2009.
- H. T. Kung. Why Systolic Architectures?, IEEE Computer 1982; N. Jouppi et al. In-Datacenter Performance Analysis of a Tensor Processing Unit, ISCA 2017; TPU v4, ISCA 2023.
- P. Patarasuk, X. Yuan. Bandwidth Optimal All-Reduce Algorithms for Clusters of Workstations, JPDC 2009 (the ring’s optimality).
- Y. Xu et al. GSPMD: General and Scalable Parallelization for ML Computation Graphs, 2021; D. Narayanan et al. Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM, SC 2021 (TP + pipeline + DP).
- V. Korthikanti et al. Reducing Activation Recomputation in Large Transformer Models, 2022 (sequence parallelism, activation memory).
- J. Austin et al. How to Scale Your Model (Google DeepMind, 2025) — a book-length version of this lecture for TPUs.
12. Next lecture
Lecture 24 is the first guest lecture: generative models for science (John Ingraham). These notes cover only its general modeling methods, on abstract toys:
- likelihoods of a generative model as zero-shot predictors;
- amortized sampling of Boltzmann distributions with flows;
- symmetry-aware (equivariant) diffusion on point clouds;
- composable conditioning of diffusion models.