Getting a Full LLM Pretraining Pipeline Running on Domestic GPUs: A Practical Guide

    This article walks through the practical steps for bringing up a complete large language model pretraining pipeline on domestic accelerator cards, using a two-node, sixteen-GPU, 400-step smoke test as the baseline. It covers environment alignment, storage and interconnect validation, parallel strategy, mixed precision and numerical stability, checkpointing, observability, and a troubleshooting order for common failures, aiming to establish a reusable engineering baseline before scaling up.

    1. Why Getting the Pipeline Running Matters More Than Raw Speed

    In large model engineering, bringing a complete pretraining pipeline up on domestic accelerator cards is often more challenging than chasing throughput numbers alone. Getting the pipeline running means closing the loop across operator coverage, the communication backend, mixed precision, checkpointing, the data pipeline, and monitoring and alerting. A gap in any one of these can prevent training from starting or cause a silent failure after a number of steps. A two-node, sixteen-GPU, 400-step run sits in a “verifiable but not expensive” smoke test range: enough steps to expose memory leaks, gradient anomalies, learning rate scheduling errors, and communication jitter, while still being short enough to iterate on repeatedly.

    2. Environment Setup: Narrowing Down Uncertainty

    1. Aligning the Base Software Stack

    Pin the driver, runtime, communication library, and framework versions as a manifest, then run a consistency check across both nodes. A common approach is to generate a version fingerprint file and compare hashes:

    1. # Example: collect version fingerprints of key components
    2. collect_versions > nodeA.env
    3. collect_versions > nodeB.env
    4. diff nodeA.env nodeB.env && echo "environment aligned"

    2. Storage and Data Readability

    Put training data on shared file storage or object storage, and use a local cache to accelerate random reads. Before going live, run a full readability inspection: sample-check the sample count, field completeness, and decode success rate to avoid an abnormal exit mid-training caused by a few corrupted samples.

    3. Network and Interconnect Validation

    The core risk in a two-node setup is cross-node bandwidth. Start with a small-scale collective communication benchmark to confirm bandwidth and latency meet expectations before moving to real training. If the interconnect link is degraded, all subsequent performance optimization loses its meaning.

    3. Parallel Strategy: Balancing Memory and Communication

    Sixteen GPUs typically map to a combination of intra-node tensor parallelism and cross-node data parallelism. Tensor parallelism splits the weights of a single layer, reducing per-GPU memory pressure, but it amplifies intra-layer communication frequency, so it should be confined to the high-bandwidth domain within a single node. Data parallelism expands across nodes with relatively manageable communication volume, and gradient accumulation can amortize the synchronization overhead. A practical rule of thumb: first keep per-GPU memory usage at a safe level (for example, leaving more than ten percent headroom), then gradually increase the batch size until throughput stops improving.

    1. # Example: parallelism and gradient accumulation configuration
    2. config = {
    3. "tensor_parallel_size": 8, # confined within a single node
    4. "data_parallel_size": 2, # expanded across nodes
    5. "micro_batch_size": 1,
    6. "gradient_accumulation": 16,
    7. "precision": "bf16",
    8. }

    4. Mixed Precision and Numerical Stability

    Half-precision training can significantly reduce memory and bandwidth pressure, but it must be paired with loss scaling and numerical clipping. In practice: keep higher precision for normalization layers and loss computation; enable gradient norm clipping with a threshold that is not too loose; and periodically check optimizer states to prevent a silent exponential drift. In a short 400-step run, the most likely problem to surface is not a model that fails to converge, but a sudden activation value overflow at some step, so moving anomaly detection ahead to the first step is a sensible choice.

    5. Checkpointing and Fault Tolerance

    Short runs still need checkpoints, not to resume progress but to verify the correctness of the save and load path. Save once at step zero, step one hundred, and step three hundred ninety-nine, and run a cross-node load-and-replay drill. If a container platform handles scheduling, confirm that after a task restart it can automatically mount the same storage and continue from the latest checkpoint.

    6. Observability: Making Every Step Explainable

    Whether training is “actually learning” needs metrics, not intuition. Collect at least: loss and gradient norm, per-layer activation distributions, per-GPU memory curves, the share of time spent in collective communication, and data read wait time. Wire these metrics into a logging service and monitoring alerts with thresholds that trigger notifications, so you can quickly pinpoint within 400 steps whether the issue is data, numerical, or communication related.

    7. Common Failures and Troubleshooting Order

    1. Fails at startup: usually a missing operator or a version mismatch; check the environment fingerprints first.
    2. Runs fine for the first few steps then stops: suspect a decode error on individual samples or memory fragmentation first.
    3. Throughput keeps dropping: check whether the interconnect link is degraded or whether there is a data read bottleneck.
    4. Loss spikes: roll back to the most recent checkpoint, tighten the clipping threshold, and lower the peak learning rate.

    8. Conclusion

    Completing a two-node, sixteen-GPU, 400-step pretraining pipeline validation on domestic accelerator cards delivers a reusable engineering baseline: an alignable environment, an explainable parallel strategy, monitorable numerics, and recoverable failures. Once this baseline is stable, scaling to larger sizes and more steps becomes a move with predictable returns.