Running Trillion-Parameter Models on Domestic AI Accelerators: Key Adaptation Requirements

    What does it actually take to run a trillion-parameter model on a domestic AI accelerator? This article walks through the full adaptation checklist: defining measurable acceptance gates for training correctness and stability, choosing between training and inference workloads, navigating the three-layer software stack (compiler, operator and communication libraries, and framework integration), understanding FSDP2 sharding and memory estimation, and handling multimodal training pitfalls. It closes with a three-step self-check to determine whether a platform is ready for production training.

    1. What “Successful Adaptation” Actually Means

    Training a trillion-parameter model on a domestic accelerator requires satisfying three conditions at once. First, hardware resources must be sufficient. Second, the software stack must run the model code end to end. Third, training must be numerically correct and stable over long runs. If any one of the three fails, training cannot close the loop.

    On the hardware side, verify memory capacity, memory bandwidth, and inter-card communication bandwidth. On the software side, check whether the compiler, runtime, communication library, and operator library integrate with mainstream deep learning frameworks. On the engineering side, confirm that model loading, parameter sharding, scheduling, gradient synchronization, and checkpoint recovery all work.

    A successful adaptation of one model does not mean any trillion-parameter model can be trained. Changes in model architecture, sequence length, cluster size, or software versions all require re-validation.

    Only when the acceptance gates below are all passed can you claim the adaptation is successful. If any gate fails, the claim of “adaptation successful” must not be used.

    Gate Verification Method Pass Criteria
    Training curve Compare loss against a reference platform with the same seed and same data Deviation over the first few thousand steps falls within a threshold agreed in advance
    Numerical consistency Compare key operators against reference implementations one by one Relative error within the predefined range for the corresponding precision
    Checkpoint recovery Kill the process mid-run and resume from the latest checkpoint The resumed loss curve connects smoothly with the uninterrupted run, with no jumps
    Long-run stability Run continuously for at least one full checkpoint cycle No unexpected crashes, no sustained memory growth
    Communication efficiency Measure AllReduce and other primitives using the method in Section 3 Bus bandwidth for large messages reaches the agreed fraction of the reference value

    Thresholds must be set by the team before training starts. Adjusting them after the fact makes the acceptance process meaningless.

    2. Training and Inference on One Platform: One Hardware Class, Two Workloads

    Traditionally, training hardware prioritizes peak compute and interconnect scalability, while inference hardware emphasizes per-card cost and deployment density. The unified training-plus-inference approach uses the same class of accelerator for both workloads.

    This design offers three benefits. First, operators and kernels validated during training can be reused directly for inference, reducing repeated porting effort. Second, developers work with a single programming model and toolchain, lowering the learning curve. Third, when training tasks are idle, the same cluster can serve inference requests, improving overall utilization.

    The trade-offs are clear. Training needs large memory and high bandwidth, while inference cares more about latency and unit cost—the optimal configurations may not align. When selecting hardware, first identify the primary workload, then judge whether the secondary workload can tolerate the chosen configuration.

    The table below helps determine the primary workload.

    Business Profile Likely Primary Workload Key Hardware Requirements
    Large model, long multi-card training runs Training Large memory, high bandwidth, high-speed interconnect
    High request volume, strict latency requirements Inference Low latency, high deployment density, low unit cost
    Shared cluster for training and inference, with clear inference peaks Both Sufficient training headroom, controllable inference switchover cost

    When selecting hardware, check the following items:

    • Memory capacity: can it hold the sharded parameters, gradients, and optimizer states, with headroom for activations and buffers?
    • Memory bandwidth: at the target sequence length, is memory access a bottleneck?
    • Interconnect topology: number of cards per node, network scale across nodes, and whether long paths cross switches exist.
    • Power and cooling: power curves under both full training load and low inference load.
    • Software ecosystem: framework versions, operator coverage, and communication library maturity.
    • Cost: total cost of procurement, power, data center space, and operations—not just the per-card price.

    When training very large models, each card must hold its sharded share of parameters, gradients, and optimizer states, while the inter-card interconnect determines how fast multi-card synchronization happens. Common options include proprietary high-speed interconnects (within a node or between cards), the PCIe bus, and RDMA networking across nodes. These operate at different layers and cannot be compared simply by name.

    Item Proprietary High-Speed Interconnect PCIe RDMA Network
    Layer Link Bus standard Network transport protocol
    Typical use Direct multi-card connections within a node Card-to-host and some card-to-card communication Cross-node communication
    What to verify Unidirectional and bidirectional bandwidth, point-to-point latency, whether the topology is fully connected Generation and lane count, shared bandwidth situations NIC speed, switch configuration, congestion control

    Bandwidth figures should come from vendor documentation and actual measurements. PCIe theoretical values are only an upper bound; real throughput is affected by protocol overhead and topology.

    3. The Three-Layer Software Stack

    The software stack for domestic accelerators typically has three layers. The lower layers determine whether code can run at all; the upper layers determine how little code needs to change.

    Layer 1: the programming model and compiler. This compiles kernel code written by developers into instructions the accelerator can execute. Most platforms adopt a CUDA-like parallel programming style, with kernels written in a C/C++ dialect. The closer the syntax is to the mainstream ecosystem, the lower the migration cost for existing code.

    Layer 2: operator and communication libraries. Large model training relies on many optimized operators, such as FlashAttention-style attention implementations, fused LayerNorm and activation functions, and low-precision GEMM. Training also depends on collective communication primitives like AllReduce, AllGather, and ReduceScatter. Operator coverage determines whether all computation can run on the accelerator; communication bandwidth utilization determines multi-card scaling efficiency.

    Layer 3: the framework integration layer. PyTorch connects to new hardware through its device backend mechanism, dispatching standard API calls to the vendor’s operator library. The following is illustrative code; the device name should follow the vendor’s PyTorch plugin documentation:

    1. import torch
    2. import torch.nn as nn
    3. # The device name is determined by the vendor's backend plugin;
    4. # replace <vendor_device> with the name given in the documentation
    5. device = torch.device("<vendor_device>:0")
    6. layer = nn.Linear(4096, 4096, bias=False).to(device)
    7. x = torch.randn(8, 4096, device=device)
    8. y = layer(x) # The framework dispatches the linear op to the vendor's operator library

    Before integration, record the following version information and check each item against the vendor’s compatibility matrix:

    1. PyTorch version: <vendor-supported version>
    2. Device plugin package: <vendor-torch-plugin> == <version>
    3. Communication library: <vendor-ccl> version <x.y.z>
    4. Driver and firmware: consistent with the plugin's compatibility matrix
    5. Backend registration: follow the registration entry point in the plugin documentation

    If any item is missing, the program may silently fall back to CPU or fail at runtime. A CPU fallback often does not raise an immediate error—it simply makes training dramatically slower—so check for it proactively.

    Operator coverage can be verified with a checklist. List all operators the model uses and fill in the status for each.

    Operator Status CPU Fallback? PyTorch Version Backend Registered Notes
    Attention (FlashAttention-style) Supported / Supported but unoptimized / Unsupported Yes / No Fill in Yes / No Record measured time
    LayerNorm Same Same Fill in Same Same
    Low-precision GEMM Same Same Fill in Same Same
    Activation (fused) Same Same Fill in Same Same

    Operators marked “supported but unoptimized” will run but may become performance bottlenecks. These should be listed separately and included in the performance optimization plan.

    Test collective communication with fixed-size messages. Taking AllReduce as an example, the common bus bandwidth calculation matches nccl-tests:

    • Algorithm bandwidth: algbw = data size / elapsed time
    • Bus bandwidth: busbw = algbw × 2(n−1)/n, where n is the number of participating cards

    Tests should cover a range from small messages to several hundred MB. Small messages mainly reflect latency; only large messages approach the bandwidth ceiling. Test reports should note the card count, topology, message size, driver version, and communication library version—otherwise the results cannot be reproduced.

    4. FSDP2: Understanding the Sharding Strategy

    FSDP (Fully Sharded Data Parallelism) addresses the memory problem. Traditional data parallelism requires every card to hold a full model copy, which becomes infeasible at large model sizes. FSDP shards parameters, gradients, and optimizer states across cards. During forward and backward passes, the framework temporarily gathers (AllGather) the parameters needed by the current module and releases them immediately afterward.

    Using a typical mixed-precision Adam setup, each parameter requires about 16 bytes of training state:

    • bf16 parameter copy: 2 bytes
    • bf16 gradient: 2 bytes
    • fp32 master weights: 4 bytes
    • fp32 first moment: 4 bytes
    • fp32 second moment: 4 bytes

    One trillion parameters multiplied by 16 bytes is roughly 16TB (decimal units). Sharded across 512 cards, the per-card resident state is about 31GB, or approximately 29GiB in binary units. This is an estimate and excludes activations, communication buffers, and memory fragmentation. Different optimizers and precision strategies change the per-parameter byte count, so recalculate based on your actual configuration.

    Sharding reduces resident memory to roughly 1/N, but peak memory is not determined by this alone. The full parameters gathered by AllGather, activations, and temporary buffers can all become bottlenecks. The 1/N figure only describes the reduction in resident memory; peaks must be measured separately.

    Measure peak memory as follows:

    1. Reset memory statistics before the first training step, and record the peak of each phase (forward, backward, optimizer update).
    2. Run at least several dozen steps and take stable values after skipping warm-up.
    3. Toggle activation checkpointing on and off and compare peak changes, to determine whether activations or communication buffers dominate.
    4. Record the difference between peak and resident memory as the headroom basis for future memory allocation.

    FSDP2 differs from the earlier FSDP in the following ways:

    Dimension FSDP1 FSDP2
    Sharding granularity Multiple parameters flattened into one large tensor Each parameter tensor sharded independently, per module
    Correspondence to model structure Shard boundaries often misaligned with module boundaries Shard boundaries aligned with module structure
    Mixed-precision configuration Configured globally Configurable per module
    Combination with activation checkpointing and CPU offload More cumbersome to combine Easier to combine

    In FSDP2, mixed precision can be configured per module. For example, computation in bf16 with gradient reduction in fp32 to reduce accumulation error. Such configurations should be verified separately in numerical consistency testing.

    CPU offload further reduces memory usage but introduces data transfers between host and device. Transfer bandwidth is typically far lower than device memory bandwidth, and training speed may drop noticeably. Activation checkpointing trades compute for memory, adding recomputation time in the backward pass. When both are used together, both memory savings and speed loss must be measured—you cannot evaluate just one.

    5. Multimodal Training Considerations

    Multimodal models typically consist of a vision encoder, a language model, and a projection layer connecting the two. Adapting multimodal training requires additional attention to three points.

    First, sharding strategies should differ by module. The vision encoder and the language model differ greatly in parameter count, compute density, and sequence shape, so they should generally be wrapped as separate FSDP shard groups. If they share one group, temporary gathering on the vision side can eat into the peak memory headroom of the language side.

    Second, cross-modal communication should be measured separately. Image features pass between the encoder and the language model, and cross-module data dependencies may introduce extra synchronization points. Record the time spent in vision forward, language forward, and the projection layer separately, and identify the stage with the longest waiting time.

    Third, data loading is often a hidden bottleneck. Image decoding, resizing, and tokenization all run on the CPU; if loading cannot keep up, the accelerator sits idle. Track per-step data wait time and reduce it by increasing loader processes, prefetching, and caching.

    Mixed precision for multimodal training needs particular care. The vision encoder may have different precision sensitivity than the language model, so reduction precision for each should be tested separately during acceptance.

    6. Scope of Validity and a Three-Step Self-Check

    The conclusions in this article are based on estimates, illustrative code, and general testing methods. Actual figures, interfaces, and performance on a given platform must be measured item by item; this article makes no specific performance promises for any vendor.

    Adaptation conclusions apply only to the tested combinations, including model architecture, sequence length, cluster size, framework version, and driver version. Any change to these requires re-running the acceptance gates.

    You can use the following three steps to judge whether your platform is ready for production:

    1. Using the primary workload table and hardware selection checklist in Section 2, confirm that the hardware matches your business workload, and record measured interconnect data.
    2. Using the operator checklist and version records in Section 3, confirm that all operators are mapped to accelerator implementations, with no hidden CPU fallback paths.
    3. Using the acceptance gates in Section 1, complete the four tests: training curve, checkpoint recovery, long-run stability, and communication efficiency. Only when all four pass should formal training begin.