Bringing Up Large Model Training on Domestic GPUs: A Practical Guide
This article walks through the practical process of validating a large model training pipeline on domestic GPU hardware, where getting the pipeline working end to end matters more than peak throughput. It covers the four thresholds of pipeline bring-up (operator coverage, distributed correctness, numerical stability, and long-run observability), a three-layer environment preparation checklist with a self-check script, a progressive approach to parallelism configuration, the metrics to watch across a 400-step run, and a troubleshooting order for common failures. The goal is a reusable migration methodology rather than a single benchmark number.
1. Why “Getting the Pipeline Working” Matters More Than “Running Fast”
In large model engineering, the gap between “a single card can compute” and “stable iteration over hundreds of steps across multiple nodes and cards” contains many engineering hurdles that are easy to underestimate. The industry commonly calls this stage pipeline bring-up: it does not chase peak throughput, but verifies whether the compute, communication, storage, and scheduling paths form a closed loop and whether numerical behavior matches expectations.
Pipeline bring-up usually means clearing four thresholds:
- Operator coverage: whether operators in the model structure, such as attention, normalization, activation, and positional encoding, have available and correct high-performance implementations on the target backend, and whether they can fall back to generic implementations without crashing when missing.
- Distributed correctness: after combining data parallelism, tensor parallelism, and pipeline parallelism, whether gradient reduction, parameter synchronization, and random seeds stay consistent.
- Numerical stability: whether the loss decreases smoothly under mixed precision, and whether overflow, sudden jumps, or silent precision degradation occur.
- Long-run stability and observability: across hundreds of consecutive steps, whether memory leaks, communication timeouts, or silent process exits appear.
Two nodes with sixteen cards and four hundred steps is a typical minimum credible validation scale: the scale is large enough to expose multi-node communication and scheduling issues, the step count is enough to cover learning rate warmup, loss curve formation, and several checkpoint saves, and the cost stays manageable.
2. Environment Preparation: Move Uncertainty Forward
Most pipeline failures do not originate in model code but in the environment. It is advisable to split preparation into three layers and validate them one by one.
- Base layer: fix the version combination of drivers, runtime, and collective communication libraries, and bake it into the image, avoiding the hardest issues to diagnose, such as “each machine has a slightly different version.”
- Framework layer: keep the training framework, parallelism strategy library, mixed precision and memory optimization components on the same version, and make explicit which operators use high-performance implementations and which use generic fallbacks.
- Data layer: store training samples in a sharded format, ensure balanced sample counts across shards, and use multi-process prefetching for data loading so that I/O jitter is not mistaken for slow computation.
A sample environment self-check script can be written as:
import os, hashlib, jsondef fingerprint():keys = ["RUNTIME_VERSION", "COMM_LIB_VERSION", "FRAMEWORK_VERSION"]return {k: os.environ.get(k, "unknown") for k in keys}def shard_check(root):shards = sorted(os.listdir(root))sizes = {s: os.path.getsize(os.path.join(root, s)) for s in shards}digest = hashlib.md5(json.dumps(sizes, sort_keys=True).encode()).hexdigest()return len(shards), digest # All nodes must return identical valuesif __name__ == "__main__":print(fingerprint(), shard_check("/data/shards"))
The criterion is straightforward: the version fingerprint and shard digest must be identical across all nodes; otherwise, fix the environment before discussing training.
3. Parallelism Configuration: Converge First, Then Speed Up
The first counterintuitive lesson in multi-node, multi-card training is that all “acceleration switches” should be turned off initially. It is recommended to introduce complexity gradually in the following order.
- Pure data parallelism: verify gradient reduction and the loss curve, and confirm that bandwidth and latency between the two nodes are normal.
- Add tensor parallelism: split single-layer computation across multiple cards, and observe whether communication overhead becomes too high and numerical deviation appears.
- Introduce pipeline parallelism: adjust the number of micro-batches and split points, and handle pipeline bubbles and uneven load at the first and last stages.
- Finally enable memory optimization and operator fusion: including recomputation, overlapping communication with computation, and a fused optimizer.
Keep the configuration to a minimum viable principle and avoid stacking too many features at once:
parallel:data_parallel_size: 2tensor_parallel_size: 4pipeline_parallel_size: 2precision:compute_dtype: bf16reduce_dtype: fp32optimizer:fused: false # Disabled initially; confirm convergence firstrecompute: false # Enable after things are stablecheckpoint:interval_steps: 50keep_last: 3
Keeping reduce_dtype at higher precision, and using higher-precision accumulation for optimizer states and gradient reduction, is a common practice for suppressing mixed precision drift.
4. What to Watch During Four Hundred Steps
The step count is small, but every step answers a question. It is recommended to build dashboards for four categories of metrics:
- Convergence: loss, gradient norm, and learning rate. Loss should decrease smoothly; a sudden spike in gradient norm usually indicates anomalous data or precision overflow.
- Performance: per-step time, the share of compute versus communication time, and peak memory. In multi-node scenarios, if the communication share stays high over time, first check whether the topology and parallelism split match.
- Stability: number of surviving processes, number of collective communication timeouts, and checkpoint write time.
- Consistency: whether the step count and loss reported by different nodes agree, used to detect “some cards silently falling behind.”
A lightweight example of metric reporting and anomaly circuit breaking:
def step_hook(step, loss, grad_norm, stats):log = {"step": step, "loss": float(loss),"grad_norm": float(grad_norm), **stats}tracker.append(log) # Write to logging service/monitoring alertsif grad_norm > 1e4 or step % 50 == 0:checkpoint.save(step) # Save on anomaly or periodicallyif stats["comm_ratio"] > 0.6:profiler.mark(step) # Mark interval for later analysis
5. Common Problems and Troubleshooting Order
- Loss does not decrease: first confirm there are no duplicate data shards and labels are aligned correctly, then check the learning rate and warmup steps, and only then suspect precision settings.
- Multi-node is slower than single-node: locate the communication share, check whether the parallelism split causes excessive cross-node traffic, and try to keep high-frequency communication within a node.
- Process exits midway: check whether peak memory is maxed out or communication times out; recomputation and finer sharding usually help.
- Corrupted checkpoints: use asynchronous or double-buffered writes, and keep the last several usable checkpoints to avoid a single point of failure forcing an overall rollback.
6. The Value of a Migration Methodology
Completing a two-node, sixteen-card, four-hundred-step training validation on domestic accelerator cards matters not for any specific number, but for distilling a reusable migration methodology: consistent environment fingerprints, progressive introduction of parallelism strategies, metrics dashboards first, and a checkpoint strategy as a fallback. For teams that want to run large model training and fine-tuning on Baidu AI Cloud heterogeneous computing resources, turning this process into a standard operating procedure, combined with general cloud product capabilities such as container platforms, object storage, and monitoring alerts, can significantly shorten the cycle from hardware arrival to stable iteration, leaving engineering effort for the model and data themselves.
