A neural network does not have to use every parameter for every input. A mixture-of-experts (MoE) layer takes advantage of this idea by keeping several expert networks and using a router to select only a small subset for each token.

This creates an important distinction: a model can have a large total parameter count while activating far fewer parameters for one token. That can increase model capacity without making the arithmetic performed for every token grow in direct proportion to the total number of expert parameters.

The idea is useful, but it is easy to oversimplify. MoE does not mean that inference becomes cheap merely because experts are sparse. The experts still need storage, routing introduces new behavior, and distributed deployments must move tokens to the devices that hold the selected experts.

This article builds a practical mental model for how MoE works and where its trade-offs come from.

Start with a dense feed-forward layer

Transformer blocks commonly contain attention followed by a feed-forward network. In a dense model, every token passing through a particular feed-forward layer uses the same network:

token representation
       |
       v
feed-forward network
       |
       v
updated representation

If the layer contains a given set of parameters, all tokens use that set. Different tokens produce different activations, but the computation follows the same parameterized path.

An MoE layer replaces that single feed-forward path with several alternatives:

                 +-> expert 1 -+
token -> router -+-> expert 2 -+-> combine -> output
                 +-> expert 3 -+
                 +-> expert 4 -+

The router does not normally send every token through every expert. It scores the experts and selects a small number, often described as top-k routing.

If there are eight experts and k = 2, a token may use experts 2 and 7 while another token uses experts 1 and 4.

That conditional selection is the core idea behind sparse MoE computation.

Separate total parameters from active parameters

Parameter counts can be misleading when comparing dense and MoE models.

Imagine a simplified layer with eight experts, each containing 1 billion parameters. The expert portion contains 8 billion parameters in total. If the router selects two experts for each token, however, only 2 billion expert parameters participate in that token’s expert computation.

The simplified distinction is:

total expert parameters:   8 x 1B = 8B
active expert parameters:  2 x 1B = 2B per token

This does not mean the whole model performs exactly the same work as a 2-billion-parameter dense model. A real architecture also has shared components such as attention layers, embeddings, normalization, routing, and other parameters. Implementation details also affect actual latency and throughput.

The useful lesson is narrower: total model capacity and per-token expert computation are different quantities in an MoE model.

When reading model specifications, ask whether a parameter count describes all stored parameters or the subset active during a forward pass.

The router chooses where each token goes

The router receives a token representation and produces scores for the available experts. A simplified view is:

router(token) -> [0.05, 0.62, 0.08, 0.25]

With top-2 routing, experts 2 and 4 would be selected in this example.

The selected experts independently transform the token representation. Their outputs are then combined, commonly using weights derived from routing scores.

Conceptually:

output = w2 * expert2(token) + w4 * expert4(token)

The exact routing and weighting rules depend on the architecture. The important point is that routing happens per token, not necessarily once for an entire prompt.

A sentence can therefore send different tokens to different experts. It is usually too strong to say that one expert permanently represents a human-readable subject such as mathematics or programming. Experts can develop useful specialization, but routing behavior emerges from training and does not guarantee neat semantic labels.

Sparse activation creates capacity without proportional computation

Why add many experts instead of making one dense feed-forward network much larger?

Suppose a dense layer doubles in size. Every token now passes through that larger layer, so its feed-forward computation also grows substantially.

With sparse experts, additional parameters can be added while keeping the number of selected experts per token fixed. If an architecture grows from 8 experts to 32 experts while still routing each token to 2, the pool of available parameters becomes larger without requiring each token to execute all 32 experts.

This is the attraction of conditional computation:

more available capacity
        does not require
all available capacity to run for every token

But sparse arithmetic is only one part of system cost. The model still has to store expert weights, and hardware must deliver the selected weights and activations efficiently. A theoretically sparse computation can perform poorly if routing creates communication or memory bottlenecks.

Training needs balanced expert usage

A router trained only to choose whatever expert currently looks best can develop an unhealthy feedback loop.

Imagine one expert receives slightly more useful assignments early in training. The router sends it more tokens, so it receives more training signal. That can make the router prefer it even more strongly while other experts remain underused.

The result can look like this:

expert 1: ####################
expert 2: ##
expert 3: #
expert 4: ##

This is undesirable for two reasons. First, unused experts waste capacity. Second, an overloaded expert can become a processing bottleneck.

MoE training therefore commonly includes mechanisms intended to encourage healthier routing, such as auxiliary load-balancing objectives or routing constraints. The precise mechanism varies between architectures.

The goal is not necessarily to force every expert to receive exactly the same number of tokens. It is to prevent pathological routing where a small subset absorbs too much traffic and the remaining capacity contributes little.

Expert capacity makes overload a concrete problem

Training and inference systems often process many tokens together. If too many tokens choose the same expert, that expert may receive more work than the system has allocated for it in the current batch.

Consider 1,000 token assignments across four experts. A perfectly even distribution would produce 250 assignments per expert. Routing might instead produce:

expert 1: 520
expert 2: 210
expert 3: 170
expert 4: 100

The first expert now needs much more compute and buffer space than the fourth.

Some MoE designs define an expert capacity that limits how many token assignments an expert handles for a batch. What happens beyond that limit is architecture-dependent: implementations may drop assignments, redirect them, use different routing schemes, or provision extra capacity.

This is why load balancing is more than a statistical preference. Routing determines real resource usage.

Distributed inference adds a communication problem

A large MoE model may not fit all experts on one accelerator. Experts can be distributed across devices, a strategy often called expert parallelism.

Suppose a token begins on GPU 1 but its router selects an expert stored on GPU 4. The system must move the relevant activation to GPU 4, execute the expert, and make the result available for the rest of the model.

At scale, many tokens are routed simultaneously:

GPU 1 tokens --+
GPU 2 tokens --+-> route by expert -> GPUs holding experts
GPU 3 tokens --+                     |
                                      +-> return expert outputs

This communication can be a major part of MoE performance. Fast matrix multiplication alone is not enough; routing needs to keep devices busy without overwhelming interconnects or leaving some devices idle.

As a result, an MoE model with fewer active parameters per token is not guaranteed to have lower latency than a dense model. Hardware topology, batch size, expert placement, memory bandwidth, communication, and implementation quality all matter.

Memory savings do not follow from sparse activation

Another common misunderstanding is to equate fewer active parameters with proportionally lower model memory.

If inference may route tokens to any expert, the system needs access to all of those expert weights. Even when a particular token uses only two experts, the remaining experts do not cease to exist.

A simple mental model is:

compute per token -> depends strongly on selected experts
weight storage     -> depends on parameters that must remain available

Distribution, quantization, offloading, and caching strategies can change where and how weights are stored, but sparse routing by itself does not eliminate the storage requirement.

This distinction matters when deciding whether an MoE model fits a deployment environment. Active parameter count is not a substitute for checking actual memory requirements.

Routing can affect reproducibility and debugging

Dense networks already have complex internal behavior, but MoE introduces an additional decision worth observing: which experts receive which tokens.

When diagnosing quality or performance, useful signals can include:

  • the distribution of token assignments across experts;
  • how frequently each expert is selected;
  • whether particular experts are consistently overloaded;
  • routing confidence or score distributions where available;
  • latency associated with routing and expert communication.

These metrics should be interpreted carefully. Seeing that an expert receives many tokens does not by itself explain what semantic function it learned.

For application developers using a hosted model, these internals may not be exposed at all. In that case, MoE architecture is primarily relevant for understanding why total parameter count alone does not predict latency, cost, memory, or output quality.

MoE does not automatically make a model better

Mixture-of-experts is an architectural technique, not a quality guarantee.

A model’s usefulness still depends on factors such as training data, optimization, architecture, training budget, inference configuration, and how well it matches the task. A smaller dense model can outperform a larger MoE model for a particular workload, and the reverse can also be true.

Avoid reasoning like this:

more total parameters -> automatically better answers

or:

fewer active parameters -> automatically faster inference

Both skip the conditions that determine real behavior.

For developers selecting a model, task-specific evaluation remains more useful than architecture labels. Measure the quality, latency, throughput, memory requirements, and cost that matter for the actual application.

When MoE is a useful design

MoE is attractive when a model builder wants to increase parameter capacity while limiting how much expert computation each token activates. It becomes especially interesting at scales where distributing expert parameters across substantial accelerator infrastructure is practical.

The trade-off is additional system complexity. Routing must be learned, expert utilization must remain healthy, and distributed execution may require significant communication.

For smaller models or deployments where simplicity and predictable hardware behavior matter more than expanding sparse capacity, a dense architecture can be easier to train, serve, and reason about.

The right comparison is therefore not simply sparse versus dense. It is whether the additional capacity enabled by conditional computation is worth the routing, memory, and communication costs for the target workload.

Conclusion

A mixture-of-experts layer replaces one always-active network with a pool of experts and a router that selects a small subset for each token. This separates how many parameters the model contains from how many expert parameters a token activates.

That separation can provide substantial capacity without proportional per-token expert computation, but it does not remove the need to store expert weights or move activations between devices. Balanced routing, expert capacity, memory, and communication are central parts of the design.

When evaluating an MoE model, look beyond its total parameter count. Ask how many experts are active, how routing is handled, what memory the deployment requires, and how the architecture performs on the workload you actually need to serve.