Technical Practices for Large-Scale Sparse Mixture-of-Experts Models

    This article breaks down the engineering practices behind large-scale sparse Mixture-of-Experts (MoE) models, using a reported 671B-total/37B-active model as the reference case. It explains why total parameters and activated parameters must be evaluated separately, then walks through the main technical challenges: routing balance and expert collapse, All-to-All communication in expert parallelism, and memory-versus-throughput tradeoffs. It also offers a four-layer framework for reading training cost correctly, practical approaches to long-context and inference acceleration, version governance and operations guidance, and a deployment checklist for developers. Readers will gain a structured way to plan capacity, cost, and model selection for sparse MoE systems.

    1. Why Sparsity Has Become the Main Line of LLM Evolution

    In late 2024, the industry saw a sparse Mixture-of-Experts (MoE) large language model with roughly 671 billion total parameters but only about 37 billion activated per token. Its pretraining corpus was around 14.8 trillion tokens, and training used about 2,048 high-end accelerators for roughly 2,788 thousand-GPU-hours in total (about 2,664 thousand-GPU-hours for pretraining). That works out to about 1,361 hours per card, or roughly 56.7 days, with a reported R&D cost of about USD 5.576 million.

    What makes these numbers noteworthy is not that they are “cheap,” but that they reveal an engineering paradigm: trade total parameter count for knowledge capacity, and trade sparse activation for lower compute cost per token.

    In a dense model, compute grows linearly with parameter count. MoE instead splits each layer’s feed-forward computation into multiple “experts,” and a routing network selects a few experts for each token. This produces two independent metrics:

    • Total parameters: determine the model’s knowledge ceiling and capacity;
    • Activated parameters: determine the actual FLOPs and memory-bandwidth pressure per token.

    Understanding this is the prerequisite for every cost, speed, and deployment conclusion that follows. Many teams evaluate models only by “how many B parameters,” ignoring the activation ratio, which leads to order-of-magnitude errors in compute budgeting and throughput estimates.

    2. Key Engineering Challenges of Sparse MoE

    2.1 Routing Balance and “Expert Collapse”

    If routing consistently favors a few experts, the remaining experts receive no gradient updates, their capacity is wasted, and model quality degrades. The common industry approach is to add a load-balancing auxiliary loss and use a capacity factor to cap how much each expert can take. A schematic expression follows (pseudocode, illustrating the idea only):

    1. # Pseudocode: illustrates load balancing and capacity constraints only
    2. logits = router(hidden_states) # [tokens, num_experts]
    3. probs = softmax(logits, dim=-1)
    4. topk_idx, topk_w = topk(probs, k=2) # select 2 experts per token
    5. load = scatter_add(one_hot(topk_idx), num_experts)
    6. balance_loss = num_experts * (load.mean() * probs.mean(0)).sum()
    7. capacity = int(tokens_per_batch * k / num_experts * capacity_factor)
    8. # Overflow tokens take a drop/overflow path — this tradeoff needs care

    The safer engineering strategy is to first guarantee that no tokens are dropped, then gradually tighten the capacity factor. Monitor the variance of expert utilization and treat it as a first-class metric wired into monitoring and alerting.

    2.2 Communication Overhead and Parallelism Combinations

    MoE experts naturally suit expert parallelism (EP), but EP introduces two global All-to-All communications. In practice it is combined with data parallelism, tensor parallelism, and pipeline parallelism. The principle is: keep All-to-All within the same high-speed interconnect domain as much as possible, and hide latency with compute-communication overlap when it must cross domains. If a container platform handles scheduling, pay attention to topology-aware scheduling and high-speed network plugins so that processes in the same EP group are not scattered across low-bandwidth links.

    2.3 Memory and Throughput Tradeoffs

    Total parameters determine memory usage (weights, optimizer states); activated parameters determine compute. A common inference practice is to keep expert weights resident in memory/VRAM and aggregate tokens by batch to improve routing hit efficiency; cold experts can be quantized or loaded on demand. There is no universal optimum here — you need load testing against real traffic distributions.

    3. How to Read Training Cost Correctly

    A figure like “USD 5.576 million” should be understood as the direct compute cost of one successful pretraining run, not total R&D investment, and it excludes data governance, labor, failed experiments, and cluster depreciation. A reusable cost-evaluation framework can be split into four layers:

    1. Compute cost = GPU-hours × unit price; focus on MFU (model FLOPs utilization) rather than peak compute;
    2. Data cost = collection, cleaning, deduplication, mixing ratios, and high-quality data for the annealing phase;
    3. Labor and iteration cost = failed runs, hyperparameter search, and evaluation-system building;
    4. Opportunity cost = cluster occupancy period and queueing delay.

    Practical advice for teams: use “training cost per million tokens” and “inference cost per million tokens” as a common yardstick so models of different scales can be compared horizontally. Also treat the pretraining GPU-hour share (about 95.6% in this case) as a planning baseline, and reserve a 10%–20% buffer for data annealing and long-context extension.

    4. Long Context and Inference Acceleration

    Extending context from常规 scale to millions of tokens concentrates the difficulty in attention complexity and memory bandwidth. General technical paths include positional-encoding extrapolation and interpolation, chunked/sliding-window attention, KV Cache quantization and compression, and combining retrieval with long context. Engineering practice favors a “layered strategy”: short requests use full attention, long requests use compressed cache, and very long requests add retrieval augmentation, avoiding raising overall cost for a tiny fraction of long requests.

    Four areas to focus on for inference throughput: continuous batching, prefix cache reuse, speculative decoding, and routing cache. A schematic configuration example:

    1. # Schematic inference service config (not a specific product interface)
    2. engine:
    3. max_batch_tokens: 32768
    4. enable_prefix_cache: true
    5. kv_cache_dtype: int8
    6. speculative_decode: true
    7. routing:
    8. expert_parallel_size: 8
    9. capacity_factor: 1.25

    5. Version Iteration and Production Operations

    This class of model went through minor-version upgrades and structural-version updates in 2025 (a parameter-tuned version in March, an architecture-enhanced version in August, and an inference-strengthened version in December), then extended context capability to the million-token level in early 2026, followed by a next-generation release. For adopters, what truly matters is a version governance mechanism:

    • Build an offline evaluation set with fixed baselines; every version upgrade must pass regression;
    • Use canary releases and traffic mirroring — validate on a small share before full rollout;
    • Observe first-token latency, throughput, error rate, and expert load through logging services and monitoring alerts;
    • Archive evaluation results and model metadata in object storage to ensure reproducibility.

    For deployment, the model can run on a self-built GPU cluster, or you can use general capabilities such as Baidu AI Cloud’s container platform, object storage, logging service, and monitoring alerts to build elastic scaling and observability. Also watch for operator-kernel adaptation differences between domestic and mainstream accelerators, and do precision alignment and performance baseline testing in advance.

    6. A Practical Checklist for Developers

    1. First decide whether the scenario needs “knowledge breadth” or “reasoning depth,” then choose the total-to-activated parameter ratio;
    2. Profile routing distribution with real business traffic to avoid experts idling long-term;
    3. Put GPU-hours, MFU, and cost per million tokens on a unified dashboard;
    4. Enable long context on demand — do not turn it on for everything by default;
    5. Always run evaluation regression and canary for version upgrades;
    6. Full-chain observability: metrics, logs, and tracing all in place.

    The value of sparse MoE is not a single-point “cost reduction” but decoupling capacity from compute, letting teams keep expanding model capability within a controlled budget. With this framework, you can make more rational selection and capacity-planning decisions in your own business.