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.

PropertyTransformerVision Transformer (ViT)
FamilyTransformersVision Models
Year of appearance20172020
ResearchersAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones,…Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai,…
Architecture typeEncoder–decoder TransformerEncoder-only Transformer on image patches
Learning mechanismsupervisedsupervised
Compared configurationTransformer (base): N = 6, d_model = 512, h = 8, d_ff = 2048ViT-B/16: 12 layers, D = 768, 12 heads, 16×16 patches, resolution 224
Input shapen source tokens and n target tokens3×224×224
Output shapen × 370001000
Depth6 encoder layers + 6 decoder layers12 encoder layers
Parameters (computed)63,084,544
≈63.08M
86,567,656
≈86.57M
Parameters (published)65,000,000
≈65M
86,000,000
≈86M
MACs8,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).
ComplexityAttention O(n²·d) per layer, and the linear layers O(n·d²).O(L·(N²D + ND²)) with N = 197.
TasksMachine translation, Sequence transductionImage classification, Feature extraction
Main advantageFully parallel trainingScales well with data and size
Main limitationAttention cost is quadratic in the sequence lengthNeeds huge data or strong regularisation
Review statusNeeds reviewNeeds review
Calculation assumptionsnn.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.