Skip to content

Mixtral of Experts (and the Mixture-of-Experts Architecture)

Authors: Albert Jiang, Alexandre Sablayrolles, et al. (Mistral AI) Published: January 8, 2024 Paper: arxiv.org/abs/2401.04088


Why This Matters

Mixtral 8x7B democratized Mixture-of-Experts and proved sparse models are the future:

  • 🚀 47B params, 13B active - Massive capacity at fraction of inference cost
  • 🏆 Matches LLaMA 2 70B - With 5x fewer active parameters
  • 6x faster inference - Only activates 2 of 8 experts per token
  • 🔓 Fully open source - Apache 2.0 license
  • 🏗️ Architecture of the future - DeepSeek-V3, Qwen3, Llama 4 all adopted MoE

Real-world impact: - Made MoE the dominant architecture for frontier models - Proved you don't need dense models for top performance - Inspired DeepSeek-V3 (256 experts), Llama 4 (128 experts), and others - European AI competitor emerged as a serious player

The insight: You don't need every parameter for every token. Different tokens need different knowledge - let specialized experts handle them.


What is Mixture-of-Experts?

The Core Idea

Dense model (traditional):

Every input → ALL parameters activated → Output
Cost: proportional to total parameters

Mixture-of-Experts (MoE):

Every input → Router selects TOP-K experts → Only those experts activate → Output
Cost: proportional to active parameters (much less!)

Analogy: Instead of one person who knows everything (expensive), have a team of specialists and a receptionist who routes you to the right one.

Historical Context

MoE is not new: - 1991: Jacobs et al. - Original MoE concept - 2017: Shazeer et al. - "Outrageously Large Neural Networks" (first MoE at scale, Google) - 2022: Switch Transformer (Google) - Simplified routing to single expert - 2024: Mixtral - Made MoE practical and open-source

What Mixtral changed: Previous MoE models were research projects. Mixtral was the first MoE that was open-source, production-ready, and competitive with the best dense models.


How Mixtral Works

Architecture

Standard Transformer layer:
  Attention → FFN (Feed-Forward Network)

Mixtral layer:
  Attention → Router → [Expert 1, Expert 2, ..., Expert 8]
                         ↑ only 2 selected per token

Key numbers: | Component | Value | |-----------|-------| | Total parameters | 46.7B | | Active parameters per token | 12.9B | | Number of experts | 8 | | Experts activated per token | 2 (top-2 routing) | | Layers | 32 | | Hidden dimension | 4096 | | Attention heads | 32 | | Context window | 32K tokens |

The Router

For each token at each layer:

# Simplified router
def route_token(token_hidden_state):
    # Linear layer produces score for each expert
    scores = router_linear(token_hidden_state)  # [8 scores]

    # Select top-2 experts
    top2_indices = top_k(scores, k=2)
    top2_weights = softmax(scores[top2_indices])

    # Combine expert outputs
    output = 0
    for idx, weight in zip(top2_indices, top2_weights):
        output += weight * experts[idx](token_hidden_state)

    return output

Key insight: Different tokens route to different experts at each layer. A math token might activate experts 2 and 5, while a poetry token activates experts 1 and 7.

Expert Specialization

What do experts learn?

Analysis shows experts develop loose specializations:

Expert 1: Tends to handle syntax/structure
Expert 3: Tends to handle math/reasoning
Expert 5: Tends to handle code
Expert 7: Tends to handle multilingual content

BUT: No hard boundaries - experts share knowledge
AND: Specialization varies by layer

Important: Experts are NOT perfectly specialized domains. They develop soft preferences through training.


Performance

vs Dense Models

MMLU (Knowledge/Reasoning):

Model Active Params MMLU
LLaMA 2 13B 13B 55.4%
LLaMA 2 70B 70B 69.8%
Mixtral 8x7B 13B 70.6%

Mixtral matches LLaMA 2 70B with 5x fewer active parameters!

Math (GSM8K):

Model Score
LLaMA 2 70B 56.8%
Mixtral 8x7B 74.4%
GPT-3.5 57.1%

Coding (HumanEval):

Model Pass@1
LLaMA 2 70B 29.9%
Mixtral 8x7B 40.2%
CodeLlama 34B 48.8%

Inference Speed

Mixtral 8x7B: ~85 tokens/second
LLaMA 2 70B: ~22 tokens/second (at same quality)

3.9x faster at equivalent quality!

Why faster: - Only 13B params active per token (vs 70B) - Less computation per forward pass - Same memory for weights, but less compute

Mixtral 8x7B Instruct

Fine-tuned for chat/instruction following: - Beat GPT-3.5 Turbo on most benchmarks - Competitive with Claude 2.1 - Best open-source chat model at time of release


Why MoE Became Dominant

The Scaling Insight

Dense scaling:

Want 2x better? → Need ~10x more compute
All parameters used for every token
Extremely wasteful

MoE scaling:

Want 2x better? → Add more experts (less compute per token)
Only fraction of parameters used per token
Much more efficient scaling

Every Frontier Model Adopted MoE

Model Year Total Params Active Params Experts
Mixtral 8x7B 2024 47B 13B 8
Mixtral 8x22B 2024 176B 39B 8
DeepSeek-V3 2024 671B 37B 256
Qwen3 2025 Various Various MoE variants
Llama 4 Scout 2025 109B 17B 16
Llama 4 Maverick 2025 400B+ 17B 128

The trend: More experts, finer-grained routing, better specialization.

MoE Trade-offs

Advantages:

+ Much more capacity per FLOP
+ Faster inference (fewer active params)
+ Better scaling properties
+ Can add experts without increasing inference cost

Disadvantages:

- Higher total memory (all expert weights in memory)
- Load balancing challenges (some experts overused)
- Communication overhead in distributed training
- More complex to deploy than dense models


Technical Details

Load Balancing

The collapse problem:

Without balance: Router sends all tokens to 1-2 experts
Other experts never train → wasted parameters

Solution - auxiliary load balancing loss:

# Encourage even distribution across experts
balance_loss = num_experts * sum(
    fraction_tokens_to_expert_i * average_router_prob_for_expert_i
    for i in range(num_experts)
)

total_loss = language_model_loss + alpha * balance_loss

Sliding Window Attention

Mixtral uses sliding window attention (from Mistral 7B):

Standard attention: Every token attends to ALL previous tokens
Sliding window: Each token attends to last W tokens (W=4096)

But with 32 layers:
Effective context = W * num_layers = 4096 * 32 = 131,072 tokens
Information flows through layers to cover full context

Training

Training data: - Multilingual web data - Open datasets - Undisclosed total size

Training infrastructure: - Trained on NVIDIA GPUs - Custom distributed training for MoE - Expert parallelism across GPUs


Evolution: From Mixtral to Modern MoE

Mixtral 8x22B (April 2024)

Scaled up version: | Aspect | 8x7B | 8x22B | |--------|------|-------| | Total params | 47B | 176B | | Active params | 13B | 39B | | Experts | 8 | 8 | | Context | 32K | 64K | | MMLU | 70.6% | 77.8% |

DeepSeek's MoE Innovations

DeepSeek-V3 took MoE further:

256 experts (vs Mixtral's 8)
Top-8 routing (vs top-2)
Shared experts (always active)
Auxiliary-loss-free balancing
671B total, 37B active

Llama 4's Approach

Meta adopted MoE for Llama 4:

Scout: 16 experts, top-1 routing + shared expert
Maverick: 128 experts, top-1 routing + shared expert
Alternating dense and MoE layers


Practical Usage

Running Mixtral

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1"

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype=torch.float16,
    device_map="auto"
)

messages = [
    {"role": "user", "content": "Explain mixture of experts in simple terms"}
]

inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=500)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Using via API

from mistralai.client import MistralClient
from mistralai.models.chat_completion import ChatMessage

client = MistralClient(api_key="your-key")

response = client.chat(
    model="open-mixtral-8x7b",
    messages=[ChatMessage(role="user", content="Hello!")]
)

print(response.choices[0].message.content)

Key Takeaways

  1. MoE is the future - Every major model after Mixtral adopted the architecture
  2. Sparse > Dense - 47B total with 13B active matches 70B dense
  3. Efficiency breakthrough - 4-6x faster inference at equivalent quality
  4. Open source matters - Mixtral proved open MoE was viable
  5. Expert routing is key - Top-K selection determines which knowledge to apply

Bottom line: Mixtral didn't invent MoE, but it made it practical, open, and competitive. The architecture it popularized now powers every frontier model - DeepSeek-V3, Llama 4, Qwen3, and more. Understanding MoE is essential for understanding modern AI.


Further Reading

Original Papers

  • Mixtral 8x7B: https://arxiv.org/abs/2401.04088
  • Mixtral 8x22B: https://mistral.ai/news/mixtral-8x22b
  • Outrageously Large Neural Networks (original MoE): https://arxiv.org/abs/1701.06538
  • Switch Transformer: https://arxiv.org/abs/2101.03961

Model Downloads

  • Mixtral 8x7B: https://huggingface.co/mistralai/Mixtral-8x7B-v0.1
  • Mixtral 8x7B Instruct: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1
  • DeepSeek-V3 (256-expert MoE): https://arxiv.org/abs/2412.19437
  • Llama 4 (MoE with shared experts): https://ai.meta.com/blog/llama-4-multimodal-intelligence/

Published: January 8, 2024 Impact: 🔥🔥🔥🔥🔥 CRITICAL - Made MoE the dominant architecture Citations: 1,500+ (as of early 2026) Adoption: Universal - every frontier model now uses MoE Current Relevance: Mixtral itself is superseded, but the architecture it popularized is everywhere Legacy: Proved sparse models beat dense models, changed how the industry builds LLMs

Modern Status (March 2026): Mixtral 8x7B is no longer the state of the art, but MoE has become the standard architecture. DeepSeek-V3 (256 experts), Llama 4 (128 experts), and others all build on the foundation Mixtral established for the open-source community.