Activated Parameters in Sparse LLMs: A Practical Guide to Inference Cost

    This article explains what activated parameters are and how they differ from total parameters in sparse large language models. It covers why architectures such as Mixture-of-Experts (MoE) and sparse attention keep the activation ratio low, and breaks down the four resources that matter for deployment: memory capacity, compute, bandwidth, and latency stability. You will also find common misconceptions, capacity estimation examples, and a step-by-step approach to benchmarking and model selection, including how to compare sparse models against dense baselines on cost per million tokens.

    1. What Are Activated Parameters

    Activated parameters are the subset of model weights that actually participate in computation and produce numerical results during a single forward pass. The counterpart is total parameters: the full parameter count stored in the weight files. The relationship can be expressed with a minimal formula:

    1. N_total = total parameter count
    2. p = activation ratio (0 < p <= 1)
    3. N_act = N_total * p

    A dense model is the special case where p = 1: every token flows through all weights. A sparse model makes p significantly smaller than 1, which produces the familiar “large total, small activated” specification pattern. Typical public magnitudes look roughly like this (for order-of-magnitude illustration only):

    Architecture Total Params Activated Params Ratio p
    Sparse Mixture-of-Experts 671B 37B ≈5.5%
    Sparse Mixture-of-Experts 800B 30B ≈3.75%
    Sparse Mixture-of-Experts 320B 18B ≈5.6%
    Sparse Mixture-of-Experts 600B 27B 4.5%
    Sparse Mixture-of-Experts ~266B 10B ≈3.8%
    Sparse Activation 501B 23B ≈4.6%
    Dense Reference ~744B 400B ≈53.8%

    The last row is the key comparison: even a model with a relatively “high” activation ratio still activates far fewer parameters than its total, which shows that sparsification has become a common engineering choice for large-scale models.

    2. Why Sparse Architectures Lower the Activation Ratio

    2.1 Conditional Computation in Mixture-of-Experts

    MoE splits the feed-forward layers into multiple parallel “expert” subnetworks, and a router (gating network) selects the Top-K experts for each token. Total parameters grow linearly with the number of experts, while per-token compute depends only on the K selected experts, so p ≈ K / number of experts (plus non-sparse parts such as attention and embeddings). This is where “decoupling capacity from compute” comes from.

    1. # Illustration: conditional computation with Top-K routing (pseudocode)
    2. logits = router(hidden) # [tokens, num_experts]
    3. topk_idx = logits.topk(k=2).indices
    4. y = zeros_like(hidden)
    5. for e in unique(topk_idx):
    6. mask = (topk_idx == e).any(dim=-1)
    7. y[mask] += expert_e[hidden[mask]] # only selected tokens enter the expert

    2.2 Sparse Attention and Linear Attention

    Standard self-attention cost grows quadratically with sequence length. Sparse attention restricts each token to interact with only part of the context through local windows, strided sampling, learnable sparse patterns, or linear/state-space formulations, reducing the weights and activations actually involved in long-context scenarios.

    2.3 The Combined Effect

    MoE sparsifies “width” (the parameter dimension), while sparse attention sparsifies “length” (the sequence dimension). When combined, activated parameters are mainly determined by MoE Top-K, but actual wall-clock time is also significantly affected by the attention pattern and context length—a point that is easy to overlook in capacity planning.

    3. What Activated Parameters Actually Affect

    It is important to separate four resource categories; conflating them is a common root cause of poor selection decisions:

    1. Memory capacity: determined by total parameters. Weights must stay resident, so N_total decides “whether it fits.”
    2. Compute (FLOPs) and throughput: mainly determined by activated parameters, deciding “how fast it runs.”
    3. Memory access and bandwidth: MoE expert weights may need to be swapped in and out on demand, so real bandwidth pressure can exceed what activated parameters alone suggest.
    4. Latency stability: uneven routing can overload popular experts and cause long-tail latency jitter.

    A handy estimation formula (ignoring constant factors):

    1. compute per token ≈ C * N_act
    2. memory footprint ≈ N_total * bytes per parameter + KV Cache + runtime overhead

    Illustrative capacity calculation:

    1. def estimate(total_b, act_b, bytes_per_param=2, kv_gb=8, overhead=0.15):
    2. weights_gb = total_b * bytes_per_param # 1B params * 1 byte = 1GB
    3. base = weights_gb + kv_gb
    4. return base * (1 + overhead)
    5. print(estimate(671, 37)) # ~1342GB of weights (2 bytes/param), excluding multi-GPU sharding

    As shown: a 671B/37B model needs compute close to a 37B dense model, but its memory threshold is close to 671B. This is the essence of “small activated parameters ≠ cheap deployment.”

    4. Common Misconceptions

    • Misconception 1: Small activated parameters mean low cost. Ignoring resident weights and expert swapping severely underestimates memory and bandwidth overhead.
    • Misconception 2: Converting activated parameters directly into QPS. Real throughput is jointly affected by batching strategy, routing balance, and context length.
    • Misconception 3: p is a fixed constant. p is determined by Top-K, expert count, whether shared experts are used, and the attention pattern, and varies widely across configurations.
    • Misconception 4: Sparse is always faster. With small batches and short sequences, the extra cost of routing and gather/scatter can offset the benefits.

    5. Engineering Practice: Evaluation and Selection

    1. Read the spec first, then calculate resources. When you get a model card, record N_total, N_act, context length, and precision, and compute memory and compute separately using the formulas above.
    2. Benchmark with real traffic. Run benchmarks using the target input-length distribution and observe throughput, P95/P99 latency, and peak memory, rather than relying only on theoretical FLOPs.
    3. Watch routing balance. Monitor expert load distribution and, when necessary, introduce load-balancing loss or capacity factor constraints.
    4. Use layered caching and parallel sharding. Combine tensor/expert parallelism, KV Cache reuse, and prefix caching to reduce repeated computation.
    5. Model cost down to “per million tokens.” Factor in GPU hours, memory thresholds, and batch size together so you can make an equivalent comparison with dense models.
    1. cost per million tokens ≈ (instance hourly cost / tokens produced per hour) * 1e6
    2. tokens produced per hour ≈ throughput (tokens/s) * 3600

    6. Deployment Notes on Baidu AI Cloud

    When deploying models on Baidu AI Cloud, you can follow the same methodology: host inference services on the general container platform and shard by expert parallelism, store weights and versions in object storage, use logging and monitoring/alerting to observe throughput, latency, and expert load, and apply elastic scaling for traffic peaks and troughs. During selection, it is advisable to prepare a dense baseline model with a comparable activated-parameter count for a controlled benchmark, and compare horizontally on the same metrics (throughput, P99 latency, cost per million tokens) to avoid being misled by the single number “very small activated parameters.”

    7. Summary

    Activated parameters are the core metric of a sparse model’s “single-pass compute intensity,” calculated as N × p; they determine compute and throughput, while total parameters determine the memory threshold. Understanding the mechanics of MoE conditional computation and sparse attention, separating the four resource categories of capacity, compute, bandwidth, and latency, and making decisions with real-traffic benchmarking and a unified cost basis will let you make robust deployment and selection judgments in the wave of “large total, small activated” models.