Most top open models share one design. Hugging Face wrote the handbook for training it
18 of the 20 best open models use a mixture of experts. Hugging Face published a free handbook that walks through training one, with 55 interactive figures and the real runs behind every setting. We cover the key lessons and how to try them.
Almost every powerful open model you can download today is built on the same idea. On Artificial Analysis's open-weights ranking, 18 of the 20 highest-scoring models use the mixture-of-experts (MoE) architecture. DeepSeek V4.1 Flash, GLM-5.3, MiMo-V2.6-Pro, Ling 3.1 Flash and MiniMax-M3.1-Flash are among them; the two exceptions in the top 20 are Nanbeige4.3-33B at 12th and Qwen3.8 27B at 13th. The practical know-how for training such a model, though, has long stayed inside a few large teams. To close that gap, Hugging Face published a free handbook on November 5: The Ultimate MoE Training Handbook.
It was written by Nouamane Tazi, Leandro von Werra and Thomas Wolf. The text comes with 55 interactive figures; the authors suggest setting aside a day or two and not reading it on a phone. It follows the Smol Training Playbook, which the company wrote while training its dense model SmolLM3. That book covered MoE in a single section; the new one picks up where it stopped and explains every setting together with the training runs that back it.
What an MoE does
Picture a large hospital. A triage nurse at the door sends each patient to just 8 of 64 specialists. Many specialists work there, but only a few see any one patient. MoE models work the same way: a small layer called the router sends each token to a few experts, so the model can hold far more parameters than it uses. The small model trained in the handbook has 6.86 billion parameters, but only 1.22 billion of them run for each token.
According to the authors, the hard part is turning that saving into faster training. Moving from a dense model to an MoE adds three new jobs: a router that picks which experts each token goes to, keeping the load balanced across experts, and, once experts are spread over different GPUs, an exchange of tokens between GPUs in every MoE layer. That exchange is called all-to-all communication, and most of the book revolves around these three topics.
Testing the hardware before the first run
The book starts by testing the GPUs. The authors used AWS P5 nodes with eight H100 GPUs each. One key lesson: a healthy all-reduce result says nothing about the all-to-all speed an MoE needs. In one two-node run, all-reduce reached 398.52 GB/s while all-to-all managed only 39.84 GB/s. The healthy two-node baseline was 77.14 GB/s, falling to 39.25 GB/s on four nodes and 30.91 GB/s on eight. The book recommends a separate baseline for every node count and not starting training on a cluster that falls below 90 percent of it.
Two models are then trained with the same data and the same launch script. The first is a 1.22-billion-parameter dense model. The second is the first MoE, with 64 experts and 8 chosen per token. The 8 chosen experts together are exactly the size of the dense model's feed-forward layer, so both models do the same compute per token. The authors also run a sanity check: an MoE with one expert and top-1 routing computes the same function as the dense model. Started from the dense checkpoint, it stayed within 0.00087 of the dense run over 15 steps. Along the way they found two bugs in Megatron-LM's upcycling code and share the fixes in the book.
Key lessons from the book
Always compute the router in full precision. The router gives each expert a score. Stored in a low-precision format such as bf16, two very close scores can round to the same value and change which expert wins. In the book's simulation, z-loss, a penalty that limits logit size, did not reduce these flips; only fp32 produced none. That is why the firmest advice in the book's flag list is --moe-router-dtype fp32.
Load balance sets the speed. The authors ran the same model with three kinds of routing. With routing forced to be even, the model ran 1.5 times faster at the start, at 149.4 TFLOP/s. A freshly initialized learned router was as slow as the worst forced case for its first 40 iterations. With the standard auxiliary loss (coefficient 1e-3) it climbed to 125 TFLOP/s by the end of 120 iterations. The trap the book warns about: when the router's probabilities are flat, the balancing loss can look perfect while the load is still uneven. Balance should be read from the real token counts, using MaxVio, which shows how far the busiest expert sits above the mean.
Balancing methods do not all behave the same. The loss-free bias method used by DeepSeek works well at small scale, but in another study it hurt language quality above 128 experts. In the book's own five-way comparison, quantile balancing was the fastest at 139 TFLOP/s, yet it also ended with the highest training loss. The authors note that speed alone does not mean better training. If you want experts to specialize by domain, balance has to be computed over the whole global batch, which adds 5.8 percent to step time.
Smaller experts help, up to a point. With total and active parameters held fixed, splitting experts into more, smaller ones lowered loss from 2.334 to 2.297; beyond 128 experts there was no further gain. The "latent MoE" approach, which compresses each token to a smaller size before sending it to the experts, raised MMLU-Pro by 4.6 points in NVIDIA's 73-billion-parameter test. The benefit of a shared expert that sees every token varies from study to study.
Where the time goes. When the authors traced one training step on a single node, half of it went to exposed all-to-all communication; with routing forced even under the same settings, the step ran 40 percent faster. When the NCCL communication library silently fell back from the fast network to plain TCP sockets between nodes, training ran about 25 times slower: 1.7 TFLOP/s instead of 42. The book teaches you to stop when the log says "Using network Socket". An overlap setting that hides one micro-batch's communication behind another's compute raised throughput by up to 35 percent on two nodes.
Silent failures. Some MoE failures never show in the loss curve. An expert can die by receiving no tokens, or its output can grow out of control. In the Step 3.5 Flash case the book cites, one expert's output norm went from about 14 to about 5,700 times the layer median while the training loss showed nothing. The authors say that before each NaN in their own runs, every signal they were watching stayed flat, and the one they traced was born in the backward pass of the grouped expert computation. The debugging index at the end maps 42 symptoms, tagged "slow", "OOM", "blows up", "learns badly" and "won't start", to the section that explains them.
From training to serving
Chapter four covers what happens after training. Serving fewer experts than were trained saves compute, but quality drops fast if the weights of the remaining experts are not adjusted. On Qwen3.6-35B-A3B, choosing 4 experts instead of 8 and dividing by the probability mass of the top 16 cost only 0.35 points of MMLU. With no adjustment at all, serving 6 experts cost 27.45 points. Storing experts in 4 bits also pays off: gpt-oss-20b shrinks from 39 GiB to 12.8 GiB. In reinforcement learning, the generation engine and the training code can pick different experts for the same token; in one measurement cited in the book, 94 percent of tokens went to a different expert in at least one layer. The book shows how to measure that gap and compares the fixes.
How to try it
Most of the book's experiments need eight-GPU nodes. The authors say so plainly and suggest that readers with one GPU or none read chapter three end to end; it needs nothing to run. The data preparation example runs on CPUs on a single machine, and the monitoring scripts can be tested without a GPU first. For eight-GPU access the book points to Hugging Face Jobs; according to the handbook, as of November 2026 a machine with eight H200s costs $40 an hour, billed by the minute. The check command and the router settings of the first MoE look like this:
# Can Hugging Face Jobs see 8 GPUs? (the handbook's check command)
hf jobs run --flavor h200x8 --timeout 10m pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel \
python -c "import torch; print(torch.cuda.device_count())"
# Router settings of the first MoE run (Megatron-LM)
--num-experts 64 --moe-ffn-hidden-size 1024 --moe-router-topk 8 \
--moe-token-dispatcher-type alltoall --moe-grouped-gemm \
--moe-router-load-balancing-type aux_loss --moe-aux-loss-coeff 1e-3 \
--moe-router-dtype fp32 --moe-per-layer-loggingTraining logs go to Trackio, Hugging Face's open-source tracker, which needs no account or paid plan. Every setting is pinned to a specific Megatron-LM commit, and the code and scripts are shared in the book.
At the end the authors write openly that many of their recommendations rest on a single ablation in a single lab. They invite readers to rerun the experiments at other scales, on other data and on other clusters, and to share configs and logs, negative results included, on the discussion page. Part of the compute came from the Swiss AI team. The book's closing line sums up its aim: the authors hope it saves your next MoE run a few of the days it cost theirs.
Sources: The Ultimate MoE Training Handbook (Hugging Face), Discussion page