esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Is a Mixture-of-Experts Model?

How a router picks a few experts for each token, why the model is cheap to run but heavy to store, and the trade-offs, explained for your AI interview.

In short

A Mixture-of-Experts (MoE) model splits the feed-forward part of a layer into several expert sub-networks and sends each token to only a few of them. The whole model is large to store, but each token only pays for the experts it uses, so it runs cheaper than a normal (dense) model of the same size.

12 min readIntermediateCommon · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

A Mixture-of-Experts model is split into many expert sub-networks. For each token, a small router picks two of the eight experts in each Mixtral layer and mixes their answers. The other six do no work for that token, so each token is cheaper to process. But every expert still has to sit in memory, so the model is heavy to serve. And the experts are not neat topic specialists. For a team, I'd treat it as more capacity for the work per token, with a bigger memory bill.

What is a Mixture-of-Experts model, in plain words?

A language model breaks your text into tokens, small pieces such as words or parts of words, and works through them layer by layer. In a dense model, every weight in a layer works on every token. A Mixture-of-Experts model, or MoE, splits the feed-forward block of a layer (the weights that transform each token) into many expert sub-networks, and sends each token to only a few of them.

Think of a hospital triage desk. A triage nurse does not send every patient to every specialist. A chest pain case goes to cardiology and a broken wrist to orthopaedics, and only those two teams spend time on it. An MoE model does the same for each token: a router sends it to two of eight experts in a layer, and the other six do no work for that token.

Key words

Expert
One of several smaller sub-networks inside a layer, each with its own weights.
Router
A small learned part that scores the experts for each token and picks the top few.
Token
A small piece of text, such as a word or part of a word, that the model works on.
Active parameters
The weights that actually run for one token. In an MoE model, that is far fewer than the total.
Dense model
A model where every weight works on every token.

How does a Mixture-of-Experts layer work?

In a transformer, each layer has a block of feed-forward weights that transforms every token. An MoE layer swaps that one block for many smaller blocks, called experts, with a router in front. The Mixtral paper says each of its layers holds eight feed-forward blocks, which it calls experts.

One token through one Mixture-of-Experts layer

One token

a piece of the input text

Router

scores all 8 experts

Experts (8 in this layer)

Expert 2

picked, weight 0.6

Expert 5

picked, weight 0.4

Experts 1, 3, 4, 6, 7, 8

idle: no work for this token

Mixed output

goes on to the next layer

  1. 1The token reaches the router first.
  2. 2Top choice: Expert 2, the highest score, with weight 0.6.
  3. 3Second choice: Expert 5, with weight 0.4. The other six stay idle.
  4. 4Expert 2's answer joins the mix at 60%.
  5. 5Expert 5's answer joins the mix at 40%.
One token through one MoE layer, with made-up router weights. Only the two picked experts do work for this token. Their outputs are mixed by weight, and the result moves on.
  1. 1

    Score

    The router gives every expert a score for this token.

  2. 2

    Pick

    It keeps the top two. Mixtral's router picks two of its eight experts for each token.

  3. 3

    Mix

    The two chosen experts process the token, and their answers are blended by weight.

  4. 4

    Move on

    The blended result goes to the next layer, and the cycle repeats.

Mistral says the router is trained with the experts: "we train experts and routers simultaneously".

  • “A trainable gating network determines a sparse combination of these experts to use for each example.”

    Shazeer and colleagues, 2017

  • “For every token, at each layer, a router network selects two experts to process the current state and combine their outputs.”

    Mixtral paper, 2024

What does it save, and what does it cost?

The Switch Transformer paper starts from the usual setup: "In deep learning, models typically reuse the same parameters for all inputs." MoE breaks that habit by selecting different parameters for each incoming example.

  • Saves

    Less work per token

    Only the picked experts run, so the work per token stays low even when the total size grows.

  • Costs

    Memory for every expert

    Every expert must be stored and served, so the memory bill follows the full size, not the active part.

  • Costs

    Routing adds overhead

    The router and the sending of tokens to experts add work that a dense model does not have.

Dense model against Mixture-of-Experts, per token

Dense model

All weights run per token

every weight works on every token

Mixture of Experts

2 of 8 experts run

the router picks the two

Bill grows with size

every token pays for the whole model

Less work per token

memory still holds every expert

  1. 1A dense model pushes each token through all of its weights.
  2. 2A Mixture-of-Experts model pushes it through only the picked experts.
A dense model runs every weight for each token, so its work per token grows with its size. A Mixture-of-Experts model runs only the picked experts, so its work per token stays low. Both still store the full model.

The Switch Transformer paper says that "widespread adoption has been hindered by complexity, communication costs and training instability", and it sets out simpler routing to help.

  • “the SMoEs layer introduces additional overhead due to the routing mechanism and due to the increased memory loads when running more than one expert per device”

    Mixtral paper, 2024

What do the numbers look like for a real model?

The Mixtral paper, submitted in January 2024, describes Mixtral, a Sparse Mixture of Experts (SMoE) language model. Each layer has eight experts, and a router sends each token to two of them. The model has 47B parameters in total, but only 13B are active for each token.

Take a made-up hospital that runs such a model itself, to summarise discharge notes. Each token costs roughly the work of its 13B active parameters, but the server must hold all 47B weights in memory. So the GPU is sized for the full model, while much of the per-token work follows the active part.

Here is a tiny router with made-up scores. It picks two of eight experts for each of four tokens, then counts the runs.

Python
import math
EXPERTS = 8
TOP_K = 2
# Made-up router scores: one per expert, for four tokens of a claims note.
SCORES = {
    "water": [0.1, 2.3, 0.2, 0.4, 1.9, 0.0, 0.3, 0.5],
    "damage": [1.8, 0.2, 0.1, 2.5, 0.3, 0.4, 0.2, 0.1],
    "invoice": [0.2, 0.1, 2.0, 0.3, 0.2, 2.2, 0.4, 0.6],
    "approved": [0.3, 0.4, 0.2, 0.1, 0.5, 0.2, 2.4, 1.1],
}
def softmax(scores):
    top = max(scores)
    exps = [math.exp(s - top) for s in scores]
    total = sum(exps)
    return [e / total for e in exps]
def route(token):
    probs = softmax(SCORES[token])
    picks = sorted(range(EXPERTS), key=lambda i: probs[i], reverse=True)[:TOP_K]
    total = sum(probs[i] for i in picks)
    return [(i + 1, round(probs[i] / total, 2)) for i in picks]
runs = 0
for token in SCORES:
    picks = route(token)
    runs += len(picks)
    print(token, "->", picks)
print("expert runs:", runs, "of", EXPERTS * len(SCORES), "possible")

Output

water -> [(2, 0.6), (5, 0.4)]
damage -> [(4, 0.67), (1, 0.33)]
invoice -> [(6, 0.55), (3, 0.45)]
approved -> [(7, 0.79), (8, 0.21)]
expert runs: 8 of 32 possible

The demo runs 8 expert slots out of 32 possible. That is a quarter of the expert work. The other six experts sit idle for each token, but they still take up memory.

Are the experts topic specialists?

Many beginners say each expert handles one subject, such as maths or code. The Mixtral paper tested text from different domains, and it found that "Surprisingly, we do not observe obvious patterns in the assignment of experts based on the topic."

The paper adds that the choice of experts "appears to be more aligned with the syntax rather than the domain". The selected experts "can be different at each timestep". So the router learns its own split, which is not a tidy set of subject experts.

Tip

Asked about specialists? Say the router learns its own split, and that it can change from token to token. Don't promise one expert per subject.

How would you choose between a dense and an MoE model for a bank?

I would start with the real traffic: how many questions per minute, how long the answers run, and how much GPU memory we own. An MoE model can be cheaper per token, but only if all of its weights fit on the hardware we have.

Then I would test both on our own policy questions, not on public benchmarks, and measure latency, because routing adds overhead. If the dense model fits and is fast enough, I would pick the simpler one.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: many expert sub-networks, and a router that picks a few per token.
  • Why it is cheaper per token: only the picked experts run.
  • The cost: every expert must sit in memory, and routing adds overhead.
  • Experts are not tidy topic specialists.
  • When it fits: more capacity for the work per token, if you can serve the memory.
  • Honest about limits: measure on your own traffic before choosing.

Common traps

  • Trap"Each expert is a specialist in one subject."

    BetterNot in any tidy way. The Mixtral paper found no obvious pattern by topic; the expert choice seems tied to syntax more than subject.

  • Trap"An MoE model is smaller, so it is cheaper to host."

    BetterIt is cheaper per token. Storage is the cost: all the experts must fit in memory.

  • Trap"Every expert runs for every token."

    BetterOnly the picked experts run. The rest sit idle for that token, but they still take up memory.

Can you spot the wrong statement?

Spot the wrong statement

A team plans a self-hosted MoE model with eight experts per layer and two active per token. Which statement is wrong?

Quick check

An insurance claims triage agent runs an MoE model with 8 experts per layer and 2 picked per token. Which statement is true?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q025Open-weight vs closed API models: trade-offs?13 min
  2. Q027What is a reasoning ("thinking") model?11 min
  3. Q028What is test-time compute?11 min
  4. Q030Why are input and output tokens priced differently?11 min
  5. Q036When is a small language model enough?11 min

Last updated on 26 November 2026

Choosing a model for a product that must run at scale?

I design and build AI products and agents, including the system behind them. Book a short call and tell me what the model must do, and what each answer may cost to serve.