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.

PropertyTransformerXLNet
FamilyTransformersTransformers
Year of appearance20172019
ResearchersAshish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones,…Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov,…
Architecture typeEncoder–decoder TransformerAutoregressive Transformer-XL encoder
Learning mechanismsupervisedself-supervised
Compared configurationTransformer (base): N = 6, d_model = 512, h = 8, d_ff = 2048XLNet-base: L = 12, d = 768, 12 heads
Input shapen source tokens and n target tokensn tokens (+ memory)
Output shapen × 37000n × 768
Depth6 encoder layers + 6 decoder layers12 layers
Parameters (computed)63,084,544
≈63.08M
116,718,336
≈116.72M
Parameters (published)65,000,000
≈65M
Unspecified
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).
13,287,555,072
≈13.29B
For a sequence n = 128 without previous memory (content stream only at inference).
ComplexityAttention O(n²·d) per layer, and the linear layers O(n·d²).O(L·(n·(n+m)·d + nd²)).
TasksMachine translation, Sequence transductionText classification, Question answering
Main advantageFully parallel trainingBidirectional context without [MASK]
Main limitationAttention cost is quadratic in the sequence lengthHigh implementation complexity
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.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.