Switch-C
Google · Switch Transformer · open weights · encoder-decoder
- MHA
- Relative bias
- Pre-norm
- MoE
- Encoder-decoder
Facts and where they come from
| Released | 2021-01 | paperpaperarXiv v1, January 2021 |
|---|---|---|
| Licence | apache-2.0 | config.jsonconfig.jsonREADME metadata: license |
| Total parameters | 1.57T | paperpaperTable 9: Switch-C, 1571B parameters |
| Active parameters | not disclosed | not disclosed |
| Context length | not disclosed | not disclosed |
| Norm placement | pre | codemodelling codetransformers 5.18.0 switch_transformers: T5-style pre-norm |
| Norm type | RMSNorm | codemodelling codetransformers 5.18.0 switch_transformers: T5-style pre-norm |
| QK-norm | no | codemodelling codeno q/k normalisation in the attention block |
| Positional encoding | relative position bias | codemodelling codetransformers 5.18.0 t5: bucketed relative position bias |
| Parallel attention and MLP | no | codemodelling codetransformers 5.18.0 switch_transformers: T5-style pre-norm |
Architecture, drawn from the data
MHA 32q/32kv. Each column is one layer: its token mixer above, its feed-forward block below. Paler columns reuse another layer’s keys and values.
Modelled costs
From the cost model, batch size 1. Totals the lab states are in the table above; differences come from rounding, from what a lab counts, or from parts the model does not describe (listed on the about page).
| Parameters (modelled) | 1.57T |
|---|---|
| Active per token (modelled) | 1.73B |
| Without embeddings and output head | 1.57T total, 1.66B active |
| KV cache per token, BF16 (layers that grow with context) | 240 KiB |
| KV cache + state at 128K tokens, BF16 | 30 GiB |
| Decode FLOPs per token at 4K context | 4.46 GFLOP |
| Prefill FLOPs for a 4K prompt | 13.6 TFLOP |
KV cache against context
Every architecture field
| Field | Value | Source |
|---|---|---|
| d_model | 2,080 | paperpaperTable 9: d_model 2080 |
| vocab | 32,128 | paperpapergoogle/switch-c-2048 config: vocab_size 32128 (T5 vocabulary) |
| tied_embeddings | true | codemodelling codetransformers 5.18.0 t5: tie_word_embeddings default true |
| mixers.full.type | attn | codemodelling codeattention |
| mixers.full.heads | 32 | paperpaperTable 9: 32 heads |
| mixers.full.kv_heads | 32 | paperpaperTable 9: 32 heads |
| mixers.full.head_dim | 64 | paperpaperTable 9: d_kv 64 |
| ffns.dense.type | dense | codemodelling codeMLP |
| ffns.dense.d_ff | 6,144 | paperpaperTable 9: d_ff 6144 |
| ffns.dense.gated | false | codemodelling codeReLU MLP |
| ffns.moe.type | moe | codemodelling codeSwitch MoE |
| ffns.moe.experts | 2,048 | paperpaperTable 9: 2048 experts |
| ffns.moe.active | 1 | codemodelling codeSwitch routing: top-1 |
| ffns.moe.d_expert | 6,144 | paperpaperTable 9: d_ff 6144 |
| ffns.moe.gated | false | codemodelling codeReLU experts |
| layout | 15× full/moe | paperpaperTable 9: 15 layers |
| encoder_layout | 15× full/moe | paperpaperTable 9: 15 layers |
| norms_per_layer | 2 | codemodelling codepre-norm RMSNorm |
Sources
- config.json @ 14b5b82
- model card
- paper · Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity
- modelling code · transformers 5.18.0 modelling code, or the model repository's own modelling file at the pinned revision