Art of DS

Appearance

Palette
Theme
Unlock $20 one time
Sign in, or create an account

Sign in to Art of DSCreate your Art of DS account

We email you a link and a six-digit code. Either one signs you in; there is no password.Enter your email. We send a link and a six-digit code to confirm it — no password to remember. The account is free.

  • You come back to this page, right where you were.
  • Already have an account? The same email simply signs you in.

By continuing you accept the Terms and the Privacy policy.

Your account

Free accountLifetime access

NLP · 8 compared

Transformer family

Definition

Every model here is the same block from Attention Is All You Need, stacked. Read the first column — what each position is allowed to attend to decides the objective, the task, and everything after.

Comparison

Name What it changes Attention is Pretrained by Shaped for Chasing
BERT 2018 Masks 15% of tokens and predicts them from both sides, which makes right-hand context legal to use. One extra output layer then adapts it to any task. Full page →bidirectionalmasked LM, plus next-sentence predictionunderstandinga new capability
RoBERTa 2019 The same architecture with a better recipe — longer, bigger batches, more data, no next-sentence objective, and a mask that changes each epoch. BERT was undertrained.bidirectionalmasked LM, dynamic maskingunderstandingaccuracy
ALBERT 2019 Two parameter-reduction techniques plus an inter-sentence coherence loss, so a model with fewer parameters than BERT-large outscores it. Weights are shared, not removed.bidirectionalmasked LM, inter-sentence coherenceunderstandingmemory
DistilBERT 2019 Distils during pretraining rather than per task, so one student serves every downstream job — 40% smaller, 60% faster, 97% of the language-understanding score kept.bidirectionaldistillation from BERTunderstandinginference cost
T5 2019 Casts translation, classification, summarisation and question answering all as text in, text out, so one encoder-decoder and one loss cover every task in the study.encoder plus decoderspan corruptiontext to textgenerality
ELECTRA 2020 Swaps masking for spotting which tokens a small generator replaced. The task is defined over every position instead of the masked 15%, which is where the efficiency comes from.bidirectionalreplaced-token detectionunderstandingcompute
GPT-3 2020 Scales an autoregressive decoder to 175 billion parameters and then drops fine-tuning — the task is described in the prompt, with no gradient updates at all.causalnext tokengenerationscale
ViT 2020 Cuts an image into patches and feeds them to a plain transformer encoder, showing that the reliance on convolution was never necessary given enough pretraining data.bidirectionallarge-scale image pretrainingvisiona new domain

Lineage

  1. 2018
    BERT Full page → Masks 15% of tokens and predicts them from both sides, which makes right-hand context legal to use. One extra output layer then adapts it to any task. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding led to RoBERTa
  2. 2019
    RoBERTa The same architecture with a better recipe — longer, bigger batches, more data, no next-sentence objective, and a mask that changes each epoch. BERT was undertrained. RoBERTa: A Robustly Optimized BERT Pretraining Approach the line ends here
  3. 2019
    ALBERT Two parameter-reduction techniques plus an inter-sentence coherence loss, so a model with fewer parameters than BERT-large outscores it. Weights are shared, not removed. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations the line ends here
  4. 2019
    DistilBERT Distils during pretraining rather than per task, so one student serves every downstream job — 40% smaller, 60% faster, 97% of the language-understanding score kept. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter the line ends here
  5. 2019
    T5 Casts translation, classification, summarisation and question answering all as text in, text out, so one encoder-decoder and one loss cover every task in the study. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer the line ends here
  6. 2020
    ELECTRA Swaps masking for spotting which tokens a small generator replaced. The task is defined over every position instead of the masked 15%, which is where the efficiency comes from. ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators the line ends here
  7. 2020
    GPT-3 Scales an autoregressive decoder to 175 billion parameters and then drops fine-tuning — the task is described in the prompt, with no gradient updates at all. Language Models are Few-Shot Learners the line ends here
  8. 2020
    ViT Cuts an image into patches and feeds them to a plain transformer encoder, showing that the reliance on convolution was never necessary given enough pretraining data. An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale the line ends here

Read the Attention is column first, because the other three follow from it.

Bidirectional means every position sees the whole sequence, which is only possible if the training objective hides something. BERT hides it by masking, and the paper is explicit that this is not a stylistic choice: standard language models "can only be trained left-to-right or right-to-left, since bidirectional conditioning would allow each word to indirectly 'see itself'" [1, §3.1]. Remove the mask and the task becomes trivial.

Causal means every position sees only what precedes it, which is exactly what generation requires and exactly what makes a model worse at judging text it already has — the BERT page has the ablation.

Encoder plus decoder keeps both, at the cost of running two stacks.

Everything else in the table is downstream. A bidirectional model is shaped for understanding, a causal one for generation, and the objective is whichever task the attention pattern makes non-trivial.

After BERT, almost nobody added a capability

Look down the Chasing column. BERT bought a new capability; nearly every model under it bought a resource back.

RoBERTa bought accuracy with nothing but a recipe. Its modifications are listed plainly — "(1) training the model longer, with bigger batches, over more data; (2) removing the next sentence prediction objective; (3) training on longer sequences; and (4) dynamically changing the masking pattern" [2, §1] — and the finding is that "BERT was significantly undertrained, and can match or exceed the performance of every model published after it" [2, abstract]. A year of architectural progress turned out to be partly a training-budget artefact, which is the single most useful result in this table.

ALBERT and DistilBERT bought size back, by opposite means. ALBERT applies "two parameter-reduction techniques to lower memory consumption and increase the training speed of BERT", reaching state of the art "while having fewer parameters compared to BERT-large" [3, abstract] — the network is not smaller, its weights are shared. DistilBERT instead trains a genuinely smaller student, and moves the distillation into pretraining: "while most prior work investigated the use of distillation for building task-specific models, we leverage knowledge distillation during the pre-training phase", which "reduce[s] the size of a BERT model by 40%, while retaining 97% of its language understanding capabilities and being 60% faster" [4, abstract]. One is cheaper to train, the other cheaper to run.

ELECTRA bought compute back by fixing masking's inefficiency. Its objective corrupts the input "by replacing some tokens with plausible alternatives sampled from a small generator network" and then predicts which ones were replaced; the reason it is faster is stated exactly — "the task is defined over all input tokens rather than just the small subset that was masked out" [5, abstract]. That is the arithmetic on the BERT page turned into a design. The payoff is large enough to be worth quoting: a model trained "on one GPU for 4 days" that outperforms GPT trained "using 30x more compute" [5, abstract].

The two that went sideways

T5 attacked the interface rather than the model. Its move is to convert "all text-based language problems into a text-to-text format" [6, abstract], which makes classification, translation and summarisation the same problem with different strings. Its pretraining objective came out of a systematic comparison rather than an argument: span corruption, which corrupts 15% of the sequence in contiguous runs, with an average span length of 3 slightly outperforming independently chosen tokens [6, §3.3.4].

GPT-3 attacked the fine-tuning step itself. The complaint is that pretraining "still requires task-specific fine-tuning datasets of thousands or tens of thousands of examples", where "humans can generally perform a new language task from only a few examples or from simple instructions" [7, abstract]. The answer is scale — "175 billion parameters, 10x more than any previous non-sparse language model" — applied so that "for all tasks, GPT-3 is applied without any gradient updates or fine-tuning, with tasks and few-shot demonstrations specified purely via text interaction" [7, abstract]. Fine-tuning stops being a training step and becomes part of the prompt.

And ViT left the field. The claim is negative and that is what makes it interesting: "this reliance on CNNs is not necessary and a pure transformer applied directly to sequences of image patches can perform very well on image classification tasks" [8, abstract]. The condition matters as much as the claim — the result holds "when pre-trained on large amounts of data" [8, abstract], which is the same weak-inductive-bias bargain the transformer page describes, paid in images.

Which to reach for

Classifying, tagging or extracting from text you already have? An encoder. Start from a RoBERTa-family checkpoint rather than the original BERT, for the reason RoBERTa established [2, abstract].

Generating text? A decoder. The causal mask is the requirement, not a limitation to work around.

Turning one text into another — summarising, translating, rewriting? An encoder-decoder, or a decoder with the input in the prompt. T5's argument is that the distinction between these tasks is smaller than it looks [6, abstract].

Constrained on latency or memory? Distillation and parameter sharing are the two established answers, and they trade differently: DistilBERT is smaller at inference [4, abstract], ALBERT is lighter to train [3, abstract].

One caution for the whole table. Every row reports benchmark scores, and every row was pretrained on a corpus of web text whose content the authors did not choose term by term. The numbers are results on specific datasets; they are not statements about language, and the biases in the corpus are inherited by the representation whichever objective was used.

Sources

  1. Devlin, Chang, Lee, Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding (2019)paperhttps://ar5iv.labs.arxiv.org/html/1810.04805
  2. Liu, Ott, Goyal, Du, Joshi, Chen, Levy, Lewis, Zettlemoyer, Stoyanov. RoBERTa: A Robustly Optimized BERT Pretraining Approach (2019)paperhttps://ar5iv.labs.arxiv.org/html/1907.11692
  3. Lan, Chen, Goodman, Gimpel, Sharma, Soricut. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations (2019)paperhttps://ar5iv.labs.arxiv.org/html/1909.11942
  4. Sanh, Debut, Chaumond, Wolf. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter (2019)paperhttps://ar5iv.labs.arxiv.org/html/1910.01108
  5. Clark, Luong, Le, Manning. ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generators (2020)paperhttps://ar5iv.labs.arxiv.org/html/2003.10555
  6. Raffel, Shazeer, Roberts, Lee, Narang, Matena, Zhou, Li, Liu. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer (2020)paperhttps://ar5iv.labs.arxiv.org/html/1910.10683
  7. Brown, Mann, Ryder, Subbiah, Kaplan, Dhariwal, and others. Language Models are Few-Shot Learners (2020)paperhttps://ar5iv.labs.arxiv.org/html/2005.14165
  8. Dosovitskiy, Beyer, Kolesnikov, Weissenborn, Zhai, Unterthiner, and others. An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale (2021)paperhttps://ar5iv.labs.arxiv.org/html/2010.11929

Have a promo code?

A code that takes 100% off unlocks everything at once. A smaller one takes its share off the price in the payment window: enter the same code there.

Write to support

A question, a problem with access, a refund? Write to us and we answer by email.

What is it about?

Your address is used only to answer you.

Message sent

Thank you. We will reply to the address you gave, by email.

Or write to us directly

support@artofds.com

Message sent Thank you. We will reply to the address you gave, by email.

Check the email address: we need it to reply.

That is our own address. Enter yours, so the reply reaches you.

This address cannot receive email. Check it for a typo.

Write a little more: at least 10 characters.

Too many messages in a short time. Try again in a few minutes.

The message could not be sent. Please write to us directly: support@artofds.com