How to Build a Training Foundation for Large Models: Network, Parallelism, Storage, and Fault Tolerance

    This article walks through the key decisions for building a training foundation for large language models. It covers network topology, 3D parallelism, memory optimization, checkpointing and data pipelines, and fault tolerance. It also points to configurations and metrics that developers can check directly.

    Training a large model starts with a stable cluster. Compute, networking, storage, and scheduling can each become a bottleneck. From a developer’s perspective, this article follows the training pipeline, covers the key decisions at each stage, and provides configurations and metrics you can check directly.

    1. Network Topology Design

    In clusters of ten thousand GPUs, gradient synchronization and parameter updates generate heavy cross-node traffic. When the network slows down, GPUs spend more time waiting, and model FLOPs utilization (MFU) drops.

    A common approach is to build the network with RoCE or InfiniBand, using a non-blocking fat-tree topology with a 1:1 convergence ratio. This lets any two nodes reach near line-rate bandwidth. When choosing a design, check three things: whether the convergence ratio is sufficient, whether the number of switch layers is manageable, and whether paths converge quickly enough after a link failure.

    Once the topology is set, the training framework needs to be aware of it. Keep tensor parallel (TP) communication groups within a single node so they run over NVLink. Place data parallel (DP) and pipeline parallel (PP) communication on the inter-node network. This usually reduces congestion across racks.

    2. Choosing a TP, PP, and DP Combination

    Large model training often uses 3D hybrid parallelism. The three methods differ in communication cost and memory savings:

    Parallelism Type Main Role Communication Pattern Applicable Limits
    Tensor parallelism (TP) Splits the weights of a single layer to reduce per-GPU memory Communication at every layer, high frequency Usually no more than the number of GPUs in a node, using the high-speed interconnect within the node
    Pipeline parallelism (PP) Splits the model by layers into multiple stages Only activations pass between stages, so communication volume is small The model needs enough layers, otherwise the pipeline bubble ratio is high
    Data parallelism (DP) Replicates the model to increase throughput One gradient synchronization (AllReduce or ReduceScatter) per step More replicas mean higher synchronization overhead

    PP typically uses the 1F1B (One Forward One Backward) schedule, which alternates forward and backward passes to reduce pipeline bubbles.

    Do not apply fixed parallelism values by default. The function below takes the parallelism degrees as parameters and performs basic validation:

    1. def configure_3d_parallel(world_size, gpus_per_node, num_layers, tp_size, pp_size):
    2. # Limit tensor parallelism to a single node to use the high-bandwidth intra-node interconnect
    3. if tp_size > gpus_per_node:
    4. raise ValueError("tp_size should not exceed the number of GPUs per node")
    5. if world_size % (tp_size * pp_size) != 0:
    6. raise ValueError("world_size must be divisible by tp_size * pp_size")
    7. if pp_size > num_layers:
    8. raise ValueError("pp_size must not exceed the number of model layers")
    9. dp_size = world_size // (tp_size * pp_size)
    10. # If the layer count is not evenly divisible, uneven partitioning is needed. This value is only a reference.
    11. layers_per_stage = num_layers / pp_size
    12. return {
    13. "tensor_model_parallel_size": tp_size,
    14. "pipeline_model_parallel_size": pp_size,
    15. "data_parallel_size": dp_size,
    16. "layers_per_stage": layers_per_stage,
    17. }

    Many people set pp_size equal to the number of nodes. This reduces dp_size to 1 and leaves the extra GPUs unused. A safer approach is to first determine pp_size based on the model’s layer count and per-GPU memory, then derive dp_size from the remaining GPU count. Before going live, run several configurations on a small cluster, record the MFU and peak memory for each, and then scale up gradually.

    3. Memory Optimization and Operator Fusion

    Beyond model parameters, optimizer states and activations also consume a large share of GPU memory. ZeRO partitions memory in three stages. ZeRO-1 partitions optimizer states, ZeRO-2 also partitions gradients, and ZeRO-3 further partitions model parameters. Higher stages save more memory per GPU but require more communication to gather parameters. ZeRO-3 is sensitive to network bandwidth. When bandwidth is insufficient, training speed can drop noticeably, so compare options with measured data before choosing one.

    Standard attention implementations store the full attention matrix, so memory grows quadratically with sequence length. FlashAttention computes attention in blocks and does not store the full matrix. During backpropagation, it recomputes attention and saves only a small set of softmax statistics. This adds some computation but reduces reads and writes to HBM (high-bandwidth memory), so overall speed is often higher.

    Activation recomputation is another trade-off. It skips storing activations for some layers and recalculates them during the backward pass, trading compute for memory.

    4. Checkpoints and Data Pipelines

    When data loading cannot keep up with GPU computation, I/O becomes the bottleneck. Training datasets often reach several terabytes, and checkpoints are large files written periodically. Both compete for storage bandwidth.

    For the data pipeline, use asynchronous prefetching with multiple processes or threads so the next batch is ready while the GPU is computing. Cache tokenized data chunks to reduce repeated disk reads.

    Estimate storage bandwidth before deciding on a design. For mixed-precision training with the Adam optimizer, the state for each parameter totals roughly 12 to 16 bytes, depending on precision and implementation. A checkpoint for a 100B-parameter model is about 1.4 TB. To finish writing within 5 minutes, the aggregate write bandwidth must be about 4.7 GB/s. Measure the actual capability of the parallel file system at your cluster’s scale rather than relying only on vendor-rated figures.

    Asynchronous saving writes to local NVMe storage or memory first, while training continues. A background process then uploads the checkpoint to object storage or the parallel file system. This approach has three key practices:

    1. Write to a temporary directory first, then atomically rename it after all shards are written. This prevents readers from loading a partially written file.
    2. After writing, generate a manifest file and verify checksums. A version without a manifest is treated as invalid.
    3. Keep the local copy until the upload is confirmed, and retain the most recent N valid versions.

    If versions are inconsistent, asynchronous saving can cause recovery to fail or even lose the most recent progress. Do not skip manifest checks and recovery tests.

    Calculate the checkpoint interval as well. Young’s approximation gives an optimal interval of about √(2 × time to save one checkpoint × mean time between failures). For example, if a save takes 60 seconds and the mean time between failures is 6 hours, the optimal interval is about 27 minutes. This is only a starting point. Adjust the actual value based on recovery time and storage cost.

    5. Fault Tolerance and Resuming Training

    In clusters of ten thousand GPUs, hardware failures are routine. The goal of the training foundation is to return to the most recent valid state as quickly as possible after a failure.

    For scheduling, use Kubernetes with a GPU device plugin to manage heterogeneous compute in a unified way. Define training resource requirements declaratively, and set anti-affinity rules so that pods of the same job spread across different failure domains.

    Fault detection should focus on several signals: GPU ECC errors and XID errors, NCCL communication timeouts, lost node heartbeats, and abnormal increases in per-step training time. When the system detects a faulty node, it isolates that node, restores from the most recent valid checkpoint, rebuilds the communication group on healthy nodes, and resumes training.

    There is no universal figure for recovery time. It depends on checkpoint size, storage read speed, node reinitialization time, and fault detection latency. Regular recovery drills are recommended.