Training Ultra-Large Models: Challenges, Methods, and a Pitfall Checklist

    As large language models scale from tens of billions to trillions of parameters, training them requires more than just adding hardware. This article explores the core technical challenges of training ultra-large models, organized by the training pipeline. It covers compute and communication bottlenecks, training stability monitoring, data ratio ablation, and architecture improvements for long context. It provides actionable methods and checklists to help engineering teams optimize their training systems and avoid common pitfalls.

    Introduction

    In recent years, the parameter scale of large language models (LLMs) has grown from tens of billions to the trillion level, with top teams exploring even larger training scales. As scale expands, the problems go far beyond simply buying more GPUs. Compute scarcity and expensive hardware mean that every generational model upgrade tests the limits of training frameworks, data pipelines, and system engineering.

    This article focuses strictly on the technology itself, rather than specific products. The discussion follows the sequence of the training process: starting with compute and communication, then moving to stability, data, and model architecture, before concluding with inference and cost considerations. Each section provides judgment criteria and directly verifiable items, allowing teams to evaluate their own situations and make necessary trade-offs.

    1. Compute and Communication: Finding the Real Bottleneck

    1.1 What is MFU and Why It Matters

    MFU (Model FLOPs Utilization) refers to the ratio of the actual effective floating-point operations performed by the model to the theoretical peak compute power of the hardware. It directly reflects whether the cluster’s compute power is actually being used for computation. A low MFU usually indicates that compute units are waiting—for example, waiting on communication, data, or other pipeline stages.

    Four main factors affect MFU: the combination of parallelism strategies, cluster network topology, the degree of operator fusion and compilation optimization, and the adaptation between communication libraries and hardware. Slow data loading can also drag down utilization, a factor that is often overlooked.

    1.2 Trade-offs of Three Parallelism Strategies

    In actual training, three types of parallelism are usually combined. The table below outlines their applicable scenarios and key tuning parameters.

    Parallelism Method Applicable Scenario Main Communication Overhead Key Tuning Parameters
    Data Parallelism Single model copy fits in a single GPU, or used with parameter sharding Gradient synchronization (all-reduce) Global batch size, gradient accumulation steps
    Tensor Parallelism Single layer parameters are too large for one GPU Frequent intra-layer synchronization, high bandwidth demand Split dimension, restrict to single-node high-speed interconnects as much as possible
    Pipeline Parallelism Many layers, requiring cross-node splitting Passing activations between adjacent stages Number of micro-batches (more micro-batches reduce the proportion of pipeline bubbles)

    When combining these strategies, a common practice is to place tensor parallelism within a node, and pipeline and data parallelism across nodes. The specific ratios should be determined by actual measured throughput, not just theoretical formulas.

    1.3 Communication and Compute Overlap

    Common optimizations include communication and compute overlap, gradient sharding, and mixed precision training. The overlap technique involves asynchronously initiating the communication of the previous layer’s gradients while calculating the gradients of the current layer during backpropagation. While the principle is not complex, the difficulty lies in its stable implementation across large-scale clusters. Teams need to use a profiler to verify layer by layer, ensuring that communication is genuinely hidden by computation.

    2. Training Stability: Turning Failures into Monitored Metrics

    The larger the scale, the more prone training is to issues. Loss spikes, gradient explosions, and numerical overflows are difficult to reproduce in small-scale experiments but can suddenly appear after tens of thousands of training steps. Once they occur, teams can only roll back to an earlier checkpoint, wasting the compute already consumed.

    The core of stability work is turning “feeling something is wrong” into concrete metrics. The monitoring checklist below provides starting reference values, which need to be calibrated based on your specific model and learning rate.

    • Gradient Norm: Record the global gradient norm at each step. Trigger an alert if it exceeds 3 to 5 times the recent moving average, and save the data index of the current batch.
    • Loss Curve: If the single-step loss exceeds the moving average by about 1.5 times and persists for more than 3 steps, treat it as a suspected spike and enter the troubleshooting process.
    • Non-Finite Values: Track the occurrences of NaN and Inf. If they appear, stop training immediately and save the state to prevent erroneous states from being written to checkpoints.
    • Checkpoint Frequency: Save at fixed intervals (e.g., every 30 to 60 minutes) or fixed step counts. Keep several recent versions and do not overwrite old ones.
    • Rollback Strategy: Roll back to the most recent checkpoint that passed validation set evaluation, skip the data batch that triggered the spike, and resume training from that point. After rolling back, confirm that the spike does not reoccur.

    Initialization and learning rate scheduling also impact stability. Warmup steps and decay strategies must be adjusted according to model scale; generally, the larger the scale, the longer the warmup. Regarding numerical stability, precision-sensitive operators like normalization layers should retain higher precision; you should not globally reduce precision just for the sake of speed.

    3. Data Ratios: Finding Answers via Small-Scale Ablation

    Data quality usually dictates the upper limit of model capability. Pre-training corpora at the trillion-token level require cleaning, deduplication, quality filtering, and domain ratio balancing. Among these, ratio balancing is the step that relies most on experience. The proportions of general text, code, math, and multilingual data, as well as whether adjustments are needed at different training stages, will noticeably affect the results.

    Ratio issues should not be judged by intuition. It is recommended to follow the process below for small-scale ablation experiments:

    1. Select a smaller model scale and fix the training steps and hyperparameters.
    2. Design 3 to 5 candidate ratios, changing only one dimension per group to facilitate attribution.
    3. Measure the results using the same evaluation set. The evaluation should cover both target capabilities and general capabilities to avoid optimizing only a single metric.
    4. Select the best-performing group and scale it up for larger-scale validation. The optimal ratio on a small model may not remain optimal on a large model.

    The cost of this process is significantly lower than trial-and-error directly on a large model, and it also helps the team accumulate its own experience with data ratios.

    4. Architecture and Long Context: Phased Investment

    4.1 Validation Order for Architecture Improvements

    Improvements to the attention mechanism are common methods for reducing memory footprint and inference latency. Grouped-Query Attention (GQA) reduces the KV cache by sharing key-value heads. Sliding Window Attention limits the visible range of each position, making it suitable for long-sequence scenarios. Sparsification of the Feed-Forward Network (FFN), such as the Mixture of Experts (MoE) structure, can increase the parameter count while controlling the single-pass computation volume.

    Such modifications should first be validated on a small model for both effectiveness and speed, and gradually scaled up once benefits are confirmed. Trial-and-error directly at the target scale carries a very high cost of failure.

    4.2 Three Stages of Long Context

    Long context capability is typically built in three steps:

    • Pre-training stage: Introduce extrapolation or interpolation schemes for position encoding so that the model retains position awareness beyond its training length.
    • Mid-training stage: Use long-sequence data to progressively extend the context window. The magnitude of each extension should not be too large.
    • Post-training stage: Use long-text instruction data to align the model’s actual behavior within long contexts.

    The memory and compute costs will rise at each step. The first step in controlling costs is estimating the memory budget. Roughly calculate the footprint of activations and the KV cache based on the target sequence length, batch size, number of layers, and numerical precision. When the budget is insufficient, consider sequence parallelism or switching to more efficient attention implementations.