Comparisons / BERT Base vs T5 Small
BERT Base vs T5 Small
Encoder-only against encoder-decoder.
T5 Small has 26M more parameters than BERT Base: 14 layers added, 2 removed, 8 changed.
BERT Base
- Layers
- 9
- Parameters
- 31M
- Input
- 1 × 512
- Output
- 1 × 512 × 768
- Forward-passes
- yes
- Est. train cost
- $0.197
T5 Small
- Layers
- 20
- Parameters
- 57M
- Input
- 1 × 512
- Output
- 1 × 128 × 32128
- Forward-passes
- yes
- Est. train cost
- $0.207
The deltas
Every number is T5 Small relative to BERT Base.
Which GPUs each one fits
Memory for the graph at the input shape both declare. A highlighted row is a card one of them fits and the other does not, which is the difference that decides a purchase.
| GPU | BERT Base | T5 Small |
|---|---|---|
| T4 16GB | fits | fits |
| A100 40GB | fits | fits |
| H100 80GB | fits | fits |
Layer by layer
Aligned in topological order. 1 of 25 rows are the same layer with the same parameters.
Hide all 25 rows
| BERT Base | T5 Small | ||||||
|---|---|---|---|---|---|---|---|
| Layer | Params | Output | Layer | Params | Output | ||
| 1 | added | — | encoder_ids Input | 1 × 512 | |||
| 2 | changed shape | input_ids Input | 1 × 512 | decoder_ids Input | 1 × 128 | ||
| 3 | changed numEmbeddings, embeddingDim | word_embed Embedding | 23M | 1 × 512 × 768 | shared_embed Embedding | 16M | 1 × 512 × 512 |
| 4 | removed | pos_embed Positional Encoding | 1 × 512 × 768 | — | |||
| 5 | added | — | dec_embed Embedding | 16M | 1 × 128 × 512 | ||
| 6 | added | — | enc_norm Rms Norm | 512 | 1 × 512 × 512 | ||
| 7 | added | — | dec_sa_norm Rms Norm | 512 | 1 × 128 × 512 | ||
| 8 | added | — | enc_self_attn Multi Head Attention | 1.1M | 1 × 512 × 512 | ||
| 9 | added | — | dec_self_attn Causal Attention | 1.0M | 1 × 128 × 512 | ||
| 10 | added | — | enc_residual Add | 1 × 512 × 512 | |||
| 11 | added | — | dec_sa_residual Add | 1 × 128 × 512 | |||
| 12 | added | — | enc_ffn_norm Rms Norm | 512 | 1 × 512 × 512 | ||
| 13 | added | — | dec_ca_norm Rms Norm | 512 | 1 × 128 × 512 | ||
| 14 | added | — | enc_ffn Feed Forward | 2.1M | 1 × 512 × 512 | ||
| 15 | added | — | enc_ffn_residual Add | 1 × 512 × 512 | |||
| 16 | changed normalizedShape | embed_norm Layer Norm | 1.5K | 1 × 512 × 768 | enc_out_norm Layer Norm | 1.0K | 1 × 512 × 512 |
| 17 | removed | embed_drop Dropout | 1 × 512 × 768 | — | |||
| 18 | changed embedDim, numHeads | self_attn Multi Head Attention | 2.4M | 1 × 512 × 768 | cross_attn Multi Head Attention | 1.1M | 1 × 128 × 512 |
| 19 | added | — | dec_ca_residual Add | 1 × 128 × 512 | |||
| 20 | changed type, normalizedShape | norm Layer Norm | 1.5K | 1 × 512 × 768 | dec_ffn_norm Rms Norm | 512 | 1 × 128 × 512 |
| 21 | changed embedDim, ffDim | dense Feed Forward | 4.7M | 1 × 512 × 768 | dec_ffn Feed Forward | 2.1M | 1 × 128 × 512 |
| 22 | added | — | dec_ffn_residual Add | 1 × 128 × 512 | |||
| 23 | changed normalizedShape | norm Layer Norm | 1.5K | 1 × 512 × 768 | dec_out_norm Layer Norm | 1.0K | 1 × 128 × 512 |
| 24 | changed inFeatures, outFeatures | dense Linear | 591K | 1 × 512 × 768 | lm_head Linear | 1 × 128 × 32128 | |
| 25 | same | cls_embedding Output | 1 × 512 × 768 | logits Output | 1 × 128 × 32128 | ||
What this is not
- Parameter counts are derived from the graph, not read from a checkpoint. They are exact for a graph that is fully specified and approximate for one that is not.
- Cost and GPU fit are estimates from the graph under one set of assumptions, not measurements of a run.
Take it further
Open either graph in the editor, change it, and check it again: BERT Base · T5 Small
Compare any two models of your own, including anything on Hugging Face: the comparison tool.
Machine-readable: this page as markdown ·
the pair index ·
POST https://www.neurarch.com/api/v1/plan for a graph of your own.