Understanding Activated Parameters: Compute and Cost Trade-offs in Sparse Expert Models

    This article explores the critical distinction between total and activated parameters in Mixture of Experts (MoE) models. It covers how gating networks route tokens, methods for estimating activation ratios, and the practical benefits and trade-offs of sparse activation in terms of compute, memory, and deployment costs, providing engineering insights for effective model selection and deployment.

    1. Why Distinguish Between Total and Activated Parameters?

    Model parameters are typically measured in two ways. Total parameters represent the sum of all learnable weights in the model, determining the capacity ceiling and storage size. Activated parameters refer to the number of parameters actually involved in computation when processing a single input token, determining the overhead of a single forward pass.

    In dense models, these two metrics are equal. Every token passes through all weights in all layers, so computation scales proportionally with parameter count. Sparse expert models (Mixture of Experts, or MoE) break this correspondence. The model contains numerous expert subnetworks, and each token is routed to only a few of them. Thus, total parameters can be massive while activated parameters remain relatively small.

    This distinction directly impacts cost estimation. A common approximation suggests a single forward pass requires about 2 × N_active floating-point operations (FLOPs), where N_active is the number of activated parameters. Therefore, estimating compute costs based on total parameters would result in severe overestimation; using activated parameters yields a figure closer to actual compute requirements. However, VRAM and storage must still accommodate all parameters (without offloading), meaning cost estimation must consider both metrics simultaneously.

    2. How Gating Networks Select Activated Experts

    The core component of an MoE layer is the gating network (also called a router). It takes the token’s hidden vector, outputs a score for each expert, and selects the top k experts with the highest scores for computation. The standard process is as follows:

    1. Calculate scores: logits = W_g · x, where W_g has the shape [num_experts, hidden_dim].
    2. Normalize: Apply softmax to logits to get the probability for each expert.
    3. Select Top-k: Keep the k experts with the highest probabilities.
    4. Renormalize: Ensure the sum of the selected experts’ weights equals 1.
    5. Weighted sum: The output is the weighted sum of the selected experts’ outputs.

    Below is a simplified PyTorch example illustrating this process. It omits engineering details like distributed parallelism and capacity limits.

    1. import torch
    2. import torch.nn as nn
    3. import torch.nn.functional as F
    4. class TopKMoE(nn.Module):
    5. def __init__(self, d_model, d_ff, num_experts, top_k):
    6. super().__init__()
    7. self.top_k = top_k
    8. self.gate = nn.Linear(d_model, num_experts, bias=False)
    9. self.experts = nn.ModuleList([
    10. nn.Sequential(nn.Linear(d_model, d_ff), nn.GELU(), nn.Linear(d_ff, d_model))
    11. for _ in range(num_experts)
    12. ])
    13. def forward(self, x): # x: [tokens, d_model]
    14. logits = self.gate(x) # [tokens, num_experts]
    15. probs = F.softmax(logits, dim=-1)
    16. topk_p, topk_idx = probs.topk(self.top_k, dim=-1)
    17. topk_p = topk_p / topk_p.sum(dim=-1, keepdim=True)
    18. out = torch.zeros_like(x)
    19. for e, expert in enumerate(self.experts):
    20. mask = (topk_idx == e) # [tokens, top_k]
    21. rows = mask.any(dim=-1).nonzero(as_tuple=True)[0]
    22. if rows.numel() == 0:
    23. continue
    24. w = (topk_p * mask).sum(dim=-1)[rows] # Weight of this expert for these tokens
    25. out[rows] += w.unsqueeze(-1) * expert(x[rows])
    26. return out

    As shown in the code, each token only enters the forward pass of the top_k experts; the remaining experts’ parameters do not participate in this step.

    3. Estimating the Activation Ratio

    The number of activated parameters can be estimated using the following approximate formula:

    N_active ≈ N_non-expert + (top_k / total_experts) × N_expert

    Here, N_non-expert includes shared parts like attention layers, embedding layers, and the gating network, while N_expert is the sum of all expert parameters. If the model contains shared experts (experts that every token passes through), they must also be included in the activated parameters.

    The table below uses some publicly available figures to calculate activation ratios. These do not represent specific models but illustrate the order of magnitude.

    Total Parameters Activated Parameters Activation Ratio
    671B 37B ~5.5%
    320B 18B ~5.6%
    80B 3B ~3.75%

    The calculation method is dividing activated parameters by total parameters. As shown, in these examples, the activation ratio mostly falls within single-digit percentages. The industry commonly describes MoE models as having an activation ratio of around 5% to 15%, but the exact value depends on the number of experts, top_k value, and the design of shared components. When citing figures, readers should refer to official technical documentation and distinguish between “nominal values at release” and “measured values in actual deployment.”

    4. Benefits of Sparse Activation

    Reduced computation. The compute load per token is proportional to the number of activated parameters. With the same number of activated parameters, an MoE model’s inference compute requirement is close to a dense model of similar size, but its total capacity can be much larger. This means that under the same compute budget, the model can possess greater knowledge capacity.

    Improved throughput and latency potential. In compute-constrained scenarios, fewer activated parameters mean less computation time per token. Throughput improvements become more noticeable with larger batch sizes.

    Controllable training costs. During training, only the activated parts are computed. Given the same number of training tokens, the total compute overhead is lower than a model with equivalent capacity but higher activated parameters.

    5. Trade-offs of Sparse Activation

    Fewer activated parameters do not equal lower overall costs. The following trade-offs must be considered during solution design:

    VRAM and storage pressure. All expert parameters must reside in VRAM or system memory, or be loaded hierarchically to trade for space. Larger parameter counts require more devices for deployment.

    Communication overhead. When experts are distributed across multiple GPUs, each token must be sent to the device hosting the corresponding expert and retrieved after computation. This all-to-all communication can become a bottleneck, especially in clusters with low bandwidth.

    Load imbalance. If the gating network consistently favors a few experts, those experts will be overloaded while others sit idle, reducing hardware utilization and degrading model quality. A common practice is to add auxiliary load balancing losses and set a capacity factor for each expert; tokens exceeding the limit are dropped or handled alternatively.

    Low utilization with small batches. The actual number of tokens processed by each expert depends on the batch size. With small batches, the computation matrices for experts become too small, reducing hardware efficiency and making it difficult to fully realize theoretical compute savings.

    6. Engineering Selection and Deployment Practices

    1. Don’t just look at activated parameters. When selecting a model, compare total parameters, activated parameters, VRAM footprint, token throughput per unit time, and quality metrics on target tasks.
    2. Load test with real workloads. Use request lengths and concurrency levels close to production distribution to observe time-to-first-token, average throughput, and tail latency.
    3. Monitor expert load distribution. Record the proportion of tokens each expert receives. If certain experts consistently account for a high proportion, inspect the routing strategy or data distribution.
    4. Evaluate parallelism strategies. The combination of expert parallelism, tensor parallelism, and pipeline parallelism affects communication volume. Choose combinations based on cluster topology and measure the communication ratio.
    5. Combine with quantization and caching. Weight quantization can reduce VRAM footprint, but its impact on routing decisions must be validated to prevent shifts in expert selection.

    In cloud environments, these issues map to general infrastructure capabilities. For example, model weights can be stored in object storage, inference services deployed on container platforms, and expert load and latency metrics tracked via monitoring and alerting systems. Baidu AI Cloud’s general compute, storage, and monitoring services can support such deployments, with specific configurations depending on business scale and budget.

    7. Common Misconceptions

    Misconception 1: Fewer activated parameters always mean faster inference. Actual speed is also affected by communication, memory bandwidth, and batching strategies. After reducing activated parameters, bottlenecks may shift to communication or VRAM access.

    Misconception 2: Activated parameters equal model capability. Model quality primarily depends on training data, training methods, and model capacity. Activated parameters only indicate the scale of a single computation and cannot directly predict performance.

    Misconception 3: Cost depends solely on activated parameters. VRAM footprint, cluster scale, communication bandwidth, and engineering maintenance costs also impact the total cost of ownership. All these items should be included in estimates.

    8. Conclusion

    Activated parameters reflect the compute scale of sparse models per token, serving as the starting point for understanding MoE cost structures. Its value lies in separating “how large the model is” from “how heavy each computation is.” However, during actual deployment, VRAM, communication, load balancing, and batch efficiency equally determine the final experience. When selecting and deploying models, rely on measured results under real workloads, and make comprehensive judgments combining total parameters, activated parameters, and business metrics.