Paper notes

Mixtral of Experts: An Open MoE That Matches Llama 2 70B with 13B Active Parameters

Mixtral 8x7B keeps Mistral 7B's architecture but replaces every feed-forward layer with 8 experts and routes each token to 2: about 47B parameters in total, about 13B used per token. This post covers the architecture, the benchmark evidence, the routing analysis and which claims deserve a discount.

Published Updated 21 min read

On this page
  1. Why This Paper Matters
  2. What the Paper Contributes
  3. Method: One Change in the Architecture
  4. Experiments: Numbers First, Then the Setup
  5. Comparison with Llama 2
  6. Comparison with Llama 2 70B and GPT-3.5
  7. Multilingual
  8. Long Context
  9. Bias Benchmarks
  10. The Instruct Version and Arena
  11. Routing Analysis: Experts Are Not Divided by Domain
  12. Limitations and What to Watch For
  13. What to Take Away from This Paper
  14. Further Reading
  15. FAQ

Why This Paper Matters

Mixtral 8x7B was released in January 2024 (the first arXiv version is dated 8 January) as an open-weight sparse mixture-of-experts (SMoE) language model, with both the base and instruct versions under the Apache 2.0 license. The central claim is direct: with only 13B active parameters per token, it matches or beats Llama 2 70B, which has about five times as many active parameters, on most benchmarks, with an especially clear lead in math, code and multilingual tasks. In its conclusion the paper calls Mixtral “the first mixture-of-experts network to reach a state-of-the-art performance among open-source models”, which is the authors’ own description.

Sparse MoE is not a new idea (see Switch Transformers). What Mixtral did was turn it into an open-weight model that anyone can download, fine-tune and deploy, and by the paper’s account it reached the best level among open models at the time. Later models such as DeepSeek-V3 follow the same route with more and finer-grained experts.

First, the nature of the paper: it reads more like a model release report. With references and appendix it runs only 13 pages, most of it evaluation and analysis. It gives no training data, no number of training tokens and no compute, says nothing about how load balancing was done in training, and has no ablations. That decides how to read it: the architecture and the benchmark numbers can be checked, but “why it works” has to come from other papers and your own judgment.

What the Paper Contributes

  1. Models. Mixtral 8x7B and Mixtral 8x7B Instruct, under Apache 2.0.
  2. Architecture. It keeps the architectural changes of Mistral 7B. The paper points to two differences: full dense 32K context support, and replacing the FFN of every layer with an 8-choose-2 MoE layer.
  3. Evaluation. Comparisons with Llama 2 7B, 13B and 70B and with GPT-3.5 on commonsense reasoning, knowledge, math, code and aggregate benchmarks, plus multilingual, long-context (passkey) and bias benchmarks. The instruct version is trained with SFT plus DPO, with MT-Bench and LMSys Arena results.
  4. Routing analysis. Whether experts specialize by domain, the syntactic structure of routing, and how often neighboring tokens repeat an expert.
  5. Inference engineering. The authors submitted changes to vLLM that integrate MegaBlocks CUDA kernels, so the community can run Mixtral on a fully open-source stack.

Method: One Change in the Architecture

Mixtral’s Transformer block keeps the changes of Mistral 7B, the main difference being that the FFN sublayer becomes an MoE layer (plus support for a fully dense 32K context). Table 1 of the paper gives the whole configuration:

ParameterValue
dim (hidden size)4096
n_layers32
head_dim128
hidden_dim (width of each expert FFN)14336
n_heads / n_kv_heads32 / 8
context_len32768
vocab_size32000
num_experts / top_k_experts8 / 2

For an input xx, the output of the MoE layer is the weighted sum of the expert outputs, with weights from a gating network. Mixtral’s gate takes a softmax over the top-K logits of a linear layer:

G(x)=Softmax⁡(TopK⁡(x⋅Wg)),y=∑i=0n−1Softmax⁡(Top2⁡(x⋅Wg))i⋅SwiGLU⁡i(x)G(x)=\operatorname{Softmax}\bigl(\operatorname{TopK}(x\cdot W_g)\bigr),\qquad y=\sum_{i=0}^{n-1}\operatorname{Softmax}\bigl(\operatorname{Top2}(x\cdot W_g)\bigr)_i\cdot\operatorname{SwiGLU}_i(x)

Here TopK⁡(ℓ)i\operatorname{TopK}(\ell)_i equals ℓi\ell_i if ℓi\ell_i is among the top KK values and −∞-\infty otherwise, so the weight of an unselected expert is exactly 0 and the two selected weights sum to 1. Each expert function EiE_i is a SwiGLU, and K=2K=2. The paper says this is close to GShard, with two differences: Mixtral turns every FFN sublayer into an MoE layer, whereas GShard does it every other layer, and GShard uses a more elaborate gating strategy for the second expert.

The paper stresses that two parameter counts must be kept apart: the total (sparse) parameter count grows with the number of experts nn, and the active parameter count grows with KK. Compute it yourself from Table 1. Each expert has 3 matrices (the gate, up and down projections of SwiGLU), 3×4096×14336≈176.23\times4096\times14336\approx176.2M parameters; 8 experts over 32 layers come to about 45.1B, which is 96.6% of the total. Adding attention, routers, normalization and the two vocabulary matrices (assuming the input embedding and output layer are not tied and there are no biases) gives 46.70B in total. Each token passes through only 2 experts, so the active count is 12.88B. That agrees with the paper’s 47B and 13B. The full derivation and code are in the wiki page on Mixture of Experts.

What this means for deployment, the paper says in a restrained paragraph in Section 3: active parameters are proportional to the compute cost of inference, but that does not account for memory or hardware utilization; the memory needed to serve Mixtral is proportional to the 47B total, still smaller than Llama 2 70B, about two thirds of it; and MoE layers add overhead from routing and “more memory loads when running several experts on one device”, so they suit batched workloads that reach high arithmetic intensity. As shown below, the paper does not back any of these statements with a speed measurement.

The paper also describes two ways to make MoE layers run efficiently. On a single GPU, MegaBlocks casts the expert FFN computation as large sparse matrix multiplications, which both speeds things up and handles the unequal numbers of tokens assigned to each expert. On several GPUs, besides standard model parallelism you can use expert parallelism (EP): put the experts on different GPUs, send each token to the right GPU after routing, and send the result back. EP brings a load-balancing problem: the work must be split evenly across cards so that no single card is overloaded.

Experiments: Numbers First, Then the Setup

Comparison with Llama 2

The paper puts Mixtral and the Llama family in one table, and every benchmark is re-run with the Mistral team’s own evaluation pipeline (Llama 2 34B was not released, so that comparison uses Llama 1 33B, which is omitted here). The settings: commonsense reasoning is 0-shot, NaturalQuestions and TriviaQA are 5-shot, MMLU is 5-shot, HumanEval is 0-shot, MBPP is 3-shot, MATH is 4-shot with maj@4, and GSM8K is 8-shot with maj@8. An excerpt of Table 2 follows (accuracy in %; the last column is the difference computed for this post):

BenchmarkLlama 2 13BLlama 2 70BMistral 7BMixtral 8x7BGap to 70B
Active params13B70B7B13Babout 1/5
MMLU55.669.962.570.6+0.7
HellaSwag80.785.481.084.4−1.0
WinoGrande72.980.474.277.2−3.2
PIQA80.882.682.283.6+1.0
ARC-Easy75.279.980.583.1+3.2
ARC-Challenge48.856.554.959.7+3.2
NaturalQuestions16.725.423.230.6+5.2
TriviaQA64.073.062.571.5−1.5
HumanEval18.929.326.240.2+10.9
MBPP35.449.850.260.7+10.9
MATH6.013.812.728.4+14.6
GSM8K34.369.650.074.4+4.8

A few points on reading this table:

  • It is not a clean sweep. Mixtral is above Llama 2 70B on 9 of 12 benchmarks and lower on HellaSwag, WinoGrande and TriviaQA, by 3.2 points on WinoGrande. “Outperforms or matches” in the abstract should be read with “matches” meaning “within a point or two”.
  • The lead is concentrated in math and code. MATH is 14.6 points higher, HumanEval and MBPP 10.9 points each, and the rest are mostly a few points. MMLU is only 0.7 points higher, though Mixtral has only about a fifth of the active parameters.
  • For reading comprehension, look at the figure. The caption of Figure 3 admits that on reading-comprehension benchmarks (BoolQ, QuAC) Mixtral does not beat Llama 2 70B; those two are not in Table 2.
  • GSM8K and MATH are majority-vote scores. The two columns in Table 2 are maj@8 and maj@4, which are usually higher than single-sample scores. For the difference between majority voting (Maj@K) and Pass@K see the glossary; for how Pass@K is estimated see Evaluation Statistics; the DeepSeekMath explainer has a concrete case where the two behave differently in the same experiment.
  • The evaluation pipeline differs from the Llama 2 paper. The paper names two differences: MBPP uses a manually verified subset, and TriviaQA is run without Wikipedia contexts.
  • The gain cannot all be credited to MoE. Mistral 7B in the table is a dense model with the same architecture, and Mixtral beats it by 24.4 points on GSM8K, 15.7 on MATH, 14.0 on HumanEval, 10.5 on MBPP and 8.1 on MMLU. But the paper says Mixtral greatly increases the share of multilingual data compared with Mistral 7B, says nothing about other data differences, and trains no dense model on the same data as a control, so how much of the gain comes from the architecture and how much from the data cannot be separated from the paper.

Comparison with Llama 2 70B and GPT-3.5

Table 3 uses a different set of settings to put Mixtral next to Llama 2 70B and GPT-3.5 (the MT-Bench row is the instruct version):

Benchmark (setting)Llama 2 70BGPT-3.5Mixtral 8x7B
MMLU69.9%70.0%70.6%
HellaSwag (10-shot)87.1%85.5%86.7%
ARC Challenge (25-shot)85.1%85.2%85.8%
WinoGrande (5-shot)83.2%81.6%81.2%
MBPP (pass@1)49.8%52.2%60.7%
GSM-8K (5-shot)53.6%57.1%58.4%
MT-Bench (instruct version)6.868.328.30

Mixtral is highest on four of the seven (MMLU, ARC Challenge, MBPP, GSM-8K); Llama 2 70B is highest on HellaSwag and WinoGrande, and GPT-3.5 is highest on MT-Bench (8.32 vs 8.30). The GPT-3.5 MT-Bench figure uses gpt-3.5-turbo-1106, the latest at the time. The paper does not say whether the other GPT-3.5 rows were evaluated by the authors or taken from published results.

Tables 2 and 3 use different settings for the same benchmark, and the numbers are far apart. This is what to be most wary of when reading the paper:

BenchmarkTable 2 (Llama 2 70B / Mixtral)Table 3 (Llama 2 70B / Mixtral)
ARC-Challenge0-shot: 56.5% / 59.7%25-shot: 85.1% / 85.8%
HellaSwag0-shot: 85.4% / 84.4%10-shot: 87.1% / 86.7%
WinoGrande0-shot: 80.4% / 77.2%5-shot: 83.2% / 81.2%
GSM8K8-shot, maj@8: 69.6% / 74.4%5-shot: 53.6% / 58.4%
MMLU, MBPP5-shot, 3-shot: 69.9 / 70.6, 49.8 / 60.7the same numbers

For the same model on the same benchmark, Llama 2 70B’s ARC-Challenge differs by 28.6 points between the two tables and Mixtral’s by 26.1; on GSM8K both differ by 16.0. The paper states each setting but does not explain where the difference comes from; the prompt format and the number of few-shot examples both change results a lot. The lesson is plain: numbers are comparable only within one setting, neither across tables nor directly against numbers from other papers. MMLU and MBPP, whose numbers are identical in both tables, presumably come from the same evaluation run.

Multilingual

The paper says that, compared with Mistral 7B, the pretraining data has a much larger share of multilingual data, and the extra capacity lets Mixtral keep its English accuracy while doing well in other languages. An excerpt of Table 4 (accuracy in %; each cell is Llama 2 70B / Mixtral):

LanguageARC-ChallengeHellaSwagMMLU
French49.9 / 58.272.5 / 77.464.3 / 70.9
German47.3 / 54.368.7 / 73.064.2 / 71.5
Spanish50.5 / 55.474.5 / 77.666.0 / 72.5
Italian49.4 / 52.870.9 / 75.165.1 / 70.9

Mixtral is higher in all 12 cells, by 5.8 to 7.3 points on MMLU, against only 0.7 points on English MMLU. That suggests the multilingual advantage comes from a combination of data mix and extra capacity, which again cannot be separated.

Long Context

Mixtral is trained with a 32K context. The paper evaluates it with the passkey retrieval task (a passkey is inserted at a random place in a long prompt and the model must retrieve it) and reports 100% retrieval accuracy regardless of context length and passkey position; perplexity on a subset of proof-pile also decreases monotonically as the context grows (Figure 4; the text gives no numbers). These two pieces of evidence are of the same kind as in the YaRN explainer. They show that the model has not lost its ability to retrieve over long distances, which is not the same as being able to reason over a long text; for the effect of position, see the Lost in the Middle explainer.

Bias Benchmarks

The paper compares Llama 2 70B and Mixtral on BBQ (a question-answering bias benchmark) and BOLD (a bias benchmark for open-ended generation): BBQ accuracy is 51.5% against 56.0% (higher means less bias). For BOLD, sentiment scores (mean ± standard deviation) are reported for five groups, and the paper concludes that Mixtral’s average sentiment is more positive with similar variance across groups. Going through the table: Mixtral has the higher mean on 3 items (gender, profession, political ideology), ties on 1 (race) and is lower on 1 (religious ideology); only 2 items have a lower standard deviation (gender, religious ideology), and the other 3 are slightly higher. That does not fully match the caption of Figure 5, “lower standard deviation on BOLD”, so it is safer to go with the text’s “similar variance”.

There is one more inconsistency: the introduction says Mixtral Instruct shows less bias on BBQ and BOLD, while Section 3.3 states that these two were measured on the base model.

The Instruct Version and Arena

Mixtral 8x7B Instruct is first fine-tuned on an instruction dataset (SFT), then trained with DPO on a paired-feedback dataset; the paper describes neither dataset. It scores 8.30 on MT-Bench, which the paper calls the best open-weight model as of December 2023, and an independent human evaluation (LMSys Arena) shows it ahead of GPT-3.5-Turbo, Gemini Pro, Claude-2.1 and Llama 2 70B Chat. MT-Bench is scored by a judge model; for judge bias see LLM-as-a-Judge.

“Ahead” depends on how large the gap is. In the screenshot of Figure 6 (22 December 2023), Mixtral Instruct has an Arena Elo of 1121. Converting the gaps into pairwise win rates:

def win_prob(delta):  # win rate of the higher-rated side at an Elo gap of delta
    return 1 / (1 + 10 ** (-delta / 400))


mixtral = 1121  # paper Figure 6: LMSys leaderboard screenshot, 22 Dec 2023
others = {"Claude-2.1": 1117, "GPT-3.5-Turbo": 1117,
          "Gemini Pro": 1111, "Llama-2-70b-chat": 1077}
for name, elo in others.items():
    delta = mixtral - elo
    print(f"{name:<17s} gap {delta:>2d} points, win rate {win_prob(delta):.1%}")

Output:

Claude-2.1        gap  4 points, win rate 50.6%
GPT-3.5-Turbo     gap  4 points, win rate 50.6%
Gemini Pro        gap 10 points, win rate 51.4%
Llama-2-70b-chat  gap 44 points, win rate 56.3%

For Claude-2.1 and GPT-3.5-Turbo, a 4-point gap means only a 50.6% win rate, and since the paper gives no confidence intervals this can only be read as “roughly level”; for Gemini Pro it is 51.4%, also close to level. Only against Llama-2-70b-chat is the lead clear. The same screenshot also contains higher-rated models (for example Claude-2.0 at 1131), and the paper’s wording is “the best open-weight model”, not the best model.

Routing Analysis: Experts Are Not Divided by Domain

In Section 5 the paper inspects the router’s choices: on different subsets of The Pile validation set, it counts the distribution of experts selected at layers 0, 15 and 31. The result surprised the authors: there is no obvious pattern by topic. ArXiv (papers written in LaTeX), PubMed abstracts and philosophy papers have very similar distributions, and only DM Mathematics differs a little, which the paper attributes to its synthetic nature and limited coverage of natural language, most visibly in the first and last layers.

What routing does show is syntactic structure: self in Python and “Question” in English often go to the same expert, even when they span several tokens; indentation tokens in code are always sent to the same experts, especially in the first and last layers. The paper also finds that neighboring tokens often choose the same expert, and Table 5 reports the share of cases where “token ii and the next token pick the same expert”. The table below is the average over the eight datasets of Table 5, computed for this post (the range from minimum to maximum is in parentheses):

Same first choiceFirst or second choice shared
Random routing (baseline)12.5%46.4%
Layer 014.1% (13.6 to 14.9)48.0% (44.9 to 49.9)
Layer 1526.4% (23.6 to 28.4)63.7% (61.6 to 67.0)
Layer 3122.7% (19.7 to 26.3)50.9% (44.5 to 53.6)

The random baselines in the paper are 1/81/8 and 1−68⋅571-\frac68\cdot\frac57. The code below computes each by exact counting and by simulation, which shows why the second baseline is 46.4% and not 25%:

import random
from itertools import combinations

E, K, N = 8, 2, 200_000  # 8 experts, 2 per token, N simulated token pairs
sets = list(combinations(range(E), K))  # the 28 possible top-2 sets
disjoint = sum(not set(a) & set(b) for a in sets for b in sets)
print(f"exact      same first choice {1 / E:.1%}, "
      f"top-2 sets share an expert {1 - disjoint / len(sets) ** 2:.1%}")

rng = random.Random(0)
prev = rng.sample(range(E), K)  # each token picks 2 experts uniformly at random
first = share = 0
for _ in range(N):
    cur = rng.sample(range(E), K)
    first += cur[0] == prev[0]
    share += bool(set(cur) & set(prev))
    prev = cur
print(f"simulated  same first choice {first / N:.1%}, "
      f"top-2 sets share an expert {share / N:.1%}")

Output:

exact      same first choice 12.5%, top-2 sets share an expert 46.4%
simulated  same first choice 12.5%, top-2 sets share an expert 46.4%

The second column counts whether the top-2 sets of two neighboring tokens share at least one expert. Given the previous token’s top-2, 15 of the 28 possible top-2 sets for the next token have no overlap with it at all (you must choose 2 from the remaining 6 experts), so the probability of no shared expert under random routing is 15/2815/28 and the probability of a shared one is 1−15/28≈46.4%1-15/28\approx46.4\%. Reading the table against this:

  • Layer 0 is close to random. A same-first-choice share of 14.1% is barely above the 12.5% baseline, and the paper also notes that repetition in the first layer is near random.
  • Middle-layer repetition is clearly above random. At layer 15 the same-first-choice share is about 2.1 times the random one, and the second column is about 17 percentage points above the baseline.
  • At layer 31 the second column is only about 4.5 points above the baseline. The average is 50.9%, and DM Mathematics, at 44.5%, is even slightly below 46.4%. The paper says repetition at layers 15 and 31 is “significantly higher than random”, which holds for the first column, but for the second column of layer 31 it is only slightly higher.
  • The paper does not explain why. It only notes that this temporal locality cuts both ways for systems: with expert parallelism it makes it easier for some experts to be oversubscribed; conversely, the locality can be exploited for expert caching, as in Eliseev and Mazur’s MoE offloading.

Limitations and What to Watch For

  • The paper says nothing about training. The pretraining data and mixture (it says only that multilingual data is larger than for Mistral 7B), the number of training tokens, the compute, and how load balancing was done in training (whether there is an auxiliary loss) are all missing, and there are no ablations: you do not know how 8 experts and top-2 were chosen, and you cannot see how the number of experts or KK relates to quality.
  • Attribution of the gains is unclear. The gap to Mistral 7B and to Llama 2 70B mixes three kinds of causes: architecture, data mix (multilingual) and training recipe.
  • The abstract and the tables do not quite agree. The abstract says “outperforms or matches across all evaluated benchmarks”, yet Table 2 has three benchmarks 1.0 to 3.2 points behind, the Figure 3 caption admits reading comprehension is not beaten, and Arena’s “outperforms” is a gap of a few points.
  • The evaluation settings are not uniform. Tables 2 and 3 differ by a dozen to nearly thirty points on the same benchmark; GSM8K and MATH use majority voting; the Llama 2 70B numbers are the paper’s own re-runs; the source of the GPT-3.5 column is not stated.
  • Speed was not measured. “Faster at small batch, higher throughput at large batch” is only a qualitative statement in the introduction; the paper has no latency or throughput numbers.
  • A typo. Section 3 writes “47B tokens versus 70B”; from the context it should be 47B parameters.
  • Timeliness. The Arena ranking and “the best open-weight model” are snapshots from December 2023, not the current state.

What to Take Away from This Paper

  1. MoE keeps two sets of books. Total parameters decide memory, active parameters decide the compute per token; Mixtral’s 46.70B and 12.88B are a standard example.
  2. The architecture change is small and the gate is simple. Only the FFN becomes 8-choose-2, and the gate is a softmax after top-2, so the two weights sum to 1 and the weight of an unselected expert is exactly 0.
  3. Numbers are comparable only within one setting. When reading, look at the shot count, whether majority voting is used, the evaluation pipeline and who ran the evaluation; turn every “outperforms” in a comparison table into a gap in points.
  4. Experts are not divided by domain. Routing is more syntactic, and neighboring tokens tend to choose the same experts, which cuts in opposite directions for expert parallelism and expert caching.
  5. This is a model release report, not a methods paper. Training data, compute, balancing and ablations are absent; to understand “why it works”, read the wiki page on MoE and later MoE papers.

Further Reading

FAQ

Does the name Mixtral 8x7B mean it has 8×7B = 56B parameters?
No. 8x7B means 8 experts built on the Mistral 7B architecture, but only the feed-forward network (FFN) of each layer is copied 8 times; attention, embeddings and normalization are shared. Using the configuration in Table 1 of the paper, the total comes to about 46.70B parameters (the paper says 47B), 96.6% of them in the experts. Each token passes through only 2 experts, so about 12.88B parameters are active (the paper says 13B). Memory has to hold all 46.70B parameters, roughly 93.4 GB at 2 bytes each, while the compute per token is that of a dense model of about 13B.
Does Mixtral really beat Llama 2 70B on every benchmark?
The abstract says "outperforms or matches". On the 12 benchmarks of Table 2, Mixtral is higher on 9 and slightly lower on HellaSwag (84.4 vs 85.4), WinoGrande (77.2 vs 80.4) and TriviaQA (71.5 vs 73.0). The largest leads are on MATH (14.6 points), HumanEval and MBPP (10.9 points each). The caption of Figure 3 also admits that it does not beat Llama 2 70B on reading comprehension. These numbers come from the authors' own re-run of the evaluation pipeline, and GSM8K and MATH use majority voting (maj@8, maj@4), so they cannot be compared directly with single-sample scores elsewhere.
Are Mixtral's experts specialized by domain?
The paper's routing analysis says no. On different subsets of The Pile, the expert distributions at layers 0, 15 and 31 show no obvious topical pattern; ArXiv, PubMed abstracts and philosophy papers look almost the same, and only the synthetic DM Mathematics differs a little. Routing looks more syntactic. The token self and indentation in Python, or Question in English, often go to the same expert, and neighboring tokens often pick the same expert too. Averaged over the eight datasets of Table 5, the share of neighboring tokens with the same first-choice expert at layer 15 is 26.4%, against 12.5% for random routing.
Is Mixtral's inference always faster than a dense model of the same quality?
Not necessarily; it depends on the workload. The introduction says inference is faster at small batch sizes and throughput is higher at large batch sizes, but the paper contains no speed or throughput measurement. Section 3 itself notes that compute scales with the active parameters while memory scales with all 47B parameters, and that MoE layers add routing and multi-expert memory-access overhead, so they suit batched workloads that reach high arithmetic intensity.
Mixtral 8x7B Instruct scores higher than GPT-3.5 on Arena. What does that mean?
Figure 6 of the paper is a screenshot of the LMSys Arena from 22 December 2023. Mixtral 8x7B Instruct v0.1 scored 1121, the best versions of Claude-2.1 and GPT-3.5-Turbo both 1117, Gemini Pro 1111 and Llama-2-70b-chat 1077. By the definition of Elo, a 4-point gap corresponds to a pairwise win rate of about 50.6%, and 44 points to about 56.3%. With no confidence intervals reported, the first three can only be called roughly level; the one clear lead is over Llama-2-70b-chat. On MT-Bench, Mixtral Instruct scores 8.30 and GPT-3.5-Turbo-1106 scores 8.32, which is again level.