Running a Large Model Training Pipeline on 16 Locally Developed AI Accelerators: A Two-Node Practice
This article describes the engineering workflow for validating a large model training pipeline on 16 locally developed AI accelerators across two nodes. It covers software stack alignment, operator fallback strategies, collective communication testing, parallel configuration, memory and throughput optimization, and stability mechanisms such as gradient clipping and checkpoint recovery. The emphasis is on proving that the full training path—from data loading to forward and backward computation, gradient synchronization, parameter updates, and checkpoint saving—can run reliably before performance tuning.
1. Why “Running the Training Pipeline” Is Itself a Challenge
In the era of large models, training a language model with tens or even hundreds of billions of parameters is no longer simply a matter of “writing a model and tuning an optimizer.” It is a system-level engineering task. A complete training pipeline requires tight coordination across six layers: hardware, driver and runtime, operator libraries, collective communication libraries, training frameworks, and model code. Data is loaded from storage into memory, preprocessed, split into batches, and sent to accelerators. Forward computation produces activations, backward propagation computes gradients, collective communication synchronizes gradients across devices, the optimizer updates parameters, and checkpoints are written periodically.
For locally developed AI accelerators, the main challenge often lies in software ecosystem adaptation. Single-card compute capability may be adequate in some scenarios, but operator coverage, communication library stability, and the maturity of framework adaptation layers often determine whether the entire pipeline can close the loop. “Running the pipeline” means verifying that the full process—data loading → forward → backward → gradient synchronization → parameter update → checkpoint saving—can operate stably on real hardware without numerical anomalies, communication stalls, or out-of-memory errors. Completing several hundred iterations on two nodes with 16 cards is a practical validation milestone: it exposes potential issues at each layer quickly and with limited cost.
2. Software Stack Adaptation: Prerequisites for Startup
The first step is always the environment. This work may be tedious, but it is critical. It usually involves three key actions.
Driver and Runtime Alignment
The accelerator driver version, runtime library, and communication library must be strictly matched. Any version drift can cause hidden failures, such as being able to detect devices but failing to execute kernels. In engineering practice, the driver, runtime, communication library, and framework adaptation layer are often packaged into a unified container image and distributed through a container platform to avoid environment hell where “it runs on my machine but fails on yours.”
Operator Coverage and Fallback Mechanisms
Large models are composed of many operators. Not all operators have high-performance native implementations on locally developed accelerators. A common adaptation strategy is to use optimized native implementations for high-frequency core operators such as matrix multiplication, normalization, and attention, while using a general fallback mechanism for long-tail operators to ensure numerical correctness first. Efficient implementations can then replace these fallbacks gradually. When running the pipeline, numerical correctness should be prioritized; performance optimization can come later.
Collective Communication Library Verification
Multi-card coordination relies on collective communication primitives such as AllReduce, AllGather, ReduceScatter, and Broadcast. Before formal training, it is advisable to run independent communication benchmarks to verify intra-node multi-card and inter-node bandwidth and latency. This helps avoid misdiagnosing a communication problem as a model problem.
3. Parallel Strategy Selection for Two Nodes with 16 Cards
A single node with 8 cards or two nodes with 16 cards is a typical small-to-medium training scenario. The core question is: how to partition work across the data, model, and optimizer state dimensions so that 16 cards can collaborate effectively.
- Data Parallelism (DP): Each card holds a complete model replica and processes a different data shard. Gradients are synchronized with AllReduce after backward computation. This approach is simple and scales well, but it fails when the model cannot fit on a single card.
- Tensor Parallelism (TP): Large matrices in a single layer are split across multiple cards for collaborative computation. This mainly addresses the problem of a single layer’s parameters not fitting on one card. It is communication-intensive and is typically used within high-bandwidth intra-node interconnects.
- Pipeline Parallelism (PP): The model is split vertically by network layers, with different cards responsible for different layer segments. Activations are passed between stages like a pipeline. This can significantly reduce per-card memory pressure, but it may reduce utilization due to pipeline bubbles.
In large model training, these strategies are often combined into multi-dimensional parallelism. For two nodes with 16 cards, a common approach is to use tensor parallelism for the 8 cards inside each node because intra-node interconnect bandwidth is high, and to use data parallelism or pipeline parallelism across the two nodes because the network is relatively constrained. Communication-heavy operations should remain within the node as much as possible. The following pseudocode illustrates distributed initialization and parallel control:
# Initialize the distributed process group. world_size is the total number of cards (two nodes, 16 cards).dist.init_process_group(rank=local_rank, world_size=16)# Build model shards according to the parallel strategy (tensor parallel group contains intra-node cards).model = build_parallel_model(tp_group=intra_node_group)# Data parallel group: cards across nodes form the synchronization domain.dp_group = build_data_parallel_group(...)
4. Optimizing Memory and Throughput
Once the pipeline runs, the next problem is making it work and making it fast. Memory and throughput are often coupled and need to be balanced with combined techniques.
Mixed-Precision Training. Using BF16/FP16 for forward and backward computation can significantly reduce memory usage and improve compute utilization while retaining FP32 master parameters to maintain convergence accuracy. This is the de facto standard approach for large model training.
Activation Recomputation (Gradient Checkpointing). Instead of saving all activations during the forward pass, activations are recomputed as needed during the backward pass. This trades compute time for memory and is an effective way to relieve memory bottlenecks.
Optimizer State Sharding. Following a ZeRO-like approach, optimizer states, gradients, and parameters can be sharded across the data parallel group, greatly reducing redundant memory overhead per card.
Gradient Accumulation. When memory is insufficient to support a large batch, gradients can be accumulated over multiple steps to achieve an equivalent global batch size, balancing memory usage and convergence:
with autocast(dtype="bfloat16"):loss = compute_loss(model, batch) / grad_accum_stepsloss.backward()if (step + 1) % grad_accum_steps == 0:optimizer.step() # Gradients have been synchronized across cards.optimizer.zero_grad()
5. Hundreds of Iterations and Training Stability
Using “400 iterations completed” as a milestone is not about model quality. It is a smoke test for the pipeline: verifying that the training process is numerically healthy, the loss curve decreases reasonably, there is no NaN/Inf overflow, and communication and checkpoint mechanisms work correctly over several hundred steps. Reliable observability usually requires monitoring three core metrics:
- Loss curve: It should decrease steadily within a reasonable range. Spikes or prolonged plateaus often indicate issues with learning rate, data, or numerical behavior.
- Gradient norm: Sudden increases are often early signs of numerical instability and can be constrained with gradient clipping.
- Throughput and card utilization: These help determine whether parallel partitioning and communication overlap are reasonable, and can reveal idle time caused by waiting for communication.
Long-running training also requires built-in checkpoint resume capability. Model weights, optimizer state, learning rate scheduler state, and random number states should be saved periodically. If training is interrupted, it can resume precisely from the latest checkpoint, avoiding wasted compute. Logs, metrics, and alerts can be supported by general-purpose infrastructure such as logging services, monitoring and alerting systems, and object storage, forming a closed loop of “observability, traceability, and recoverability.”
6. Engineering Summary
The real value of running a large model training pipeline on locally developed accelerators is not that one run succeeds. It is that a reusable adaptation methodology is accumulated:
- Correctness first, then performance — Prioritize numerical correctness when starting the pipeline; optimize performance after stability is established.
- Validate communication early — Treat collective communication as an independent benchmark step to isolate issues.
- Match parallel strategies to topology — Place high-communication parallel dimensions within high-bandwidth interconnect scopes.
- Build in stability from day one — Integrate monitoring, gradient clipping, and checkpoint resume early rather than adding them later.
- Standardize the environment — Use container images to unify the software and hardware stack and eliminate troubleshooting costs caused by environment drift.
When these parts are connected, completing several hundred stable iterations on two nodes with 16 cards is no longer a one-time “pipeline run.” It becomes a capability foundation that can be replicated, scaled, and evolved smoothly toward larger workloads. This has practical engineering value for advancing autonomous and controllable large model training on heterogeneous computing platforms.
