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 | XLNet |
|---|---|---|
| Family | Transformers | Transformers |
| Year of appearance | 2017 | 2019 |
| Researchers | Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones,… | Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov,… |
| Architecture type | Encoder–decoder Transformer | Autoregressive Transformer-XL encoder |
| Learning mechanism | supervised | self-supervised |
| Compared configuration | Transformer (base): N = 6, d_model = 512, h = 8, d_ff = 2048 | XLNet-base: L = 12, d = 768, 12 heads |
| Input shape | n source tokens and n target tokens | n tokens (+ memory) |
| Output shape | n × 37000 | n × 768 |
| Depth | 6 encoder layers + 6 decoder layers | 12 layers |
| Parameters (computed) | 63,084,544 ≈63.08M | 116,718,336 ≈116.72M |
| Parameters (published) | 65,000,000 ≈65M | Unspecified |
| 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). | 13,287,555,072 ≈13.29B For a sequence n = 128 without previous memory (content stream only at inference). |
| Complexity | Attention O(n²·d) per layer, and the linear layers O(n·d²). | O(L·(n·(n+m)·d + nd²)). |
| Tasks | Machine translation, Sequence transduction | Text classification, Question answering |
| Main advantage | Fully parallel training | Bidirectional context without [MASK] |
| Main limitation | Attention cost is quadratic in the sequence length | High implementation complexity |
| 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. | XLNetModel from Hugging Face with the xlnet-base-cased configuration; the paper does not state the number of parameters explicitly. |
Recorded relations between the compared models
- Transformer Built on XLNet — Built on Transformer-XL.
