Papers › Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity

Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity

11 Jan 2021arXiv:2101.03961archive 2025-07-28

William Fedus, Barret Zoph, Noam Shazeer

In deep learning, models typically reuse the same parameters for all inputs. Mixture of Experts (MoE) defies this and instead selects different parameters for each incoming example. The result is a sparsely-activated model -- with outrageous numbers of parameters -- but a constant computational cost. However, despite several notable successes of MoE, widespread adoption has been hindered by complexity, communication costs and training instability -- we address these with the Switch Transformer. We simplify the MoE routing algorithm and design intuitive improved models with reduced communication and computational costs. Our proposed training techniques help wrangle the instabilities and we show large sparse models may be trained, for the first time, with lower precision (bfloat16) formats. We design models based off T5-Base and T5-Large to obtain up to 7x increases in pre-training speed with the same computational resources. These improvements extend into multilingual settings where we measure gains over the mT5-Base version across all 101 languages. Finally, we advance the current scale of language models by pre-training up to trillion parameter models on the "Colossal Clean Crawled Corpus" and achieve a 4x speedup over the T5-XXL model.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2101.03961")

Code

Syntology Ran 7 of 13 code samples harvested from 3 repositories linked to this paper; 6 have no recorded run. Of those that ran: 4 ran · our draft was wrong; 3 ran with no contract checked.

By repository: official repository: 4 samples from 1 repository, 0 ran; community (archive-listed): 8 samples from 2 repositories, 6 ran; 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

tensorflow/mesh officialmentioned in papertf report
efeslab/fiddler mentioned on GitHubpytorch report
lingjzhu/charsiug2p mentioned on GitHubpytorch report
vikparuchuri/marker mentioned on GitHubpytorch report
zyphra/blackmamba mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

13 samples harvested; 7 ran; 0 honoured the contract we drafted; 6 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

4ran · our draft was wrong
3ran
6unverified

Licence: 8 of the 13 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 3 repositories linked to this paper, official or community; each sample names its own and says which. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

_add_token_emb_to_gate_inputs tensorflow/mesh/mesh_tensorflow/transformer/moe.py official repository unverified Apache-2.0 (permissive) · 898627b88bfd6d44 · report
_router_z_loss tensorflow/mesh/mesh_tensorflow/transformer/moe.py official repository unverified Apache-2.0 (permissive) · 7179ac118906b2a5 · report
_stochastically_use_non_top_expert tensorflow/mesh/mesh_tensorflow/transformer/moe.py official repository unverified Apache-2.0 (permissive) · da4ea018ee62163d · report
_switch_gating tensorflow/mesh/mesh_tensorflow/transformer/moe.py official repository unverified Apache-2.0 (permissive) · 2d4e03e49ac8f264 · report
MLP zyphra/blackmamba/switch_mlp.py community (archive-listed) ran no licence file found · pointer only · ff4dfeb7df35fff6 · report
MambaConfig zyphra/blackmamba/switch_mlp.py community (archive-listed) ran no licence file found · pointer only · 1db09a0131e40faf · report
MixtralBlockSparseTop2MLP efeslab/fiddler/benchmarks/mixtral_offloading/src/custom_layers.py community (archive-listed) ran · metamorphic tier: invariant Apache-2.0 (permissive) · 74374c911af39f6c · report
init_method_normal zyphra/blackmamba/switch_mlp.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · 58a3d812be2f2018 · report
scaled_init_method_normal zyphra/blackmamba/switch_mlp.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · c319770f5ead4490 · report
sinkhorn zyphra/blackmamba/switch_mlp.py community (archive-listed) ran · our draft was wrong fingerprinted no licence file found · pointer only · bfbd162761e2e475 · report
SwitchMLP zyphra/blackmamba/switch_mlp.py community (archive-listed) unverified no licence file found · pointer only · 02e5457338807a13 · report
selective_scan_fn zyphra/blackmamba/ops/selective_scan_interface.py community (archive-listed) unverified no licence file found · pointer only · c48b9d686b548496 · report
selective_scan_ref identical code first harvested elsewhere ran · our draft was wrong fingerprinted licence of this copy not recorded · ba7b868fec181b57 · report

Tasks

Language ModellingMixture-of-ExpertsQuestion Answering

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Introduced by this paper: Switch FFN

Switch FFNSwitch Transformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections