Reproducing a Trillion-Parameter Multimodal Model Training on Domestic AI Accelerators: A Verification Checklist

    This article outlines a practical verification workflow for reproducing the training of a ~2.8-trillion-parameter multimodal model on domestic AI accelerator clusters. It covers five key areas: hardware and software prerequisites, memory and data pipeline validation, model loading and sharding, gradient communication overlap, and checkpointing with fault tolerance. Each section provides concrete checklists, configuration guidance, and acceptance thresholds based on engineering estimates. The goal is to help engineering teams evaluate whether their cluster is truly ready for such large-scale training, rather than relying on vendor claims.

    Introduction

    Training large models from tens of billions to trillions of parameters demands rapidly increasing compute resources. Relying solely on a single GPU vendor exposes teams to procurement delays, cost pressure, and supply chain risks. Domestic AI accelerators have made significant progress in compute density, inter-card interconnect, and software ecosystems, but whether they can genuinely train a trillion-parameter model must be answered with measurable engineering metrics, not marketing statements.

    According to public reports, an open-source community released a multimodal model with approximately 2.8 trillion parameters, and a domestic accelerator vendor subsequently announced successful adaptation for training this model. This article does not verify or evaluate any vendor’s product; it only uses this event to outline the technical issues that must be addressed during adaptation. All numerical values are engineering estimates or planning thresholds, not measured results. For specific configurations and indicators, refer to the original announcements.

    Before starting reproduction, confirm the following five items:

    • Total number of cards, per-card memory, and node count must be sufficient to hold the complete sharded training state while leaving headroom for activations.
    • Intra-node and inter-node interconnect bandwidth must support measured throughput for all-gather and reduce-scatter operations.
    • Storage write bandwidth must allow sharded checkpoints to be saved within an acceptable time window.
    • The combination of frameworks, drivers, vendor SDKs, and communication libraries must have been fully validated at small scale.
    • Data loading throughput must be high enough that accelerators do not idle during each training step.

    If any of these five items cannot be addressed, full-scale training should not be started.

    1. Background and Reproduction Prerequisites

    This section is covered by the introduction above.

    2. Memory, Software Stack, and Data Pipeline Verification

    2.1 Memory Budget

    Assuming weights and gradients are stored in bf16, master weights in fp32, and the Adam optimizer keeps two fp32 momentum values, each parameter requires about 16 bytes. For 2.8 trillion parameters, the complete training state is approximately:

    2.8 × 10¹² × 16 bytes ≈ 44.8 TB

    Neither a single card nor a single node can hold this volume. Full sharded data parallelism must be used to distribute parameters, gradients, and optimizer states across all devices.

    After sharding, the per-card model state is approximately 44.8 TB ÷ N, where N is the sharding parallelism degree. For N = 512, this is about 87.5 GB; for N = 1024, about 43.75 GB. Activations, communication buffers, and temporary buffers for all-gather are not included in this calculation. When planning, reserve at least 25% of per-card memory for these overheads. The final criterion should be measured peak memory, not estimates.

    2.2 Operators and Communication Primitives

    Before adaptation, perform the following three categories of checks.

    • Operator coverage: Enumerate all operators in the forward and backward graphs and verify that the vendor backend provides corresponding implementations. The target coverage is 100%. Any uncovered operators must be documented and either fall back to CPU via graph partitioning or be handled with custom kernels. Both approaches require separate correctness and performance validation.
    • Communication primitives: Run all-gather, reduce-scatter, and all-reduce within a node and across nodes, recording measured bandwidth for different message sizes. Cover message sizes from 1 MB to 1 GB, and record the number of participating processes. Compare measured values against vendor specifications and reference data from similar scales. If deviation exceeds 30%, diagnose the cause before proceeding.
    • Mixed precision: For the bf16 path, confirm that hardware compute units support all used operators. fp16 usually requires loss scaling; bf16 generally does not. In either case, compare the loss curve over the first several hundred steps (at least 1000 steps recommended) with a reference implementation.

    In addition, establish a version matrix with at least the following items:

    Item Required information
    Training framework PyTorch version, build flags
    Driver and firmware Driver version, firmware version
    Vendor SDK SDK version, operator library version
    Communication library Communication library version, environment variable configuration
    OS and container image Kernel version, container image digest

    A working combination does not guarantee that other combinations will work. After upgrading any component, re-run the acceptance steps described in Section 3.

    2.3 Data Pipeline

    The vision encoder, language backbone, and cross-modal alignment modules have different compute requirements, and training samples mix images, text, and video. If data loading is slower than the accelerator’s consumption rate, the accelerators will stall.

    Measure as follows: In the training loop, wrap the call that fetches the next batch with a timer, recording the wait time as t_wait. The total step time is t_step. The data wait ratio is the average t_wait divided by the average t_step. Skip the first 20 steps for warm-up, then average over at least 100 subsequent steps.

    Acceptance thresholds are engineering starting points and should be calibrated to your cluster:

    • Data wait ratio below 5%: proceed to the next section.
    • Ratio between 5% and 10%: increase the number of data loading processes, prefetch depth, or switch to offline preprocessing.
    • Ratio above 10%: first investigate storage reads, decoding, and sample packing before starting training.

    3. Model Loading and Sharding

    3.1 Avoid Instantiating the Full Model Directly

    Building the full model directly on the CPU causes memory spikes during initialization. A safer approach is to construct the model structure on the meta device, then shard it, and finally materialize each shard on the accelerator.

    1. import os
    2. import torch
    3. from torch.distributed.device_mesh import init_device_mesh
    4. from torch.distributed.fsdp import fully_shard, MixedPrecisionPolicy
    5. device_type = "<vendor_device>" # replace with vendor SDK device backend name
    6. world_size = int(os.environ["WORLD_SIZE"]) # injected by torchrun
    7. mesh = init_device_mesh(device_type, (world_size,))
    8. with torch.device("meta"):
    9. model = build_multimodal_model(config) # your model builder, creates structure only
    10. mp_policy = MixedPrecisionPolicy(
    11. param_dtype=torch.bfloat16,
    12. reduce_dtype=torch.float32,
    13. )
    14. for block in model.language_model.layers: # shard each Transformer layer as a unit
    15. fully_shard(block, mesh=mesh, mp_policy=mp_policy)
    16. fully_shard(model, mesh=mesh, mp_policy=mp_policy)
    17. model.to_empty(device=device_type) # allocate memory without initializing values
    18. load_or_init_weights(model, ckpt_dir) # must load weights or explicitly initialize

    Two common pitfalls in this code:

    • to_empty only allocates memory, it does not initialize values. If weight loading is skipped, the model starts training with random memory content and no error is raised.
    • The parameter names for MixedPrecisionPolicy change across PyTorch versions. After upgrading, re-check against the current documentation.

    Setting reduce_dtype to fp32 roughly doubles the communication volume for gradient reduction compared to bf16 reduction, and increases gradient buffer memory. If communication becomes a bottleneck, try bf16 reduction, but verify that the loss curve over initial steps does not diverge significantly.

    3.2 Sharding Granularity

    Sharding granularity mainly affects two metrics: peak memory and communication frequency. The table below compares three common choices.

    Granularity Peak Memory Communication Frequency Suitable Scenarios Main Risks
    Entire model as one unit Close to unsharded level Minimal Only for small models All-gather of all parameters at once, causing memory spike at start of forward pass
    Each Transformer layer as one unit Keeps only one layer’s parameters at a time Moderate Recommended starting point for trillion-scale language backbones Uneven compute across layers may leave some communication uncovered
    Each linear layer as one unit Lowest Highest Special very large layer structures Small messages may not saturate bandwidth, scheduling overhead is obvious

    For multimodal models, decide sharding strategies separately for the vision tower and language backbone. Their parameter counts and activation sizes usually differ; allocate budgets independently. If the vision tower is small, use coarser sharding to reduce communication frequency, but confirm that per-card memory stays within budget.

    3.3 Sharding Acceptance Checklist

    Before deployment, verify each item and record results:

    • Sharding granularity: parameter count per shard unit, and mapping between shard count and total cards.
    • Peak memory: maximum per-card memory during each training step, target below 75% of card capacity.
    • Communication frequency: number of all-gather and reduce-scatter calls per step, matching expected counts.
    • Measured bandwidth: bandwidth at various message sizes, mapped to the records in Section 2.2.
    • All-gather temporary buffer: memory used by a single all-gather, included in peak memory budget.
    • Vision tower and language backbone: parameter counts, activation sizes, and sharding approach recorded separately.

    Acceptance proceeds in four steps, each gate must be passed before moving to the next:

    1. Single-card validation: Compare forward and backward results with a CPU reference on a small model; set relative error thresholds per dtype.
    2. Single-node multi-card validation: Train a small model on all cards of one machine for 100 steps; the loss curve should match the single-card reference.
    3. Cross-node validation: First run communication bandwidth tests, then train a medium-scale model and verify loss and throughput across nodes.
    4. Full-scale short run: Run the full model for about 1000 steps; check loss decreases steadily, no NaN, and peak memory stays within budget.

    4. Gradient Communication Overlap

    4.1 Mechanism

    During backward propagation, once a shard unit’s gradients are computed, reduce-scatter can be initiated immediately. This communication overlaps with the backward computation of earlier layers. In FSDP2, each fully_shard unit is a communication unit; it determines the message size and timing of gradient communication.

    If shard units are too small, many small messages result in poor bandwidth utilization. If units are too large, the last unit’s communication cannot be hidden by subsequent computation, exposing communication time at the tail. Choose granularity considering both effects.

    4.2 Configuration Points

    • Prefetching: Use set_modules_to_forward_prefetch and set_modules_to_backward_prefetch to start all-gather for the next layer early. Start with a prefetch depth of 1; deeper prefetching increases peak memory.
    • Gradient accumulation: Disable gradient synchronization for all but the last micro-step by calling set_requires_gradient_sync(False) on the FSDP modules. Otherwise each micro-step triggers a reduce-scatter, multiplying communication volume.
    • Stream synchronization: Calls like .item(), torch.cuda.synchronize(), or synchronous logging in the training loop block the compute stream and prevent overlap. Avoid these in the main training loop; read logs every N steps.
    • Custom kernels: If custom kernels occupy communication streams or perform blocking operations on them, overlap will be broken.

    4.3 Acceptance Metrics

    Use a performance analysis tool to capture a timeline of steady-state training and calculate:

    • Exposed communication ratio: communication time not overlapped with compute kernels, divided by step time. Target below 10%; if above 20%, investigate configuration first.
    • Communication-to-compute ratio: total communication time divided by total compute time per step; indicates if communication is likely a bottleneck.
    • Measured reduce-scatter bandwidth: compare against baseline from Section 2.2; a >30% deviation at the same message size requires investigation.

    These thresholds are engineering starting points. If model structure or network topology is unusual, re-set based on baseline measurements.

    4.4 Common Configuration Errors

    • Forgetting to disable synchronization during gradient accumulation, doubling communication volume.
    • Sharding granularity misaligned with model structure, e.g., sharding tiny normalization layers separately.
    • Frequent synchronization in the training loop, breaking overlap while still producing correct individual steps, so the issue remains hidden.
    • Incorrect process group configuration between communication and compute, causing communication to cross device subsets that should be isolated.

    5. Checkpointing and Fault Tolerance

    5.1 Sharded Checkpoints

    The complete training state is approximately 39.2 TB: 5.6 TB for bf16 weights, 11.2 TB for fp32 master weights, and 22.4 TB for the two Adam states. With a storage aggregate write bandwidth of 10 GB/s, a single synchronous save takes about 3920 seconds (≈65 minutes). During that time training stops, wasting compute. Therefore sharded checkpoints must satisfy two requirements: each rank writes only its own shard, and the saving process is asynchronous.

    Using PyTorch Distributed Checkpoint (DCP) as an example, the core save code is:

    1. import torch.distributed.checkpoint as dcp
    2. from torch.distributed.checkpoint.state_dict import (
    3. get_model_state_dict,
    4. get_optimizer_state_dict,
    5. )
    6. state = {
    7. "model": get_model_state_dict(model),
    8. "optim": get_optimizer_state_dict(model, optimizer),
    9. "step": step,
    10. }
    11. future = dcp.async_save(state, checkpoint_id=tmp_dir) # asynchronous write to temporary directory

    Points to note for asynchronous saving:

    • Write to a temporary directory; only after all shards and manifest files are complete should rank 0 rename to the final directory. This prevents a partial checkpoint from looking complete if a failure occurs midway.
    • The manifest file records training step, total number of cards, size of each shard file, and SHA-256 checksum.
    • Save the RNG state and data loader read position. Without these, data order and randomness will not match the original training after recovery.
    • Keep the last K checkpoints, where K depends on storage capacity and save interval.

    DCP supports re-sharding on load, so checkpoints are usually usable when the number of cards changes. This capability must be verified at small scale, not assumed from documentation.

    5.2 Failure Recovery Workflow

    1. Detect failure: Use communication timeouts, node health checks, and process exit codes to identify the failed node.
    2. Stop the job: Terminate all processes to prevent leftover processes from holding memory or writing files.
    3. Select checkpoint: Restore from the latest checkpoint with a complete manifest; skip directories without a manifest or with checksum failures.
    4. Restart the job: Use an elastic launcher to restart processes. If the number of cards is unchanged, load directly; if changed, rely on DCP’s re-sharding.
    5. Verify recovery: The loss for the first few steps after recovery should match the recorded loss at save time within an acceptable error. If there is a significant deviation, stop training and check optimizer states and data positions.

    5.3 Validation Metrics

    • Blocking time per save: time the training thread actually waits. Target below 2% of step time.
    • Save throughput: GB written per second, compared to storage baseline.
    • Checksum pass rate: ratio of all shards passing checksum verification on recovery. Target 100%.
    • Recovery time: time from failure detection to resumption of training.
    • Lost steps: number of training steps between failure and the latest complete checkpoint; should not exceed the save interval.

    5.4 Common Errors

    • Overwriting the final checkpoint directory directly; after a mid-write failure both copies become unusable.
    • Saving only model weights and not optimizer states, leading to significant loss jumps after recovery.
    • Not recording total card count and sharding information at save time, making loading impossible after a card count change.
    • Not testing recovery until an actual failure reveals an unreadable checkpoint.

    Run at least one full round-trip test before full-scale training: save, force-terminate processes, restore, and compare loss and parameter checksums.

    6. Conclusion: Reproduction Condition Checklist

    All of the following checks must pass before the cluster is considered ready for reproduction:

    • Peak per-card memory is within budget, with at least 25% headroom.
    • Operator coverage is 100%; uncovered operators have a documented fallback or custom kernel solution that has been validated.
    • Communication bandwidth measurements deviate from baseline by no more than 30%.
    • Version matrix is recorded, and the target combination has been fully validated at small scale.
    • Data wait ratio is below 5%.
    • Exposed communication ratio is below 10%.
    • Checkpoint round-trip test passes, with loss after recovery matching the pre-save value.

    If any item fails, fix it before proceeding; do not rely on full-scale training results to compensate for acceptance gaps.

    Limitations

    The thresholds in this article are engineering starting points, not measured conclusions for any vendor or model. Acceptance only proves behavior under the tested version combination and scale; after upgrading versions or expanding scale, re-verification is required. Loss consistency at small scale does not guarantee identical convergence behavior at trillion scale. For specific adaptation conclusions, rely on original announcements and vendor test data, and use your own cluster measurements as the final basis.