Training Trillion-Parameter Models on Domestic AI Chips: Memory Budgeting, FSDP2 Sharding, and Communication Optimization

    A recent open-source model with roughly 2.8 trillion parameters, and a domestic GPU vendor's announcement that its training-and-inference accelerator now supports training this model, raise a practical question: what does it actually take to train trillion-parameter models on non-CUDA hardware? This article walks through the general engineering methodology — memory budgeting, FSDP2 sharding, communication optimization, numerical stability, and fault recovery — with verification checklists, while clearly separating "adaptation completed" from unverified performance claims.

    1. Event Overview and Information Boundaries

    A flagship open-source model with approximately 2.8 trillion total parameters was recently released. At this scale, the model far exceeds what a single multi-GPU server can hold, so both training and fine-tuning require large clusters. Shortly afterward, a domestic GPU vendor stated that its training-and-inference accelerator card, together with its software stack, had completed training adaptation for this model.

    The publicly available information has clear limitations. The reports do not specify whether the adaptation covered pre-training, continued pre-training, or fine-tuning. Key data such as cluster size, framework versions, throughput, and convergence curves have not been disclosed. Therefore, this article discusses the general methodology for this class of tasks rather than validating the vendor’s specific results. Readers should distinguish between “adaptation completed” and “what level of performance was achieved.”

    2. Memory Budgeting: Do the Math Before You Start

    The first hurdle in ultra-large-scale training is memory. With the common setup of mixed precision plus the Adam optimizer, each parameter typically consumes:

    • Parameters (BF16): 2 bytes
    • Gradients (BF16): 2 bytes
    • Optimizer master weights (FP32): 4 bytes
    • Adam first moment (FP32): 4 bytes
    • Adam second moment (FP32): 4 bytes

    That totals roughly 16 bytes per parameter. For 2.8 trillion parameters, the parameters, gradients, and optimizer states alone require about:

    1. 2.8×10^12 × 16 bytes ≈ 44.8 TB (excluding activations, communication buffers, and fragmentation)

    With 80GB per GPU, at least about 560 cards are theoretically needed just to hold this state, and actual deployment must also account for activations and redundancy. Using low-precision optimizer states or 8-bit optimizers reduces these numbers, but you must verify that convergence is not affected.

    Checklist:

    • List the memory footprint of parameters, gradients, optimizer states, activations, and communication buffers in a budget table;
    • Before full training, run a single forward and backward step to record peak memory and compare it against the budget;
    • Confirm the state precision of your optimizer instead of inheriting defaults from other frameworks;
    • Choose an activation recomputation strategy and record its impact on throughput.

    3. Sharding Strategy and FSDP2

    FSDP (Fully Sharded Data Parallel) shards parameters, gradients, and optimizer states across all GPUs. During forward and backward computation, the required parameters are temporarily gathered and released right after use. Compared with traditional data parallelism, it significantly reduces per-GPU memory. Compared with tensor parallelism, it places lower demands on interconnect topology and is easier to deploy at large cluster scale.

    FSDP2 implements per-parameter sharding based on DTensor, offering finer-grained control than the first generation. Users can set different mixed-precision policies for different modules. This differentiated configuration is especially useful for multimodal models where a vision encoder and a language model backbone differ significantly in structure.

    The code below illustrates the workflow and is not directly runnable. build_model and load_sharded_checkpoint are placeholder functions, and the FSDP2 import path varies across PyTorch versions — check against the version you use.

    1. # Illustrative code: meta-device initialization + FSDP2 sharding + sharded checkpoint loading
    2. import torch
    3. from torch.distributed.fsdp import fully_shard # import path varies by PyTorch version
    4. # 1. Build the model skeleton on the meta device without allocating real memory
    5. with torch.device("meta"):
    6. model = build_model(config) # placeholder function
    7. # 2. Shard layer by layer, then shard the outermost module
    8. for layer in model.layers:
    9. fully_shard(layer)
    10. fully_shard(model)
    11. # 3. Materialize parameters, then load weights according to the sharding layout
    12. model.to_empty(device="cuda") # replace device name with the actual hardware
    13. load_sharded_checkpoint(model, ckpt_dir) # placeholder function

    When using the meta device, note that model parameters contain no real data before materialization. Weight loading must happen after parameters are materialized — otherwise the model starts training without data.

    Checklist:

    • The checkpoint format must match the sharding layout; missing or unexpected parameter keys during loading should raise errors directly;
    • After loading, compute norms or hashes of sampled parameters and compare them against the source files;
    • For multimodal models, separately verify the actual data types and sharding strategies used by the vision and language modules;
    • Record the PyTorch version, communication library version, and sharding parameters for reproducibility.

    4. Gradient Synchronization and Communication Optimization

    After sharding, the main training overhead shifts to communication, including parameter gathering (AllGather), gradient reduction (ReduceScatter), and global reduction (AllReduce). The larger the cluster, the higher the communication share typically becomes. Without optimization, GPU compute units spend long periods waiting for data.

    There are three common categories of optimization:

    1. Overlapping communication with computation: launch gradient communication while backward computation is still running to hide part of the latency;
    2. Bucketed scheduling: group parameters into buckets by size to control the data volume per communication call and reduce bandwidth waste from small messages;
    3. Topology-aware communication group partitioning: place GPUs with high-frequency communication on the links with the highest bandwidth.

    The effectiveness of these techniques depends heavily on the hardware interconnect topology. The same configuration can yield very different gains on different hardware, so real measurement is essential.

    Checklist:

    • Measure the proportion of communication time within a single training step as a core metric;
    • Record throughput for each bucket size and pick the optimum;
    • Compare single-step latency with overlap enabled versus disabled;
    • Record the collective communication library version and retest after upgrades;
    • Use multi-node benchmarks to check whether bandwidth degrades linearly with scale.

    5. Numerical Precision and Stability

    Mixed-precision training typically computes in BF16 or FP16 while keeping FP32 master weights. BF16 has the same dynamic range as FP32 and generally does not require loss scaling. FP16 has a smaller dynamic range and must be paired with loss scaling. Regardless of the precision chosen, numerically sensitive operators such as the softmax in attention, LayerNorm, and optimizer updates should be checked for correctness.

    Numerical anomalies are a common risk in long training runs. The recommended handling is:

    • Check the loss and gradients for NaN or Inf at fixed step intervals;
    • When anomalies occur, first locate the sensitive modules and roll them back to higher precision;
    • If the loss spikes, roll back to the most recent stable checkpoint and lower the learning rate or skip the affected batches;
    • For FP16 training, set upper and lower bounds on the loss scale to prevent the scaling factor from becoming too large or too small.

    Checklist:

    • At small scale, compare the loss curves of low-precision and high-precision training to confirm the deviation is acceptable;
    • Record the output error of each sensitive operator;
    • Test the anomaly fallback procedure to confirm training can continue after a rollback.

    6. Checkpointing and Fault Recovery

    Training runs last weeks or even months, so failures are almost inevitable. Checkpoint frequency involves a trade-off between storage overhead and lost progress: the more frequently checkpoints are saved, the less progress is lost per failure, but the greater the write bandwidth pressure.

    Checklist:

    • Set a checkpoint interval and estimate its impact on throughput based on write time;
    • Periodically perform fault injection — for example, deliberately kill a process — and measure the time from failure to resumed training;
    • After recovery, compare the loss curve to confirm there are no jumps or duplicated data;
    • Check whether the recovery process depends on manual steps and automate it as much as possible.

    7. Adaptation Verification Checklist

    The table below summarizes the items to verify before completing a training adaptation:

    Dimension What to record Verification method
    Training type Pre-training, continued training, or fine-tuning State it explicitly in the plan document
    Hardware and topology GPU model, node count, interconnect Confirm bandwidth with benchmarks
    Software versions Framework, communication library, driver versions Pin and record versions
    Memory Difference between peak memory and the budget Measure with a single forward/backward step
    Precision strategy Data types per module and loss scaling Compare against a baseline at small scale
    Throughput and communication Single-step latency, communication share Sample with profiling tools
    Convergence Deviation of the loss curve from the baseline Compare over long training runs
    Fault tolerance Checkpoint interval, recovery time Fault injection testing
    Inference consistency Inference results of the trained model Compare outputs on fixed inputs

    8. Conclusion

    This publicly reported adaptation case shows that ultra-large-scale open-source models can complete training workflows on non-CUDA hardware. However, the key data behind the report has not been disclosed, and whether the adaptation generalizes still requires more public verification.

    For engineering teams, the most valuable part is the methodology itself: memory budgeting, FSDP2 sharding, communication profiling, and numerical monitoring. These methods are largely hardware-agnostic and can be applied directly to evaluating any new platform. Rather than focusing on the marketing of a single hardware vendor, use the checklists above to measure each item on your own cluster.