Why MoE Routes at the Token Level Instead of the Sentence Level

    This article explains why Mixture of Experts (MoE) models route at the token level rather than assigning an entire sentence to one expert. It covers the combinatorial capacity gained from token-level routing, how sentence-level routing degrades sparse models into dense ones through load imbalance, three common training failures (expert collapse, gradient explosion, and inference memory and communication overhead) with practical fixes, how low-precision training complements sparse routing, and a short checklist for building your own MoE setup.

    1. Where the Question Starts: A “Compute-Saving” Idea That Looks Reasonable

    Almost everyone who first encounters the Mixture of Experts (MoE) architecture asks the same question: since every token requires its own routing decision and its own expert dispatch, why not just hand the whole sentence to a single expert? Intuitively, sentence-level routing needs only one decision, has lower communication overhead, and is simpler to implement, so it looks “more efficient.”

    The flaw in this idea is that it mistakes the number of routing calls for the total cost of the system. In reality, MoE’s compute savings come from sparse activation of a large parameter pool, not from fewer routing decisions. Routing itself accounts for a very small share of the overall forward and backward pass. What actually sets the model’s capability ceiling is the combinatorial space that routing creates. Giving up token-level routing means deliberately compressing the model’s expressive power by several orders of magnitude.

    2. The Combinatorial Space: The Jump in Expressiveness from Token-Level Routing

    Take a sparse configuration common in the industry: 256 routed experts plus 1 shared expert, with each token activating 8 of the routed experts, and a sequence length of 2048.

    • Sentence-level routing: the whole sequence shares one expert set, giving C(256, 8) possible combinations, on the order of 10^14.
    • Token-level routing: each position chooses independently, giving a theoretical C(256, 8)^2048 combinations, a magnitude far beyond the total number of atoms in the universe (about 10^80).

    No engineering optimization can close this gap. Sentence-level routing means the same expert subset must handle all the semantics of an entire passage, forcing the model to compress heterogeneous tasks such as syntactic parsing, coreference resolution, domain terminology, code structure, and numerical reasoning into one set of parameters, with no functional differentiation between experts. Token-level routing lets different positions activate different experts, so the model spontaneously forms a structure that divides labor by semantic role: function words, entities, punctuation, and code symbols can take different paths.

    Note that the combination counts above are theoretical upper bounds; in real training the routing distribution is far from uniform, but these numbers still accurately capture the capacity difference between the two designs.

    3. Load Balancing: Sentence-Level Routing Degrades a Sparse Architecture into a Dense One

    Whether a sparse expert model actually saves compute depends on whether expert load is balanced.

    The failure mode of sentence-level routing is straightforward: routing decisions are made from the sentence start or a sentence-level representation, so within a batch a large number of sentences crowd onto the few experts that look “generally useful.” The result is that a few experts are overloaded while most are barely activated. At that point the system has only two options: keep all expert parameters and wait, in which case memory and communication costs do not drop; or prune the unpopular experts, in which case the model degenerates into a small dense model and the benefit of sparsification disappears entirely.

    Token-level routing, combined with an auxiliary load balancing loss and a capacity factor, can flatten the distribution. A schematic form of the auxiliary loss is:

    1. # f_i: fraction of tokens assigned to expert i
    2. # p_i: average routing probability of expert i
    3. # N: total number of experts
    4. aux_loss = N * sum(f_i * p_i for i in range(N))

    This term reaches its minimum when the distribution is perfectly uniform, which suppresses routing collapse.

    4. Training Stability: Three Frequent Failures and Their Fixes

    Pitfall 1: Expert Collapse

    A few experts swallow the vast majority of tokens while the rest receive no gradient updates for a long time. Beyond the auxiliary loss, common practices include adding a learnable temperature or noise term to the routing scores to preserve exploration; setting a capacity limit and dropping overflow tokens (token dropping) so they pass through the residual connection; and introducing a shared expert to carry general knowledge, leaving the routed experts for differentiating patterns.

    Pitfall 2: Gradient Explosion

    Routing weights are a continuous relaxation of a discrete choice. Once the gating logits drift, the distribution after softmax becomes extreme and gradients start to oscillate. Workable measures include normalizing the gating output or applying a z-loss to constrain the magnitude of the logits; using a smaller learning rate for the gate; keeping higher routing noise early in training and annealing it later; and combining gradient clipping with a suitable initialization scale.

    Pitfall 3: Inference Memory and Communication Growth

    The total expert parameter count is huge. Even if a single token activates only a few experts, all parameters must either stay resident or be swapped in on demand. Engineering practice typically relies on expert parallelism to split different experts across devices, together with tensor and pipeline parallelism; hierarchical loading and caching for unpopular experts; and on the inference side, grouping tokens that hit the same expert within a batch into regular batched matrix multiplications, avoiding the per-token small-operator launch overhead.

    5. Another Layer of Gains in Precision and Efficiency

    Low-precision mixed training (such as FP8-style schemes) complements MoE because the two save different resources: sparse routing reduces the number of multiply-adds per token, while low precision reduces the cost per unit of compute and memory bandwidth. Note that numerically sensitive parts such as routing and normalization usually keep higher precision, and only the matrix multiplications inside experts use low precision. This “mixed” strategy is a general engineering consensus rather than a feature specific to one scheme.

    6. If You Want to Build Your Own MoE

    1. First get a dense baseline running and confirm the data and training loop are correct;
    2. Default to token-level routing granularity, and do not sacrifice capacity to save a little communication cost;
    3. Start with a small number of experts (such as 8 to 16) and Top-2 routing, then scale up once it is stable;
    4. Monitor three metrics: expert load entropy, fraction of dropped tokens, and variance of the gating logits;
    5. Invest engineering effort first in expert parallelism and communication overlap, not in reducing routing granularity.

    7. Conclusion

    Token-level routing is not an implementation detail; it is the source of MoE capability. Sentence-level routing looks efficient but actually loses combinatorial expressiveness, load balance, and the benefit of sparsification all at once, ultimately compressing a sparse model back into a dense one. To deploy a sparse expert architecture in your own business, you can run distributed training on a container platform, manage checkpoints and datasets with object storage, and use logging and monitoring with alerting to continuously observe load and stability metrics. These general capabilities are enough to support an operable MoE training and inference pipeline.