Practical Guide to Training SOTA Multimodal Models on a Domestic Full-Stack AI Infrastructure

    This article examines the engineering path behind a SOTA multimodal model trained end to end on domestic accelerator cards and a domestic deep learning framework. It breaks down four core challenges of a domestic compute stack—operator coverage and precision alignment, collective communication efficiency, memory and sharding strategy, and toolchain maturity—then walks through reusable practices for environment setup, hybrid parallelism, mixed-precision stability, and data pipelines. It also covers inference deployment, evaluation dimensions for verifying training results, and common pitfalls to avoid.

    1. Background: Why Full-Stack Domestic Training Matters

    Multimodal models, which process image and text modalities together, keep growing in parameter count and data throughput. Training them demands substantial compute, high memory bandwidth, efficient collective communication, and complete framework operator coverage. For a long time, high-performance training has depended on a few mature ecosystems, creating two practical problems: supply chain and compliance risk, and the hidden cost of adapting operators and frameworks.

    The industry has recently seen the first SOTA multimodal model trained entirely on domestic chips: training ran on a cluster of general-purpose domestic accelerators, the software stack used a domestic deep learning framework, and the model plus an inference tutorial were released to a developer community. The significance is not any specific product, but the validation of an engineering path—from hardware and framework to parallel strategy and inference serving, the full chain can close the loop inside a non-mainstream ecosystem. Setting aside product specifics, this article discusses the general technical questions behind that path and the practices that can be reused.

    2. Four Core Challenges of a Domestic Compute Foundation

    1. Operator coverage and precision alignment. Multimodal models rely on many operators: convolution and patch embedding, attention variants, normalization, activation, and interpolation. Gaps in a domestic framework’s operator library must be filled with composite or custom operators, which introduces subtle numerical differences from mainstream implementations and can shift the loss curve.

    2. Collective communication efficiency. Multi-node, multi-card training depends on primitives such as AllReduce, AllGather, and ReduceScatter. Interconnect topology differs across hardware—intra-card, inter-card, and inter-node bandwidth—and strongly affects scaling efficiency. When communication and computation overlap poorly, speedup decays quickly as card count grows.

    3. Memory and sharding strategy. Multimodal activations consume far more memory than text-only models, especially with high-resolution inputs. Poorly chosen sharding granularity leads to peak memory overflow or wasted compute from frequent recomputation.

    4. Ecosystem toolchain maturity. Profiling, checkpoint resume, fault tolerance, and log collection determine the stability of long-running training, and are the most underestimated part of a domestic stack.

    3. General Engineering Practices on the Training Side

    3.1 Environment Setup and Reproducibility

    Pin the driver, runtime, and framework versions in a container image to avoid the same code behaving differently across nodes. A representative flow:

    1. # Pseudocode: general skeleton for the training entry point
    2. import mindspore as ms
    3. from mindspore import nn, dataset, Model
    4. ms.set_context(mode=ms.GRAPH_MODE, device_target="Ascend", device_id=local_rank)
    5. ms.amp.set_level("O2") # Mixed precision to reduce memory and improve throughput
    6. net = build_multimodal_model(cfg) # Vision encoder + text encoder + fusion layers
    7. opt = nn.AdamW(net.trainable_params(), learning_rate=cfg.lr, weight_decay=0.05)
    8. model = Model(net, optimizer=opt, metrics={"loss": nn.MAELoss()})
    9. model.train(cfg.epochs, train_dataset, callbacks=[TimeMonitor(), LossMonitor()],
    10. dataset_sink_mode=True)

    3.2 Combining Parallel Strategies

    A common practice is hybrid sharding with data parallelism plus tensor and pipeline parallelism: data parallelism raises throughput, tensor parallelism splits single-layer weights to relieve memory pressure, and pipeline parallelism splits by layer segments to reduce per-card load. The recommended order is to satisfy memory constraints first, then optimize communication overhead, and finally tune batch size and learning rate.

    3.3 Precision and Stability

    Mixed precision needs loss scaling, while normalization layers and attention softmax should keep higher precision. If the loss turns NaN, check three places first: the backward implementation of custom operators, the loss scaling factor, and abnormal samples or out-of-range labels in the data pipeline.

    3.4 Data Pipeline

    The bottleneck in multimodal training is often on the data side. Use sharded reads, prefetching, and parallel decoding; move image decoding and text tokenization into separate worker threads; and bucket samples by length and resolution to reduce padding waste.

    4. Inference Deployment and Performance Evaluation

    After training, the inference side focuses on three things: graph mode compilation optimization, operator fusion and quantization, and concurrency for serving. The general approach is to export the model to an intermediate representation, cut latency with operator fusion and low-precision quantization, then run elastic replicas on a container platform, with logging and monitoring to observe P99 latency, throughput, and error rate.

    Judging whether a result trained on a domestic stack is credible should cover at least four dimensions:

    • Convergence consistency: loss curve deviation from a reference implementation under the same data mix;
    • Scaling efficiency: throughput gain when card count doubles;
    • Memory level: peak usage and fragmentation;
    • Inference quality: reproducible metrics on a fixed evaluation set.

    5. Common Pitfalls and Recommendations

    Pitfall one is treating “it runs” as “training is done.” Results without precision alignment and convergence validation are not comparable. Pitfall two is adding cards blindly; with communication overhead unoptimized, scaling out yields little. Pitfall three is ignoring fault tolerance. Long-running training must implement periodic checkpoints and resume from checkpoint, otherwise a single node failure wastes a large amount of compute.

    For teams that want to reproduce similar work, the recommended path is to validate operators and precision at small scale on a single card, then scale to multiple cards to validate parallelism and communication, and finally enter long-running training with monitoring and alerting in place. If cloud resources are needed, general capabilities such as container platforms, object storage, and monitoring services can host the environment and data on demand, without binding to a specific ecosystem. The value of full-stack domestic training is turning this path into a standard engineering practice that is reproducible, measurable, and operable.