MoE LLM Architecture Explained: Total Parameters vs. Active Parameters

    This guide explains the three metrics in a large language model spec sheet: total parameters, active parameters per token, and context window. It covers how each one affects deployment, compute cost, and memory, using a KV cache example. It closes with practical steps for evaluating and selecting a model.

    1. Clarifying Three Key Metrics

    Large numbers on a model spec sheet can lead to wrong conclusions about cost. A model usually lists three metrics at once: total parameters, active parameters per token, and context window. Each answers a different question, so comparing them without distinguishing them leads to errors.

    Total parameters refer to the full set of learnable weights in the model. This includes the experts in each layer, attention projections, token embeddings, the router, and normalization modules. This number determines how large the weight files are, how much GPU or system memory is needed to load them, and how the model is split across multiple cards during deployment.

    Active parameters refer to the parameters that actually take part in the forward pass for a single token. In an MoE (Mixture of Experts) architecture, the router selects only a few experts for each token, and the rest do not run. As a result, active parameters are usually much smaller than total parameters.

    The context window is the maximum number of tokens the model can process at once. This number only sets the input limit. The real cost comes from attention computation and the KV cache, which Section 4 explains in detail.

    2. Total Parameters: Capacity and Deployment Threshold

    Suppose a model has 1T (1,000B) total parameters stored in bf16 format, where each parameter takes 2 bytes. The weights alone need about 2 TB of space. This does not include the KV cache, activations, or runtime overhead.

    Total parameters mainly affect the following:

    • Weight loading time and storage footprint;
    • The number of accelerator cards needed to hold the full weights;
    • The communication pattern when experts are distributed across multiple cards;
    • The range of available quantization options.

    A larger total parameter count usually means more experts and greater knowledge capacity. However, total parameters are first a deployment concern. They do not translate directly into inference compute.

    3. Active Parameters: Compute Budget per Token

    In a Transformer-based model, the forward pass costs roughly two multiply-add operations per active parameter per token. With 32B active parameters, each token requires about 64 GFLOPs. This is a common order of magnitude for estimating per-step compute.

    MoE routing typically works as follows:

    1. def route_tokens(hidden, router_weight, top_k=8):
    2. # hidden: [batch, dim]; router_weight: [dim, num_experts]
    3. logits = hidden @ router_weight
    4. probs = softmax(logits, dim=-1)
    5. weights, expert_ids = topk(probs, k=top_k, dim=-1)
    6. weights = weights / weights.sum(dim=-1, keepdim=True)
    7. return expert_ids, weights

    Take a layer with 256 experts, where each token selects 8. Each token then activates only 8/256 of the expert parameters. However, active parameters also include components that always run, such as attention layers, shared experts, and embeddings. So the total active count must be summed module by module, not estimated by ratio alone.

    Active parameters do not equal latency. Actual latency also depends on the following:

    • Cross-card communication overhead in expert parallelism;
    • Whether tokens are evenly distributed across experts;
    • Batch size and the number of concurrent requests;
    • KV cache read and write bandwidth;
    • Quantization precision and the kernel implementation in the inference framework.

    Two models with the same number of active parameters can show very different latency under different serving setups.

    4. Context Window: Attention and Cache Are the Main Costs

    As context gets longer, attention-related costs grow faster. Standard full attention compute scales with the square of the sequence length. The KV cache, which stores historical tokens during inference, grows linearly with length.

    The KV cache size can be estimated with this formula:

    KV cache bytes = 2 × number of layers × number of KV heads × head dimension × sequence length × bytes per element

    For example, consider a model with 60 layers, 8 KV heads, and a head dimension of 128, storing data in bf16 at a sequence length of 128K. Substituting these values gives 2 × 60 × 8 × 128 × 128,000 × 2 ≈ 31.5 GB. A single request at 128K length needs about 31 GB of cache. When several long requests run at the same time, GPU memory often runs out before compute does.

    Common approaches in the industry include:

    • Sparse attention: each token attends to only part of the history;
    • Sliding window: local layers attend only to nearby tokens, with a few global layers preserving long-range information;
    • Cache compression: reducing the storage dimension of KV, or projecting it into a lower-dimensional latent space;
    • Hybrid architectures: alternating linear attention layers with full attention layers to lower overall cost;
    • Cache quantization and offloading: moving less frequently accessed data to system memory or to lower-precision storage.

    Each approach has trade-offs. Sparse attention may miss key information, compressed cache may lose some retrieval accuracy, and hybrid architectures place greater demands on the training recipe. When choosing among them, consider how much the task depends on long context, and verify results with real data. Do not rely on the window size alone.

    5. Putting the Three Metrics Together

    Metric Main Impact Main Cost
    Total parameters Model capacity, weight size Memory footprint, loading time, distributed communication
    Active parameters Compute per token Routing load balance, communication between experts
    Context window Maximum input length Attention compute, KV cache memory

    When reading a parameter table, start by asking three questions. First, can the weights fit on the target hardware? Second, can the compute per token meet the throughput target? Third, at the average and maximum input lengths of the target workload, can the cache support the required number of concurrent requests?

    6. Selection and Evaluation Recommendations

    1. Define the workload profile. Short chat, long-document Q&A, and code generation differ greatly in input and output length and in concurrency patterns, so test each one separately.
    2. Measure instead of estimating. Use a realistic request distribution to measure time to first token, output tokens per second, and peak memory usage.
    3. Check quality after quantization. Quantization reduces memory usage, but you need to re-evaluate quality on your target tasks.
    4. Verify tool calling and long-context capabilities separately. These abilities depend on training data and post-training processes, which spec sheets usually do not show, so validate them with representative examples.
    5. Keep a fallback option. If a model behaves unreliably in a critical scenario, be ready to switch to a model of a different size or architecture.