1 00:00:01,000 --> 00:00:09,300 [Hal Turing] Alrighty! Thanks for tuning in! Hello AI world! I am your host, Hal Turing, and my co-host is Dr. Ada Shannon. 2 00:00:09,300 --> 00:00:35,400 [Hal Turing] Today we're looking at FastPersist: Accelerating Model Checkpointing in Deep Learning. It's by Guanhua Wang and colleagues Olatunji Ruwase, Bing Xie and Yuxiong He, all on the Microsoft DeepSpeed team, posted to arXiv on June 19th, 2024. The question is whether checkpointing can get fast enough that you save every single iteration and it costs almost nothing, while still writing straight to persistent storage. 3 00:00:35,400 --> 00:00:58,325 [Dr. Ada Shannon] The stakes are that most big training jobs checkpoint rarely because saving is slow, so every failure throws away a lot of work. The paper's opening point is an imbalance. Data parallelism made compute faster, but checkpoint time didn't shrink with it. In their Figure 1, on V100s up to 128 GPUs, checkpointing goes from 50% to 89% of iteration time for a dense model, and from 82% to 96% for a sparse one. 4 00:00:58,325 --> 00:01:05,450 [Hal Turing] So the checkpoint becomes the whole iteration. Why do we checkpoint at all, and why not just do it rarely? 5 00:01:05,450 --> 00:01:27,300 [Dr. Ada Shannon] Fault tolerance first. Clusters with thousands of GPUs fail often, and OPT-175B, BLOOM and Llama 3 all reported frequent interruptions. Checkpoints are also reused for inference, fine-tuning and distillation. Because saving is expensive, people checkpoint every tens or hundreds of iterations to keep overhead around 10%. That raises the work lost per failure. 6 00:01:27,300 --> 00:01:30,725 [Hal Turing] And what's in a checkpoint? Is it just weights? 7 00:01:30,725 --> 00:01:52,900 [Dr. Ada Shannon] No, and that's why it's big. With mixed-precision Adam you also store FP32 master weights, momentum and variance, plus the data-loader position and learning-rate schedule. That's roughly 14 bytes per parameter. In the paper's Table 2 that's about 10 GB for the 0.7B GPT-3 model and 173 GB for the 13B one. The 1.8B mixture-of-experts model is 67 GB. 8 00:01:52,900 --> 00:02:00,725 [Hal Turing] Fine, so 173 GB is large. But modern SSDs are fast. Why is writing it slow? 9 00:02:00,725 --> 00:02:23,875 [Dr. Ada Shannon] Because torch.save doesn't write one big block. It serializes many tensors with metadata, so the SSD sees a stream of small, unaligned writes. Fast NVMe writes need asynchronous I/O, meaning libaio or io_uring, with many requests in flight. They also need DMA from pinned, page-locked CPU memory, and 512-byte alignment. Without a direct GPU-to-SSD path, data hops from GPU to pinned DRAM to SSD. 10 00:02:23,875 --> 00:02:30,600 [Hal Turing] It's like launching one tiny GPU kernel at a time and wondering why utilization is bad. 11 00:02:30,600 --> 00:02:46,725 [Dr. Ada Shannon] That mapping works. The queue stays shallow, so the drive idles. The analogy stops at flash behavior, though. Sustained write speed can drop once the drive's fast cache fills, and per-iteration saving multiplies wear. The paper doesn't get into either. 12 00:02:46,725 --> 00:02:51,375 [Hal Turing] Now the structure they exploit. What has to be true for overlap? 13 00:02:51,375 --> 00:03:18,475 [Dr. Ada Shannon] An iteration is forward, backward, then the optimizer step. The checkpoint reads the optimizer's output, so it must finish before the next optimizer step. It doesn't depend on the next forward and backward passes, and the paper says those are over 90% of compute time. That gap is the window for overlap. Second, under data parallelism every replica holds identical state after the optimizer step. In the baseline, rank 0 writes everything while the other ranks wait. With model parallelism added, one rank per model slice writes. 14 00:03:18,475 --> 00:03:23,500 [Hal Turing] So what exactly is the baseline everything gets measured against? 15 00:03:23,500 --> 00:03:47,050 [Dr. Ada Shannon] torch.save with rank 0 writing the whole checkpoint to a local RAID-0 of eight NVMe drives per DGX-2 node. RAID-0 means striped with no redundancy, and the combined peak write is 24.8 GB/s. Against that, the baseline reaches under 20% of peak for all five dense models, about 3% for the 0.7B model, and only around 4 GB/s on the MoE. Every speedup later is relative to that. 16 00:03:47,050 --> 00:03:50,250 [Hal Turing] Three percent is a very low bar. 17 00:03:50,250 --> 00:04:11,325 [Dr. Ada Shannon] Hold that thought, because it matters later. One more definition: the lost-work formula. Average recovery overhead is n over two, times m, times t. n is the checkpoint interval in iterations, m the GPU count, t the iteration time. It assumes failure at a random point in the interval, and it's smallest at n equals one. It measures wasted GPU time per failure, not throughput under a failure rate. 18 00:04:11,325 --> 00:04:14,825 [Hal Turing] What problems do the authors say they're attacking? 19 00:04:14,825 --> 00:04:34,300 [Dr. Ada Shannon] Three. Inefficient SSD writes. Ineffective decoupling, where prior work snapshots to volatile memory and then flushes later, and targets infrequent checkpointing. And expensive recovery when checkpoints are infrequent. Whether n equals one is actually the right target is a separate question, and I'd keep it open rather than accept it. 20 00:04:34,300 --> 00:04:37,000 [Hal Turing] Who's already working in this space? 21 00:04:37,000 --> 00:04:55,275 [Dr. Ada Shannon] CheckFreq: Frequent, Fine-Grained DNN Checkpointing, by Jayashree Mohan, Amar Phanishayee and Vijay Chidambaram, 2021. It's the two-phase design the paper criticizes: a fast snapshot in memory, then a background flush to disk. It also auto-tunes the checkpoint frequency. 22 00:04:55,275 --> 00:05:16,700 [Dr. Ada Shannon] Check-N-Run, from Meta, by Assaf Eisenman and colleagues at NSDI 2022, targets recommendation models with huge embedding tables. It shrinks the bytes written, using differential checkpoints and quantization. Gemini: Fast Failure Recovery in Distributed Training with In-Memory Checkpoints, by Zhuang Wang and colleagues in 2023, checkpoints into the CPU memory of peer machines instead of disk. 23 00:05:16,700 --> 00:05:22,850 [Hal Turing] So those are three different axes: when you flush, how many bytes, and where they land. 24 00:05:22,850 --> 00:05:39,250 [Dr. Ada Shannon] Yes. FastPersist's axis is how fast bytes reach local SSDs, and it builds on the NVMe machinery from ZeRO-Infinity, a 2021 paper by Samyam Rajbhandari, Ruwase and others that offloaded training state to NVMe. 25 00:05:39,250 --> 00:05:47,650 [Hal Turing] Okay, so the baseline wastes the disk. What does FastPersist change on a single GPU, before any parallelism? 26 00:05:47,650 --> 00:06:09,900 [Dr. Ada Shannon] Three things, all on the write path. First, it swaps the ordinary file calls for async I/O, libaio and io_uring, so many writes can be in flight at once. Second, there are two hops. Data goes from GPU memory to pinned CPU memory, then from there to the SSD. Done in sequence, one hop idles while the other works. So they double-buffer: the second GPU-to-DRAM copy starts when the first is halfway done, and the two transfers overlap. 27 00:06:09,900 --> 00:06:18,575 [Hal Turing] And the alignment problem? You said the DMA wants 512-byte multiples, but torch.save emits odd-sized writes. 28 00:06:18,575 --> 00:06:43,675 [Dr. Ada Shannon] They handle it two ways. For a checkpoint that isn't a clean multiple, they split it into an aligned prefix and a tiny suffix, under 512 bytes. The prefix goes through the fast path and the suffix through ordinary I/O, into the same file. For the stream of small serialized tensors, they queue the pending bytes and flush whenever a full aligned chunk exists. A tensor's bytes can land in different writes, but the order on disk never changes. So the file loads normally, with no padding. 29 00:06:43,675 --> 00:06:47,250 [Hal Turing] Design two is the data-parallel part? 30 00:06:47,250 --> 00:07:07,676 [Dr. Ada Shannon] Yes. Replicas hold identical state, so each rank writes a slice instead of rank 0 writing everything. The partition is fixed at setup, so there's no communication at checkpoint time. They split by bytes after serialization, which keeps imbalance to at most one byte. Splitting by layer would be lopsided, because embeddings and transformer blocks differ in size. 31 00:07:07,676 --> 00:07:10,551 [Hal Turing] Why not use every rank, then? 32 00:07:10,551 --> 00:07:31,326 [Dr. Ada Shannon] Slices get too small for efficient writes, and ranks start fighting over PCIe and the SSD. So they allow a subset, such as one writer per CPU socket. On the 10 GB model they measured 41.8 GB/s on two nodes and 129.8 GB/s on eight. Loading runs in reverse: each rank reads its slice, then an allgather rebuilds the full state. 33 00:07:31,326 --> 00:07:34,301 [Hal Turing] And the third piece is overlap. 34 00:07:34,301 --> 00:07:54,301 [Dr. Ada Shannon] The checkpoint overlaps the next forward and backward pass, and the next optimizer step waits for it to finish. They use a second process per rank rather than a thread, because of Python's GIL. It only reads existing GPU tensors, uses DMA, and needs no GPU collectives, so it mostly consumes CPU and I/O rather than GPU cycles. 35 00:07:54,301 --> 00:07:56,226 [Hal Turing] What's the testbed? 36 00:07:56,226 --> 00:08:16,226 [Dr. Ada Shannon] Eight DGX-2 nodes, 128 V100s, 24.8 GB/s peak per node. GPT-3-style dense models from 0.7B to 13B, plus a 1.8B mixture-of-experts. It hooks into torch.save's file-object interface inside DeepSpeed, so serialization is unchanged. 37 00:08:16,226 --> 00:08:23,876 [Hal Turing] Now the headline. Up to 116 times faster. How much of that is the clever NVMe work? 38 00:08:23,876 --> 00:08:53,851 [Dr. Ada Shannon] Less than it sounds. On one GPU, against torch.save, the new path is 1.8 to 6.6 times faster, and the 6.6 comes from double buffering with a well-chosen buffer size. Tuning matters: best versus worst buffer size is 2.87 times at 512 MB. The MoE at DP=1 gets 7 times. The big multipliers come from DP. At DP=8 the MoE gets 32 times. By my arithmetic, not the authors', sharding adds about 4.6 times, against an ideal 8. 39 00:08:53,851 --> 00:08:58,951 [Hal Turing] So 116 is mostly many writers on many disks. 40 00:08:58,951 --> 00:09:13,901 [Dr. Ada Shannon] Mostly, yes. Sharded writes aren't new, and the baseline is weak: about 3% of disk peak for the 0.7B model. The paper never runs a full-scale ablation, so the split is inferred from separate micro-benchmarks. 41 00:09:13,901 --> 00:09:17,226 [Hal Turing] And the speedup holds as models grow? 42 00:09:17,226 --> 00:09:56,551 [Dr. Ada Shannon] No. On a fixed 128 GPUs, bigger models mean smaller DP. Checkpoint speedup falls from 116 times for 0.7B to 28 times for 13B. End to end it falls much harder: about 19.5 times for 0.7B, about 1.6 for 13B. The text says 21.8 for the small one, but the figure shows 19.5, so that's an inconsistency. Several of the stated percentages of SSD peak also don't reproduce. 129.8 GB/s over eight nodes' 198 GB/s is about 65%, not the 87% the paper states. Quote the gigabytes per second. 43 00:09:56,551 --> 00:10:00,051 [Hal Turing] But the MoE goes the other way? 44 00:10:00,051 --> 00:10:18,251 [Dr. Ada Shannon] At DP=8 its end-to-end speedup is 15 times, versus under 2 for the 13B dense model. The authors say sparse models checkpoint more data relative to compute. That fits, though they didn't isolate it. Any run with large checkpoints and little compute gets amplified. 45 00:10:18,251 --> 00:10:24,051 [Hal Turing] Last piece: does pipelining actually make per-iteration checkpointing nearly free? 46 00:10:24,051 --> 00:10:44,477 [Dr. Ada Shannon] For the 1.3B to 13B dense models on eight nodes, overhead is under 5% with pipelining. That's about one iteration in twenty, at worst. It depends on gradient accumulation steps, though. On the 1.3B model pipelining helped below 64 steps, and the slowdown was 8% at 8 steps. The 0.7B model isn't in that claim. 47 00:10:44,477 --> 00:10:46,477 [Hal Turing] That's all measured? 48 00:10:46,477 --> 00:11:01,777 [Dr. Ada Shannon] The eight-node numbers, yes. The 2,000-GPU results are simulated projections. And all of it is one V100 cluster, where iterations are slow. Faster GPUs shorten the window the checkpoint has to hide in. 49 00:11:01,777 --> 00:11:13,527 [Hal Turing] So the question I can't shake is baseline fairness. How much of the 116x is FastPersist's ideas, and how much is just not being rank-0 torch.save? 50 00:11:13,527 --> 00:11:34,152 [Dr. Ada Shannon] The paper can't separate them. The only baseline is PyTorch's default path, with rank 0 writing everything. It never compares against PyTorch's Distributed Checkpoint, a CheckFreq-style snapshot-then-persist scheme, Gemini, or even plain torch.save with sharded writes. So "up to 116x" measures distance from the default, not from current practice. 51 00:11:34,152 --> 00:11:36,702 [Hal Turing] What experiment would settle it? 52 00:11:36,702 --> 00:11:55,852 [Dr. Ada Shannon] Run DCP or sharded torch.save on the same cluster, then run FastPersist's write path with and without DP sharding. The first tells you how much a stronger baseline shrinks the gap. The second isolates what the NVMe engineering contributes, which so far looks like a few times, not tens. 53 00:11:55,852 --> 00:12:08,452 [Hal Turing] Fine. Now the bigger bet, checkpointing every iteration. The justification is the lost-work formula, n over two times m times t. Does the paper test that against failures? 54 00:12:08,452 --> 00:12:33,002 [Dr. Ada Shannon] No. There are no injected failures, no goodput under a failure rate, and no comparison against a tuned interval. The formula counts lost iterations but ignores checkpoint cost, and that cost is exactly what the Young/Daly interval balances. If overhead is under 5% at n=1, does it beat n=10 at maybe half a percent? That depends on real failure rates, and the paper can't tell us. CheckFreq at least tunes frequency by profiling. FastPersist just assumes one. 55 00:12:33,002 --> 00:12:40,477 [Hal Turing] The paper also says writing straight to SSD means no risk of data loss. That sounds airtight. 56 00:12:40,477 --> 00:13:01,527 [Dr. Ada Shannon] It's narrower than it sounds. It avoids the volatile-snapshot window. But checkpoint i is still being written while iteration i+1 computes, so a crash then falls back to i-1. The bigger issue is that each rank writes its slice to its own node's RAID-0. That has no redundancy, and nothing in the paper replicates the slices. If a node dies, its slice may die with it. 57 00:13:01,527 --> 00:13:04,752 [Hal Turing] And node loss is a common failure. 58 00:13:04,752 --> 00:13:25,527 [Dr. Ada Shannon] Yes, and Gemini targets that case with replication in peer memory. The HPC multi-level checkpointing work, like SCR from Moody and colleagues, pairs a fast local tier with partner redundancy and a periodic global copy. I'd frame this as an open question, not a proven flaw. The paper just never runs a kill-a-node recovery experiment. 59 00:13:25,527 --> 00:13:28,752 [Hal Turing] What else is left open on recovery? 60 00:13:28,752 --> 00:13:51,027 [Dr. Ada Shannon] Restore time is described but never benchmarked. The partition is fixed at setup. So restarting with fewer nodes, say DP 96 after training at 128, means repartitioning, and the paper doesn't say how. ByteCheckpoint, from Borui Wan and colleagues in 2024, handles resharding on load, so that gap is solvable. Atomicity is also unaddressed. With slices spread across ranks, how do you know all of them belong to the same iteration? 61 00:13:51,027 --> 00:13:52,952 [Hal Turing] Torn checkpoints. 62 00:13:52,952 --> 00:13:56,777 [Dr. Ada Shannon] Right. I'd expect a commit marker, but it isn't described. 63 00:13:56,777 --> 00:14:02,877 [Hal Turing] Beyond the missing recovery tests, what limits how far the performance results travel? 64 00:14:02,877 --> 00:14:26,652 [Dr. Ada Shannon] Hardware generation is the main one. Besides the simulated 2,000-GPU numbers, the measured cluster is eight V100 nodes with slow iterations. On H100-class machines the forward and backward window gets shorter, so the checkpoint has less compute to hide behind, and the paper's own overlap condition gets harder to meet. Also unmeasured are sustained writes, SSD wear from rewriting huge files every iteration, and the helper process's host-memory footprint. 65 00:14:26,652 --> 00:14:33,278 [Hal Turing] And if most big jobs now use ZeRO or FSDP, where the state isn't replicated? 66 00:14:33,278 --> 00:14:48,778 [Dr. Ada Shannon] Then the replica-redundancy insight doesn't apply as stated. Each rank must write its own shard, which parallelizes naturally. The NVMe write path and the overlap could still help, but the paper never measures that configuration. 67 00:14:48,778 --> 00:14:52,303 [Hal Turing] Is any of this combinable with other work? 68 00:14:52,303 --> 00:15:14,578 [Dr. Ada Shannon] Check-N-Run shrinks the bytes with differential checkpoints and quantization. FastPersist moves bytes faster. They attack different axes, so they could combine, though lossy quantization sits awkwardly with a no-precision-loss pitch. The follow-ups I'd want are FastPersist against DCP, and against Gemini on node-loss recovery. A GPUDirect Storage path would also remove the pinned-DRAM hop. 69 00:15:14,578 --> 00:15:17,178 [Hal Turing] So what should a practitioner do? 70 00:15:17,178 --> 00:15:37,278 [Dr. Ada Shannon] If you have a large-DP job saving through rank-0 torch.save, sharding the writes and using async NVMe I/O is probably a cheap, big win. The paper says it plans to open-source this into DeepSpeed, which would make it easy to adopt. But pick your interval from your failure rate, restart cost and node-loss handling, not from this paper. 71 00:15:37,278 --> 00:16:01,578 [Hal Turing] Then here's where I land. The work shows checkpoint stalls can mostly be hidden behind compute and sharded across data-parallel ranks. On this cluster, that takes a save from tens of seconds to a small fraction of an iteration. The boundary is that it's measured only against the default single-writer path, with no failure model, and with durability on node-local disks left open. 72 00:16:01,578 --> 00:16:09,628 [Dr. Ada Shannon] Agreed. The mechanism is credible, but the claim that every-iteration checkpointing pays for itself is still unproven. 73 00:16:09,628 --> 00:16:13,478 [Hal Turing] Thanks for listening, everyone. See you next time.