Adapting Large Model Training to a China-Developed GPU: FSDP2 Setup and Two-Node, 16-GPU Validation

    This article explains how to adapt large model training to a China-developed full-featured GPU. It distinguishes training adaptation from inference-focused "Day 0" support, outlines an FSDP2-based setup for multimodal models with sample code, and summarizes a two-node, 16-GPU validation run that completed 400 optimizer updates. It also covers the metrics used to monitor training stability, the supporting infrastructure components, and the work needed to scale beyond an initial validation.

    In recent years, the parameter counts of large language models and multimodal models have grown rapidly, and models with a trillion parameters have become a common topic in the industry. For compute platforms, getting a model to run is only the first step. Getting it to converge stably over training runs that last weeks or even months is the harder engineering problem. This article uses the training adaptation work on a China-developed full-featured GPU as background, reviews the key steps involved, and offers practical approaches for reference.

    1. Inference Adaptation vs. Training Adaptation

    Many platforms claim “Day 0 adaptation” for the latest open-source models. This term usually refers to inference adaptation, meaning the model can be loaded on the target chip and complete forward computation to produce outputs. Training adaptation has much higher requirements. During training, the chip and software stack must also stably complete backpropagation, gradient synchronization, and optimizer updates.

    A complete training pipeline includes model loading, parameter sharding, gradient computation, cross-device communication, and parameter updates. A numerical overflow, a missing operator, or a communication timeout at any one of these stages can interrupt training. Therefore, whether a platform can train models should be judged by whether it stays stable in long, large-scale jobs, not by whether a single forward pass succeeds.

    2. Building a Multimodal Training Path with FSDP2

    A single GPU’s memory cannot hold a trillion-parameter model and its optimizer states, so training must rely on a distributed framework. Fully Sharded Data Parallel (FSDP) splits parameters, gradients, and optimizer states across devices. Parameters are gathered on demand during computation and released after use. PyTorch’s FSDP2 implements this mechanism through the fully_shard interface. Its interface differs from the first-generation FSDP, so each change must be checked item by item during migration.

    Multimodal models typically include a vision encoder, a language model, and an alignment layer. These components differ significantly in compute load and memory usage. In practice, three issues need particular attention:

    1. Sharding granularity: Call fully_shard on each Transformer layer, then wrap the root module, so communication can overlap with computation layer by layer.
    2. Overlap of communication and computation: Run All-Gather and Reduce-Scatter asynchronously to hide communication cost behind computation.
    3. Gradient consistency under mixed precision: Parameters take part in computation in bfloat16, while gradient reduction uses float32 to reduce precision loss during cross-node accumulation.

    The following sample code illustrates the setup logic. Model definitions, data loading, and other details are omitted. The uppercase variables and the access path for layers are placeholders and must be replaced for your environment:

    1. import os
    2. import torch
    3. import torch.distributed as dist
    4. from torch.distributed.fsdp import fully_shard, MixedPrecisionPolicy
    5. from torch.distributed.device_mesh import init_device_mesh
    6. # Replace the backend with the collective communication library provided by
    7. # the GPU vendor, and confirm it is compatible with your PyTorch version.
    8. dist.init_process_group(backend=COMM_BACKEND)
    9. local_rank = int(os.environ["LOCAL_RANK"])
    10. mesh = init_device_mesh(DEVICE_TYPE, (WORLD_SIZE,))
    11. model = build_multimodal_model() # Vision encoder, language model, alignment layer
    12. mp_policy = MixedPrecisionPolicy(
    13. param_dtype=torch.bfloat16,
    14. reduce_dtype=torch.float32,
    15. )
    16. # Shard by Transformer layer first, then wrap the root module
    17. for layer in model.language_model.layers:
    18. fully_shard(layer, mesh=mesh, mp_policy=mp_policy)
    19. fully_shard(model, mesh=mesh, mp_policy=mp_policy)
    20. # Create the optimizer after sharding; it receives the sharded parameters
    21. optimizer = torch.optim.AdamW(model.parameters(), lr=1e-5)
    22. scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=10000)
    23. for step, batch in enumerate(dataloader):
    24. with torch.autocast(device_type=DEVICE_TYPE, dtype=torch.bfloat16):
    25. outputs = model(batch)
    26. loss = compute_loss(outputs, batch)
    27. loss.backward()
    28. torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
    29. optimizer.step()
    30. scheduler.step()
    31. optimizer.zero_grad()

    3. Validating Cross-Node Training on Two Nodes with 16 GPUs

    In one test on two nodes with 16 GPUs, all 16 training processes completed 400 consecutive optimizer updates. The test record does not disclose model size, parallel configuration, or throughput data. This result should therefore be treated as a validation record, not as a reproducible performance benchmark.

    This type of test checks three capabilities: compute and memory management on each GPU, communication efficiency across nodes over RDMA networks, and the software stack’s fault tolerance and recovery under abnormal conditions. The metrics below are common criteria for judging training stability. The thresholds are only starting points and should be calibrated for the specific model and task.

    Metric Expected State Suggested Action When Abnormal
    Loss Decreases steadily without sharp fluctuations Check learning rate, data batches, and precision settings
    Gradient norm Stays within a bounded range, with no sudden spikes and no persistent zeros On spikes, check gradient clipping and operator precision. If persistently zero, check whether communication is taking effect.
    Memory (OOM) Memory usage stays within limits Adjust sharding granularity, activation recomputation, or batch size
    Numerical values (NaN/Inf) No numerical anomalies Locate the first layer where the anomaly appears, and check the low-precision compute path
    Communication timeouts No timeouts, or automatic recovery after a timeout Check RDMA network and collective communication configuration, and verify checkpoint resumption

    Only when these baseline metrics are stable does it make sense to scale up. Scaling itself still requires separate validation, because communication topology and failure probability change as the number of nodes grows.

    4. Engineering Infrastructure and General Cloud Components

    A training platform also needs supporting components for containers, storage, and monitoring. Consider the following when selecting them:

    • Container environment: Driver, framework, and communication library versions in the image must be compatible with each other. Pin the versions to make results reproducible.
    • Data storage: Object storage and parallel file systems must deliver throughput that keeps pace with how fast GPUs consume data. Otherwise, GPUs sit idle while waiting for data.
    • Monitoring and alerting: Collect temperature, memory usage, compute utilization, and communication bandwidth for each GPU to locate individual faulty nodes.
    • Checkpoint-based resumption: Periodically save model parameters, optimizer states, and random seeds so training can resume from the latest checkpoint after an interruption.

    5. From Trainable to Usable

    Once the training pipeline works end to end, lowering the barrier for developers becomes the next priority. Three directions deserve sustained investment:

    • Automated operator adaptation: Build better operator compilation and optimization tools to reduce the effort of writing operators by hand.
    • Simpler multi-device coordination: Let the framework select parallel strategies automatically based on cluster topology, reducing manual configuration.
    • Integrated toolchain: Cover data preprocessing, model training, checkpoint resumption, and inference deployment in one workflow.

    Three types of problems occur frequently in practice and should be checked before formal training begins:

    • Missing operators: An operator used in training may not be implemented on the target platform. This often surfaces only during the backward pass. Run the complete forward and backward pass before formal training.
    • Communication timeouts: These become more likely as the node count increases. Check the network topology and timeout parameters.
    • Precision overflow: Gradients may overflow under bfloat16. Check this with gradient clipping and loss scaling.

    Adapting large model training is a systems engineering effort that spans hardware and software. Correct FSDP2 usage, item-by-item validation of cross-node stability, and reliable engineering components together determine whether training can run continuously. The two-node, 16-GPU test shows that the platform has initial capability for sustained training. Supporting larger training runs will require more complete test data, including model configurations, throughput, and fault recovery results.