Model comparison
This page compares specific configurations (such as ResNet-50 or BERT-base), not general families; each number is tied to the configuration named at the top of its column. “Unspecified” means the number is not documented in the atlas.
| Property | Transformer | Vision Transformer (ViT) |
|---|---|---|
| Family | Transformers | Vision Models |
| Year of appearance | 2017 | 2020 |
| Researchers | Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones,… | Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai,… |
| Architecture type | Encoder–decoder Transformer | Encoder-only Transformer on image patches |
| Learning mechanism | supervised | supervised |
| Compared configuration | Transformer (base): N = 6, d_model = 512, h = 8, d_ff = 2048 | ViT-B/16: 12 layers, D = 768, 12 heads, 16×16 patches, resolution 224 |
| Input shape | n source tokens and n target tokens | 3×224×224 |
| Output shape | n × 37000 | 1000 |
| Depth | 6 encoder layers + 6 decoder layers | 12 encoder layers |
| Parameters (computed) | 63,084,544 ≈63.08M | 86,567,656 ≈86.57M |
| Parameters (published) | 65,000,000 ≈65M | 86,000,000 ≈86M |
| MACs | 8,363,966,464 ≈8.36B For a source and target of length n = 128: from torch.utils.flop_counter (including the tied projection to the vocabulary). | 17,563,828,224 ≈17.56B Computed with torch.utils.flop_counter; it matches the 17.56 “GFLOPS” in the torchvision documentation (which are multiply-adds). |
| Complexity | Attention O(n²·d) per layer, and the linear layers O(n·d²). | O(L·(N²D + ND²)) with N = 197. |
| Tasks | Machine translation, Sequence transduction | Image classification, Feature extraction |
| Main advantage | Fully parallel training | Scales well with data and size |
| Main limitation | Attention cost is quadratic in the sequence length | Needs huge data or strong regularisation |
| Review status | Needs review | Needs review |
| Calculation assumptions | nn.Transformer in PyTorch with a shared 37,000 × 512 embedding and a tied output projection. PyTorch adds two final normalisations (2,048 parameters), and the actual vocabulary size may differ slightly, so the total differs from the stated 65M. | torchvision.models.vit_b_16 with a single linear head (the fine-tuning head); pre-training in the paper used an MLP with a hidden layer. |
Recorded relations between the compared models
- Transformer Predecessor of Vision Transformer (ViT) — ViT applied the encoder to image patches.
