All models

switch_transformer_tiny

Sparse T5 whose MLP layers are replaced by a routed mixture of experts.

Language · 2,079 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

This diagram has 2,079 operations (59 KB) and is drawn when you ask.

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
317.3M
Operations
2,079
Framework
PyTorch
Recurrent
No
Published
2021
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m10468
Graph hash
d6246b65d75b0c99099179cd02d87a83beb777b2ed4e04be16150dfbe01cb053
Skeleton hash
911f15654b86f966e138df58ee42901ab4f68b94fd1d9bc3dead21d07e341f40
Architecture hash
b7003edf8fc10c718cf89e5b6da7654ff06e69588b80c069629d03bddc12b61c
Diagram SHA-256
f3367fd9fc2a03875567d1eb48235975ca9da700567c4a47083fadce34c96728
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

transformers.AutoModel.from_config()

What it is

About this model's family

Switch Transformers is a sparse T5 model in which the MLP layer is replaced by a Mixture-of-Experts. A routing mechanism associates each token with an expert, and each expert is a dense MLP. Sparsity enables better scaling, and the routing lets the model select relevant weights on the fly, which increases model capacity.

The library exposes the top-1 router and the sparse MLP as their own modules, next to the encoder-decoder model, a conditional generation head and an encoder-only variant. The original checkpoints, such as google/switch-base-8, live under the Switch Transformer collection. Both captured members instantiate the plain encoder-decoder model from configuration, so their weights are untrained and the traced output is hidden states rather than token predictions.

Key idea. Replacing the MLP of a T5 transformer with a Mixture-of-Experts whose router sends each token to a single dense expert, adding capacity through sparsity.

  • Switch Transformer
  • Switch Transformers
  • switch-base-8
  • mixture of experts
  • MoE
  • sparse T5
  • T5

AI-written summary, based on the model's documentation and checked automatically against it; not reviewed by a person. Corrections welcome.