Understanding MoE Architecture: How Capacity and Compute Are Decoupled

    This article breaks down how Mixture of Experts (MoE) architectures separate total parameter capacity from per-token computation. It explains why a model with hundreds of billions of parameters can cost less to train than a smaller dense model, where parameters sit inside a standard Transformer block, how replacing one large FFN with multiple routed experts changes the math, and what load balancing, All-to-All communication, and training instability cost you in return. It closes with practical guidance on when MoE is the right choice and how to plan memory and compute separately.

    1. A Counterintuitive Cost Pattern

    Anyone reading a technical report on a very large model tends to ask the same question: with parameter counts in the hundreds of billions, shouldn’t training and inference costs scale up proportionally? Yet the reported training cost is often lower than that of some dense models with only a few billion parameters. This “more parameters, lower cost” contrast is not an artifact of different accounting conventions. It is a structural consequence of the architecture.

    The key term is sparse activation: the total parameter count is huge, but only a small fraction of it takes part in matrix operations for any given token. The industry refers to this family of designs as Mixture of Experts (MoE). A compact way to describe it: heavy on knowledge, light on weight. Knowledge capacity is stacked high, while the “body weight” of a single forward pass stays low.

    2. Where the Parameters Sit in a Dense Model

    To understand what MoE changes, first look at what a dense model looks like. A standard Transformer block has two main parts:

    • The attention sublayer: handles information exchange between tokens, with parameters mostly in four projection matrices;
    • The feed-forward sublayer (FFN): applies a per-token nonlinear transformation, formed by two large matrices wrapped around an activation function.

    The critical point is that the two are severely asymmetric in size. Take a common 70B-class dense model: the attention projections in a single layer hold roughly 150 million parameters, while the FFN holds more than 700 million, with the FFN accounting for about 80% of each layer’s parameters. Stack the layers, and nearly all of the model’s parameters live in the FFNs.

    The rule for a dense model is deliberately simple: every token must pass through the complete FFN of every layer. Parameter count and compute are therefore locked together — however many parameters you have is how much compute you pay per token. Capacity and activation are the same number.

    3. The First Cut: Splitting One Large FFN into N Small Ones

    The FFN is exactly the fattest target, and MoE reworks it in two steps:

    1. Replicate and split: replace the single large FFN with N structurally identical but independently parameterized small FFNs, each called an expert;
    2. Add routing: place a router in front of the experts (typically a very small linear mapping plus a softmax) that scores each token and selects only the top-k highest-scoring experts to run, leaving the rest idle.

    The forward logic looks roughly like this:

    1. def moe_ffn(x, experts, router, top_k=2):
    2. # router outputs a score per expert, shape [num_experts]
    3. scores = router(x) # x dimensions unchanged
    4. idx = scores.topk(top_k).indices # pick only top_k experts
    5. out = 0.0
    6. for i in idx:
    7. gate = scores[i].softmax() # normalized weighting coefficient
    8. out = out + gate * experts[i](x) # only these experts run matmuls
    9. return out

    The most important thing in this pseudocode is not the loop but that it loops only top_k times. Total parameters are determined by N; compute is determined by k. From here on, the two go their separate ways.

    An early representative configuration used 8 experts with 2 activated per token, for a total capacity of about 47 billion and roughly 13 billion activated per token. A more aggressive approach combines two kinds of experts: a large set of routed experts (for example 256, with 8 selected per token) plus one shared expert that always participates and does not compete, pushing total capacity to around 671 billion while keeping per-token activation near 37 billion.

    4. The Core Idea: A Formal Decoupling of Capacity and Compute

    Two clear definitions follow:

    • Total parameters = capacity: determines how much knowledge the model can hold and how smart it can be at the ceiling, and drives memory footprint and storage cost;
    • Activated parameters = compute: determines the floating-point operations actually spent per token, and drives throughput and latency.

    In a dense model the two are equal. MoE pulls them apart into a “large capacity, small activation” combination. That is the first sense in which the model is heavy on knowledge but light on weight, and it is the basis for every engineering tradeoff that follows: provision memory for capacity, estimate compute from activation.

    5. Costs and Constraints: There Is No Free Lunch

    Sparsity is not free, and it introduces three new classes of problems:

    • Load imbalance: the router may dump a large share of tokens onto a few star experts while the rest starve. Common mitigations include an auxiliary load-balancing loss, expert capacity limits with overflow dropping, and adding noise to popular experts.
    • Communication overhead: experts usually sit on different devices, so tokens must be sent to the right device, computed, and sent back, forming two All-to-All communications. In distributed deployments, communication often becomes a bottleneck earlier than compute does.
    • Training instability: routing is a discrete decision with sparse gradient signal, typically requiring more careful initialization, a smaller routing learning rate, and even finer-grained expert splitting to smooth decision boundaries.

    There are also engineering tradeoffs: expert parallelism, how many experts to place on a single card, and how to split micro-batches all change actual throughput significantly, and need to be benchmarked and tuned against the specific cluster topology.

    6. Practical Guidance: When to Choose MoE

    • When you want a higher quality ceiling at the same compute budget and memory and storage budgets are sufficient, MoE offers strong cost-performance;
    • Scenarios that are tight on memory but rich in compute are a poor fit, because idle experts still have to stay resident in memory;
    • For inference serving, estimate compute from activated parameters and memory from total parameters, and do capacity planning for the two separately;
    • If training and inference run on general capabilities such as cloud container platforms, object storage, and monitoring and alerting, treat communication topology and expert parallelism strategy as the primary tuning targets rather than agonizing over a single card model first.

    In one sentence: the point of MoE is not to make the model bigger, but to decouple “how much it knows” from “how much it computes each time” — capacity can be extravagant, compute must be frugal.