Trillion-Parameter LLM Training Adaptation: A Practical Guide to Deploying on Domestic AI Accelerators

    Training a trillion-parameter large model on new hardware raises challenges that go well beyond simply adding more GPUs. Using a recent case in which a chip vendor completed training adaptation of a roughly 2.8-trillion-parameter flagship model, this article explains why adaptation becomes sharply harder past the trillion-parameter threshold and walks through the four core challenges: memory, communication, stability, and ecosystem. It presents a "correctness first, performance later" workflow and details the key techniques for each stage—sharded checkpoint loading, FSDP-based sharding for multimodal models, expert parallelism for MoE architectures, gradient synchronization under mixed precision, memory and throughput tuning, and fault tolerance through sharded checkpointing and automatic recovery. Engineering teams will gain a practical reference for moving ultra-large models onto new compute platforms.

    1. Introduction: Beyond Parameter Count, What Matters Is Whether You Can Actually Train It

    Recently, an open-source team released a flagship large model with roughly 2.8 trillion parameters, drawing significant industry attention. A domestic chip vendor then announced that it had completed training adaptation of the model on its flagship training-and-inference integrated compute card along with the accompanying software stack. Its engineering team built a multimodal training pipeline based on Fully Sharded Data Parallel (FSDP), connecting the full training chain from model loading and shard scheduling to gradient synchronization.

    This signals a shift: domestic compute is moving from “can run on a single card” toward “can train stably across thousands of cards” in ultra-large-scale model training scenarios. For developers and enterprise engineering teams, the more important question—beyond the parameter number—is what problems must be solved to train a trillion-parameter model on a new hardware platform, and how they are resolved step by step.

    1.1 Why Training Adaptation Grows Harder Beyond a Trillion Parameters

    From an engineering perspective, once parameter count crosses the trillion threshold, training is no longer a simple “add more cards” problem:

    • Memory: The combined footprint of weights, gradients, optimizer states, and activations reaches a scale far beyond that of traditional models.
    • Communication: Every iteration must synchronize parameters and gradients across hundreds or thousands of cards; communication efficiency directly determines overall throughput.
    • Stability: Training runs for weeks, and any interruption can cause enormous loss of compute and time.
    • Ecosystem: Operator coverage, framework support, and communication-library capabilities on a new hardware platform must each be aligned.

    1.2 Three Layers of “Can Train It” for Domestic Compute

    When discussing whether domestic compute can support large-model training, “can train it” typically spans three progressive layers:

    1. It runs: the model loads correctly, and single-step forward and backward passes do not crash.
    2. It trains correctly: under multi-card parallelism, metrics such as the loss curve and gradient norm match results on the reference platform.
    3. It trains stably and fast: long-running, large-scale training proceeds without interruption, and throughput utilization reaches an acceptable level.

    The chip vendor’s completion of adaptation for a flagship model shows that domestic compute platforms have achieved engineering feasibility at layers 1 and 2, and layer 3 is exactly what this article focuses on.

    2. The Four Challenges of Trillion-Parameter Training

    2.1 The Memory Wall: State Footprint Far Exceeds the Weights Themselves

    Take a mixed-precision scheme paired with an adaptive optimizer. During training, each parameter occupies roughly:

    Memory component Typical precision Bytes per parameter
    Model weights (compute copy) BF16/FP16 2
    Gradients (compute copy) BF16/FP16 2
    Master weights (FP32) FP32 4
    First moment FP32 4
    Second moment FP32 4
    Total — ~16

    This accounts only for “model states,” not activations, communication buffers, temporary tensors, or memory fragmentation. By this estimate, model states for 2.8 trillion parameters require about 44.8 TB of memory. Even if each card provides 64 GB of memory, it would theoretically take about 700 cards just to hold the model states. Clearly, without sharding and parallelism, a single card or small cluster cannot fit a trillion-scale model at all.

    2.2 The Communication Wall: Iterations Slowed by Data Movement

    In trillion-scale training, communication within one iteration mainly includes:

    • Shard parameter gathering: parameters are collected on demand by layer during forward and backward computation;
    • Gradient reduction: gradients computed across data-parallel groups are aggregated and redistributed;
    • Additional communication from parallelism dimensions: collective communication introduced by strategies such as tensor parallelism and pipeline parallelism.

    When communication time exceeds compute time, even abundant compute can only sit idle and wait.

    2.3 The Stability Wall: One Interruption Can Cost Hours of Compute

    The larger the cluster, the higher the probability of single-card failures, network jitter, and slow nodes (stragglers). Crashes from insufficient memory, loss divergence from sudden spikes in gradient norm, and failures while writing checkpoints can all occur mid-training. Whether faults can be located and recovered automatically is critical to whether large-scale training can be deployed in practice.

    2.4 The Ecosystem Wall: Aligning Operators, Frameworks, and Numerics Layer by Layer

    Adapting training to a new hardware platform typically requires connecting several layers:

    1. Base software layer: drivers, runtime, and communication libraries;
    2. Operator layer: functionality and performance of operators for attention, normalization, activation functions, MoE routing, and more;
    3. Framework layer: capabilities for sharding, automatic differentiation, mixed precision, and other training features;
    4. Model code layer: model definitions, checkpoint loading, data pipelines, and evaluation scripts.

    Each layer may have gaps, differences, or defects; adaptation is essentially layer-by-layer investigation and item-by-item alignment.

    3. Overall Approach: Align Numerics First, Then Push Performance

    When adapting large models, many teams habitually chase high throughput from the start. But on heterogeneous compute platforms, a safer path follows the principle of “correctness first, performance later”:

    1. Single-card baseline: run model loading and single-step forward and backward on one card, and record baseline loss values.
    2. Small-scale multi-card: use a few cards to verify that gradient reduction under data parallelism is correct.
    3. Full parallelism: gradually introduce strategies such as tensor parallelism and pipeline parallelism, and check whether the loss curve stays in sync.
    4. Performance tuning: with numerics aligned, optimize communication overlap, activation recomputation, operator fusion, and so on in sequence.

    The core idea of this path is: every time you introduce a parallelism strategy or optimization, re-run the numeric alignment. This avoids being unable to locate problems when multiple variables change at once.

    4. Model Loading: How Trillion Parameters “Come In” and “Fit”

    4.1 Sharded Weight Storage

    A trillion-parameter model is often tens to hundreds of GB and is typically released as multiple shard files, each carrying a parameter index that records the file name and in-file offset for each parameter. During loading, each training process reads the index and extracts only the parameters it is responsible for from the corresponding shard files, avoiding every card reading all weights in full. For training clusters with constrained storage bandwidth and many compute nodes, this design can significantly reduce startup time.

    4.2 Illustrative Flow of Sharded Parallel Loading

    1. # Illustrative pseudocode: parallel loading based on shard index
    2. def load_checkpoint(model, ckpt_dir, rank, world_size, dtype="bfloat16"):
    3. index = read_shard_index(ckpt_dir / "model_index.json") # Read the parameter-to-shard mapping
    4. shards = index.group_by_file() # Group parameters by file
    5. local_tasks = distribute(shards, rank, world_size) # Split read tasks evenly across processes
    6. for shard_file in local_tasks:
    7. # Read in a streaming fashion and release on demand to avoid holding all shards at once
    8. for name, tensor in read_tensors(ckpt_dir / shard_file, dtype=dtype):
    9. model.assign_tensor(name, tensor)
    10. synchronize_and_verify(model, index) # Synchronize the group and verify parameter integrity

    In practice, multithreading or asynchronous prefetching is often used to hide disk I/O latency. It is also necessary to verify that parameter names, tensor shapes, and data types match the target platform, to prevent silent loading errors caused by version differences.

    4.3 Loading Adaptation Points on New Hardware Platforms

    • Data type conversion: some parameters (such as the scaling coefficients of normalization layers) must remain in FP32, so conversion should treat each module differently;
    • Device placement strategy: build a model skeleton on a meta device first, then populate parameters one by one, to avoid exhausting memory during initialization;
    • New structure alignment: if the new model introduces structures absent from the reference implementation (such as attention with shared weights), the naming and sharing relationships of the weights must be checked accordingly;
    • Load duration and success rate: in large-scale clusters, troubleshooting load failures and timeouts should be part of routine operations monitoring.

    5. Shard Scheduling: How FSDP Supports Multimodal Training

    5.1 Basic FSDP Mechanism

    The core idea of Fully Sharded Data Parallel (FSDP) is that each card stores only a portion of the model parameters, gradients, and optimizer states. When a layer participates in computation, its full parameters are first gathered on demand through collective communication; once the computation finishes, the full copy is released immediately, leaving only the shard owned by that card.

    This achieves two things at once: memory footprint decreases roughly linearly with the number of cards, while each card’s computation still has access to the full layer parameters. FSDP can also be combined with strategies such as tensor parallelism and pipeline parallelism to form so-called “2D/3D parallelism.” 2.8 trillion parameters is the total parameter count, while the number of expert parameters within a single network layer can be very large. FSDP alone is hard-pressed to keep the single-layer gathering overhead within an acceptable range, so additional parallelism dimensions are usually required.

    5.2 Improvements of Next-Generation FSDP in the Training Pipeline

    1. # Illustrative pseudocode: wrapping a multimodal model with sharded data parallelism
    2. from model_lib import AutoModel, ShardConfig, DeviceMesh
    3. model = AutoModel.from_pretrained(
    4. "path/to/trillion-param-multimodal-model",
    5. dtype="bfloat16",
    6. device_map="meta", # Build skeleton on meta device, then load weights by shard
    7. )
    8. # Define a 2D device mesh: intra-node data parallel x inter-node data parallel
    9. mesh = DeviceMesh.from_sizes(dp_replicate=NODES, dp_shard=GPUS_PER_NODE)
    10. # Sharding policy: split the language model backbone into a single FSDP unit, wrap the vision encoder separately
    11. shard_cfg = ShardConfig(
    12. fsdp_unit_modules=["language_model"], # Use the language model backbone as the minimum sharding unit
    13. wrap_modules={"vision_encoder": shard_cfg_vit},
    14. mixed_precision_dtype="bfloat16",
    15. reduce_dtype="float32", # Use higher precision for gradient reduction to ensure numerical stability
    16. backward_prefetch=True, # Gather the next layer's parameters ahead of time during backpropagation
    17. forward_prefetch=True, # Gather the next layer's parameters ahead of time during the forward pass
    18. )
    19. model = Shard(model, mesh=mesh, config=shard_cfg)

    Compared with earlier versions, next-generation FSDP implementations mainly improve in a few areas:

    • Finer sharding granularity: support for managing shards at the granularity of a single parameter, with clearer tensor-shape information that makes it easier to combine with the device mesh and tensor parallelism;
    • More flexible tensor placement: support for further splitting along tensor dimensions on top of per-parameter shards;
    • Hybrid strategies: support for a hybrid mode of “intra-node sharding + inter-node replication,” where inter-node replication acts like data parallelism and reduces inter-node communication;
    • Flexible wrapping: support for composing and nesting module wrappers on demand, so different modules can adopt different parallelism strategies.

    5.3 Sharding and Wrapping Strategy for Multimodal Models

    Multimodal models typically consist of a vision encoder and a language model, which differ markedly in parameter scale and compute characteristics. A vision encoder usually accounts for only a small fraction of the total parameters. If it uses the same wrapping scheme as the language model, it can instead introduce frequent communication overhead and fragmented memory management. Common practices include:

    1. Differentiated wrapping: wrap the vision encoder as a whole (or even replicate it directly on each card), while sharding the language model backbone by Transformer blocks;
    2. Data-flow design: image-text pair samples are first passed through the vision encoder to extract features, then concatenated with text and fed into the language model. The extraction stage is typically completed before the language model’s shard communication begins, to better overlap communication and computation;
    3. Input format consistency: the image-text alignment format and the way vision features are concatenated with text embeddings must match the model’s official implementation; otherwise it causes hidden errors where “training runs but results are abnormal.”

    5.4 Sharding and Routing in MoE Scenarios

    If the trillion-parameter model adopts a Mixture-of-Experts (MoE) architecture, the sharding strategy must also account for expert-level parallelism and communication. A common approach is to layer expert parallelism on top of FSDP, assigning different experts to different cards and distributing and aggregating tokens through all-gather/all-scatter–type communication. Three points need attention:

    • Load balancing: uneven routing distribution causes individual cards to become bottlenecks while others wait idle;
    • Routing precision: routing scores are usually computed in FP32, and it is necessary to confirm numerical behavior is consistent after moving to a new platform;
    • Auxiliary loss: if the implementation details of the load-balancing auxiliary loss differ from the reference implementation, convergence quality is directly affected.

    6. Gradient Synchronization: The Last Gate of Training Correctness

    6.1 Gradient Reduction in Sharded Scenarios

    Traditional data parallelism uses gradient all-reduce, where every card receives a complete and identical copy of the gradients. In FSDP, each card holds only part of the parameters, and the corresponding gradients only need to be reduce-scattered within the sharding group, so each card obtains the reduction result for the shard it is responsible for.

    The memory savings come from here: gradients no longer need to keep a full copy on every card. But correctness requirements are not relaxed: all processes in a sharding group must participate in collective communication in exactly the same order, and if any process computes one extra or one fewer operation, collective communication will hang or produce incorrect results.

    6.2 Gradient Handling Under Mixed Precision

    BF16 has a large dynamic range but limited precision, and is often used for training trillion-scale models. Reducing gradients directly in BF16 leads to accumulated error. Two common approaches in practice are:

    1. FP32 gradient reduction: during backpropagation, accumulate local gradients in an FP32 buffer, then reduce in FP32, and switch back to the compute precision afterward;
    2. BF16 reduction with FP32 master weights: use BF16 during reduction to save bandwidth, but base parameter updates always on FP32 master weights.

    Whichever method is used, the reduction behavior on the target platform must be consistent with the reference implementation. In particular, implementation details such as the reduction tree structure and accumulation order can cause the loss curve to gradually drift after thousands of steps.

    6.3 Gradient Clipping in a Sharded Setting

    Gradient clipping is one of the key mechanisms for training stability. It usually starts with global gradient norm clipping over the parameters:

    The key point is: each process first computes the sum of squared gradients for its local shard, then sums them via all-reduce and takes the square root to obtain the global norm. If the norm is computed locally only, ignoring the fact of sharding, the scaling factors will differ across cards, the shards will effectively “work independently,” and training will eventually diverge.

    6.4 Gradient Accumulation and Overlap Optimization

    1. # Illustrative pseudocode: gradient accumulation and reduction overlap
    2. accum_steps = 16
    3. opt.zero_grad()
    4. for step in range(accum_steps):
    5. ctx = model.no_sync() if step < accum_steps - 1 else nullcontext()
    6. with ctx:
    7. loss = model(batch) / accum_steps
    8. # Gradients are written into an FP32 buffer; the reduce operation overlaps automatically with backpropagation
    9. loss.backward()
    10. grad_norm = clip_grad_norm_(model.parameters(), max_norm=1.0) # Automatically completes cross-shard reduction
    11. opt.step()
    • Gradient accumulation: the first several micro-batches perform only local backpropagation in “no-sync” mode, triggering reduction only on the final micro-batch. This spreads communication overhead across multiple micro-batches and effectively simulates a larger global batch with fewer cards;
    • Communication and computation overlap: prefetching of shard parameters for the forward/backward pass and overlapping gradient reduction let communication run in the background, “hiding” it within compute time as much as possible;
    • Reduction precision: pay special attention to accumulation precision during gradient accumulation. Accumulating directly in BF16 is prone to precision loss, so it is usually recommended to accumulate in an FP32 buffer.

    7. Memory and Compute Tuning: Keeping the Cluster Fully Utilized

    1. Activation recomputation: for compute-intensive but memory-heavy modules (such as the Transformer blocks of the language model backbone), save only the necessary inputs and recompute intermediate results during backpropagation. It can be enabled selectively per layer to balance memory and speed;
    2. State offloading: temporarily offloading optimizer states or parameters to host memory can significantly reduce per-card memory pressure, but comes at the cost of increased host-device link bandwidth (such as PCIe), making it suitable for scenarios that are memory-constrained but relatively compute-abundant;
    3. Combining parallelism dimensions: based on the model structure (dense or MoE) and network topology (high-speed intra-node interconnect, inter-node RDMA network), set the FSDP sharding group, tensor-parallel degree, and pipeline-parallel degree appropriately. The principle is to keep parallelism dimensions with frequent communication within nodes as much as possible;
    4. Efficient attention implementation: attention is a compute and memory hotspot in long-sequence training. Using a fused implementation that does not explicitly construct the full attention matrix can reduce memory footprint from quadratic in sequence length to linear;
    5. Continuous throughput and utilization monitoring: use a monitoring and alerting system to track per-card throughput, communication ratio, peak memory, and other metrics, and use log services to trace slow nodes and continuously optimize.

    8. Training Stability: Checkpointing and Fault Recovery

    Fault-tolerance design for trillion-scale model training should include at least four parts:

    • Sharded checkpoints: save each sharding group’s parameters, optimizer states, data-loader progress, and random-number states, avoiding single-point writing of all state;
    • Asynchronous saving: write to CPU memory first and then to disk to reduce training pauses; combined with multi-tier storage such as object storage, this can shorten fault-recovery time;
    • Automatic fault detection and restart: leverage the health checks and job scheduling of the container platform to automatically recover from the most recent checkpoint after a card failure or abnormal process exit;
    • Periodic numerical inspection: periodically record metrics such as loss, gradient norm, and routing load, and trigger alerts when anomalies appear. Detecting numerical drift early is far better than patching things up after a training collapse.