Marek Dvořák 8 min readA conventional transformer applies the same feed-forward network to every token at a given layer. A mixture-of-experts model changes that arrangement: it keeps several feed-forward networks, called experts, and uses a learned router to select only a small subset for each token.
This distinction creates an unusual bargain. The model can contain far more parameters than it activates during any one forward pass. Capacity grows without a proportional increase in arithmetic per token. Yet the unused parameters are not free. They must still be stored, distributed, trained, and reached across hardware. Mixture-of-experts architecture therefore moves part of the difficulty from matrix multiplication into routing and systems design.
The Architectural Substitution
Most transformer blocks contain attention followed by a feed-forward network. Attention mixes information among tokens; the feed-forward network transforms each token independently. In a dense model, every token passes through the same feed-forward weights.
An MoE layer substitutes a collection of expert feed-forward networks. Before entering them, each token representation is scored by a router. If the layer has four experts, the router might produce scores for all four but send the token only to the highest-scoring one or two. Their outputs are weighted and returned to the token's original position.
The experts are not necessarily interpretable professions. One should not assume that one becomes a mathematics expert while another becomes a translator. Specialization can emerge around syntax, token frequency, language, domain, position, or features that resist simple labels. The architecture requires differentiated computation, not human-readable departments.
| Component | Dense transformer layer | MoE transformer layer |
|---|---|---|
| Feed-forward paths | One shared path | Several expert paths |
| Active paths per token | The single available path | A selected subset |
| Selection mechanism | None | Learned router |
| Primary systems burden | Dense computation | Routing, communication, and balancing |
| Total versus active parameters | Closely aligned | Potentially far apart |
What the Router Actually Does
For each token vector, the router computes a score for every expert, commonly through a learned linear projection followed by a normalization or selection operation. A top-k rule then retains the strongest candidates. With top-1 routing, one expert processes the token. With top-2 routing, two do, and their outputs are combined according to routing weights.
Consider the fragment the bank approved the loan. At one MoE layer, the token bank may be sent to experts 2 and 7. At a later layer, its transformed representation may be routed elsewhere because it now encodes contextual information about lending rather than merely the surface word. Routing is dynamic at the token and layer level; it is not a permanent assignment of words to modules.
The top-k decision is discrete, which complicates training. Gradients flow naturally through the selected experts and routing weights, but not through every rejected routing choice in the same manner. Implementations use differentiable scores, auxiliary objectives, and carefully chosen routing rules so that the system can learn useful assignments without requiring every expert to run.
Why Experts Tend to Collapse Without Intervention
If one expert becomes slightly better early in training, the router may send it more tokens. That expert then receives more gradient updates, improves faster, and becomes still more attractive. The feedback loop can leave other experts poorly trained while the popular expert becomes overloaded.
MoE training therefore adds balancing mechanisms. An auxiliary loss can penalize a mismatch between how often experts are selected and how much routing probability they receive. Some designs also modify router scores or impose capacity constraints. The goal is not necessarily perfect equality; it is to prevent a small set of experts from monopolizing traffic.
Balancing introduces its own trade-off. A router optimized only for model quality might concentrate tokens where they are handled best. A router optimized too aggressively for equal utilization may send tokens to weaker matches. Training must reconcile semantic preference with operational feasibility.
- Router loss: encourages traffic to spread across experts.
- Capacity limit: defines how many tokens an expert can accept in a batch.
- Overflow policy: determines whether excess tokens are dropped, rerouted, or handled through another path.
- Router regularization: discourages unstable or excessively confident assignments.
The Hidden Cost Is Communication
Experts are often distributed across accelerators because their weights do not fit efficiently on one device. After routing, tokens must travel to the devices holding their selected experts. Once processed, the outputs must return to their original sequence positions. This all-to-all exchange can become the defining operation of an MoE layer.
A simple example reveals the tension. Suppose a batch begins on several devices, and the router assigns tokens by content rather than location. Tokens from every device may need experts hosted on every other device. The arithmetic inside each expert can be efficient, yet accelerators may wait for network transfers or for one heavily loaded expert to finish.
Batch composition now affects performance in a way that model-level parameter counts conceal. Two batches with the same number of tokens can produce different expert distributions. One routes evenly and runs smoothly; the other concentrates traffic and creates a straggler. Serving infrastructure must account for both average work and routing variance.
Capacity, Overflow, and the Fate of a Token
Each expert is usually assigned finite capacity for a routing group or batch. Capacity prevents a popular expert from receiving an unbounded queue, but it forces a decision when too many tokens select the same destination.
One option is to drop the overflowing expert computation, allowing the token to continue through a residual path. Another is to send the token to its next-choice expert. A third is to provision extra capacity, reducing overflow at the cost of underused compute and memory. None is universally superior.
Imagine an expert with room for 100 routed tokens receiving 120. Dropping 20 preserves a fixed computation schedule but may damage quality, especially if those tokens systematically belong to a rare domain. Rerouting preserves computation for each token but may send the overflow to an unsuitable expert and increase coordination. Reserving room for 120 avoids this incident but leaves idle capacity whenever demand is lower.
This is one reason sparse models cannot be understood through theoretical floating-point operations alone. The useful metric is closer to delivered quality under realistic routing, memory, batching, and network constraints.
What Sparsity Buys—and What It Does Not
The central advantage is conditional capacity. More expert parameters can store additional transformations while only a subset runs for each token. During training, this can improve the amount of learned capacity available for a given active-compute budget. During inference, it can offer stronger model behavior without activating the entire parameter set on every step.
But sparse activation does not mean proportionally cheap deployment. All expert weights must be available somewhere, so memory requirements remain tied to total parameters. Moving weights from slower storage on demand is generally too costly for token-by-token generation, making resident or carefully sharded experts important. Network topology matters. Small batches may fail to provide enough tokens for efficient expert matrix operations. Quantization can reduce weight memory, but it does not remove routing communication.
MoE also does not automatically produce modular control. Removing an expert may affect many unrelated behaviors. Fine-tuning one expert may alter routing dynamics or create incompatibilities with representations produced elsewhere. The experts participate in a jointly trained system, not a set of independent plug-ins.
Failure Modes That Reach the Product
Some MoE failures remain infrastructure concerns; others can become user-visible. Routing instability can make behavior more sensitive to small changes in phrasing. Underrepresented token types may be handled by experts that receive fewer useful updates. Capacity overflow can correlate with particular languages or domains if their tokens cluster on the same experts.
Operationally, an expert-hosting device failure removes more than generic compute: it may remove a particular learned path. Replication can improve resilience but consumes memory. Expert parallelism can raise throughput at scale while worsening latency when communication is slow or batches are small.
Evaluation should therefore go beyond aggregate answer quality. Teams need to inspect expert utilization, overflow rates, per-domain routing, latency distributions, and the effect of losing or throttling an expert. A model can appear healthy at the benchmark level while carrying a fragile routing pattern underneath.
The Open Questions Beneath the Architecture
The most consequential research question is what should be sparse. Current designs often replace feed-forward sublayers because they contain many parameters and process tokens independently. Future systems may route attention, memory access, tools, modalities, or entire computational blocks. Each extension makes the router more like a learned scheduler.
Another question is whether routing should remain token-local. A token-level router may miss the fact that a document, conversation, or task benefits from consistent expert allocation. Sequence-level routing could improve locality and reduce communication, but it may sacrifice fine-grained specialization. Hierarchical routing could first choose a device group, then an expert, aligning model decisions with hardware topology.
Interpretability remains unresolved. If experts develop stable specializations, they could become useful units for auditing and adaptation. If their roles are distributed, overlapping, and sensitive to training conditions, human labels may mislead. Better diagnostic methods must distinguish genuine functional structure from patterns that merely look coherent in sampled data.
The deeper shift is not simply that a model can be larger than the computation it uses. It is that computation itself becomes conditional. Once a learned system decides which internal resources deserve each token, model architecture and infrastructure scheduling become the same design problem. The opportunity lies there—and so do the limits.
This post was drafted with AI assistance and reviewed against our editorial policy before publication. Corrections are made at the source, on the page, with the date shown.
From our own rounds
Measured on The Curator, from real sessions people played on this site — not a third-party dataset.
- Rounds played here
- 159
- Questions per round
- 1.7
Rate this article
Discussion
Comments are moderated. Read our editorial policy.