Sparse LLM Inference Performance: Total Parameters vs. Activated Parameters

    This article explains why sparse Mixture-of-Experts (MoE) large language models can deliver strong performance with fewer activated parameters, and how to evaluate them rigorously. It separates total parameters, activated parameters, and cache usage; outlines key benchmarks such as throughput, TTFT, and tail latency; and covers engineering trade-offs including routing imbalance, full-weight residency, and in-batch heterogeneity. It closes with practical capacity planning and cost-balancing recommendations.

    1. Background: The Structural Conflict Between Parameter Growth and Inference Cost

    Over the past few years, improvements in large language model capability have largely depended on scaling up parameter counts. But the gains on the inference side do not scale linearly with total parameters. What actually determines the compute for a single forward pass is the number of parameters activated per pass, while memory usage is determined by all parameters (including inactive ones) plus runtime cache. This creates a structural conflict: capability demand pushes total parameters up, while latency and cost are strongly tied only to activated scale and memory bandwidth.

    Sparse architectures (Mixture-of-Experts, commonly referred to as MoE) are a general-purpose answer to this conflict. They split a dense feed-forward layer into multiple parallel expert branches, and a routing module selects a few branches for each token to participate in computation. As a result, a model can have a very large “knowledge capacity,” while the computation graph for a single token includes only a small fraction of the weights.

    2. Core Mechanism: Decoupling Total Parameters from Activated Parameters

    The key to understanding performance is to look at three quantities separately:

    • Total parameters: determine the static memory footprint, affecting load time, the number of devices required, and how parallelism is partitioned.
    • Activated parameters: determine the floating-point operations and compute pressure per token, and are the main source of throughput and latency.
    • Cache usage: directly related to sequence length, batch size, and whether paged cache management is used; often the real bottleneck in long-context scenarios.

    Compare a sparse model with roughly 397 billion total parameters and roughly 17 billion activated parameters against a sparse model with roughly 671 billion total parameters and roughly 37 billion activated parameters. The latter has more than twice the activated volume of the former. In compute-constrained or high-concurrency scenarios, the difference in activated volume shows up directly as a throughput gap. In memory-constrained scenarios, the gap in total parameters determines whether a single machine can host the model and how many tensor-parallel ways are needed. In other words, “fewer parameters, fewer activations, yet comparable performance” is not a coincidence, but the inevitable result of sparse architectures decoupling capacity from computation.

    3. Evaluation Dimensions: How to Rigorously Measure Inference Performance

    Talking about “fast” without a scenario is meaningless. It is recommended to establish baselines across at least the following dimensions:

    1. Throughput (tokens/s): distinguish single-request generation speed (constrained by memory bandwidth and activated volume) from overall service throughput (constrained by batching efficiency).
    2. Time to first token (TTFT): affected by the compute of the prefill stage and context length; most sensitive for interactive applications.
    3. Tail latency (P95/P99): determines the lower bound of user experience, usually caused by queuing, memory fragmentation, and long requests cutting in line.
    4. Resource usage: static weight memory, cache memory, host memory (when weights are swapped in and out), and network bandwidth.
    5. Quality metrics: accuracy and consistency on the target business set, to avoid selection bias from looking at speed alone.

    A schematic load-testing loop can be written as the following pseudocode. The focus is on fixing the input distribution, gradually increasing load, and recording tail latency:

    1. # Pseudocode: layered load increase, recording throughput and tail latency
    2. for concurrency in [1, 4, 16, 64, 128]:
    3. metrics = run_benchmark(
    4. model=endpoint,
    5. input_len=2048, # fixed input distribution
    6. output_len=512,
    7. concurrency=concurrency,
    8. duration_sec=120,
    9. )
    10. report(concurrency,
    11. throughput=metrics.tokens_per_sec,
    12. ttft_p50=metrics.ttft.p50,
    13. ttft_p95=metrics.ttft.p95,
    14. mem_peak=metrics.gpu_mem_peak)

    4. Engineering Costs and Tuning Priorities of Sparse Architectures

    Sparsity is not free, and engineering must confront three points:

    • Routing imbalance: a few popular experts are over-selected, causing some devices to queue. Capacity factors and load-balancing auxiliary losses can be introduced, or expert replicas and dynamic scheduling can be done on the inference side.
    • Full weights still need to be resident: the memory benefit shows up in computation and bandwidth, not in “loading only the activated part.” Therefore, quantization, parallel partitioning, and layered loading remain essential.
    • In-batch heterogeneity: tokens in the same batch select different experts, causing the actual computation graph to fluctuate. Setting a reasonable maximum batch size, enabling paged cache management, and pooling long and short requests separately can significantly flatten tail latency.

    In practice, first use smaller concurrency to find the inflection point of a single card (or single node), then decide the tensor-parallel degree and number of replicas accordingly. When TTFT exceeds the target, prioritize adding compute and optimizing prefill; when throughput is insufficient, prioritize improving batching efficiency and cache hit rate.

    5. Implementation Recommendations: Capacity Planning and Cost Balance

    1. Define constraints before choosing a form: if memory-constrained, prioritize total parameters and quantization schemes; if latency-constrained, prioritize activated parameters and parallelism strategy.
    2. Use tiered services to handle different traffic: interactive traffic goes to a low-latency pool, offline batch processing goes to a high-throughput pool, sharing the same weights but isolating queues.
    3. Build an observability loop: bring throughput, TTFT, tail latency, memory watermark, and error rate into monitoring and alerting, and combine with logging services for request-level tracing, so capacity decisions have a basis.
    4. Stay architecture-neutral: model weights, inference frameworks, and compute resources should be replaceable, avoiding strong coupling to a single runtime.

    When deploying on the cloud, you can combine container platforms to host inference instances, object storage to distribute weights, message queues to smooth peaks and fill valleys, and monitoring, alerting, and logging services to locate long-tail issues. The general cloud infrastructure capabilities provided by Baidu AI Cloud can serve as the foundation for such an architecture, but specific choices should still be based on load-testing data.

    6. Conclusion

    The value of ultra-large sparse models lies not in “more parameters,” but in separating capacity from computation: trading a controllable activated scale for results close to a dense large model, while significantly reducing the compute and bandwidth overhead per request. When evaluating such models, observe both the resource threshold determined by total parameters and the service efficiency determined by activated parameters, and replace single-point conclusions with layered load testing and an observability system, so that a stable balance among quality, latency, and cost can be achieved.