Key Metrics for Adapting Trillion-Parameter Model Training

    This article explains how to tell whether an AI platform can train trillion-parameter models, not just run inference or small-scale fine-tuning. It covers the full training pipeline, the trade-offs of running training and inference on the same hardware, the four software layers needed for training support, how to estimate FSDP2 memory usage, and the structure of an adaptation code sketch.

    1. Why Training Adaptation Is Harder Than Getting a Model to Run

    Many platforms claim to support large models, but in practice they have only completed inference or small-scale fine-tuning. Real trillion-parameter training requires thousands of devices to synchronize gradients and shard model states reliably, and it must run for weeks without interruption. To judge whether a platform has real training capability, check whether it completes the full pipeline: model loading, shard scheduling, forward and backward computation, gradient synchronization, checkpoint saving, and fault recovery.

    Training adaptation involves the compiler, operator library, communication library, distributed framework, and mixed-precision support. If any layer lacks a key operator, or its behavior differs from the reference implementation, the problem usually appears late in training as precision drift or throughput loss.

    2. Integrated Training and Inference: Benefits and Costs

    Integrated training and inference means the same hardware handles both training and inference workloads. It offers three main benefits.

    1. Resource reuse: idle training capacity can serve inference requests, which raises overall utilization.
    2. Numerical consistency: training and inference share operator implementations, which reduces accuracy mismatches between the two.
    3. Simpler deployment: models do not need format conversion for a separate inference stack.

    The costs are equally clear. Training depends on high-bandwidth collective communication and large-scale memory aggregation, while inference cares more about single-request latency and throughput. The two workloads place different demands on the scheduler and memory manager, so driver and runtime design involves trade-offs. The table below lists common differences between the two architectures.

    Dimension Integrated training and inference Separated training and inference
    Resource utilization High, because the two workload types can fill each other’s idle time Depends on capacity planning for each workload
    Scheduling complexity High, requires isolation and preemption policies Low, the two systems run independently
    Inference latency stability Training jobs must be prevented from preempting resources Easier to guarantee
    Operations cost Unified technology stack, but more complex configuration Two stacks, higher maintenance cost

    3. The Software Stack: Four Layers That Determine Adaptation Depth

    To reach usable training capability, a Chinese AI accelerator platform typically needs four software layers.

    • Programming model layer: provides a CUDA-like heterogeneous programming interface, so developers can write kernels in a familiar way.
    • Operator library layer: covers attention, normalization, positional encoding, and matrix multiplication. Whether Transformer-related operators are fused, and whether they have complete backward implementations, directly affects training throughput.
    • Communication library layer: implements collective primitives such as AllReduce, AllGather, and ReduceScatter, and is topology-aware so it can select suitable communication paths.
    • Framework adaptation layer: lets PyTorch features such as FSDP and tensor parallelism run natively on the hardware, rather than relying on workaround scripts.

    Operator coverage is the most direct hard metric. When coverage is incomplete, the framework falls back to less efficient implementations, and training speed drops noticeably.

    4. FSDP2: How to Calculate Memory

    FSDP2 is a fully sharded data parallel scheme in PyTorch built on DTensor. It shards parameters, gradients, and optimizer states across the devices in a data-parallel group, at submodule granularity. During the forward pass, it gathers full parameters on demand with AllGather and frees them after use. Compared with the first generation, FSDP2 shards each parameter individually, offers more flexible mixed-precision configuration, and can combine with tensor parallelism and pipeline parallelism into 3D parallelism.

    Before use, confirm the following prerequisites.

    1. Whether your PyTorch version supports the fully_shard interface you plan to use. Import paths and parameter names differ across versions.
    2. Whether the communication backend supports the required collective primitives.
    3. Whether the DeviceMesh dimensions match the physical topology, for example whether intra-node and inter-node communication are layered.
    4. Whether the parameter precision and gradient reduction precision in your mixed-precision policy meet your numerical requirements.

    When estimating memory, first define the basis for the estimate. With BF16 weights, the weights of a 2.8 trillion parameter model alone take about 5.6 TB, which already exceeds the capacity of a single device. With a common mixed-precision Adam setup, each parameter also needs a BF16 gradient, an FP32 master weight, and FP32 first and second moments, about 16 bytes in total. On that basis, the total model state is about 44.8 TB. Sharding across 256 devices leaves about 175 GB of model state per device. That still exceeds the memory of most single devices, so you also need activation recomputation, parameter offloading, or more devices. Activations, communication buffers, and memory fragmentation must be reserved separately. These results are theoretical lower bounds. Actual usage depends on the specific configuration.

    5. Structure of the Adaptation Code

    The code below is a structural sketch and cannot run as-is. The model construction function, checkpoint loading function, and other names are placeholders. Version-dependent import paths need to be adjusted for your environment.

    1. import torch
    2. import torch.distributed as dist
    3. from torch.distributed.device_mesh import init_device_mesh
    4. from torch.distributed.fsdp import fully_shard, MixedPrecisionPolicy
    5. dist.init_process_group(backend="nccl") # Replace with the communication backend of the target platform
    6. world_size = dist.get_world_size()
    7. mesh = init_device_mesh("cuda", (world_size,)) # One-dimensional data-parallel device mesh
    8. mp = MixedPrecisionPolicy(
    9. param_dtype=torch.bfloat16, #