Rafhael Oliveira · IA

RoBERTa: when the advance is training better what already existed

Masked Language Modeling, dynamic masking, and the other branch of the tree.

1 min read· chapter: 8 min

Landed here from LinkedIn? This is chapter 10 of the course GPT-1 and GPT-2, taken apart. It reads on its own; if you want the beginning, it is chapter 00.

Four months after GPT-1, Google took the same block and made the opposite decision. Without the causal mask, every token sees the whole sentence, past and future. The representation of 'bank' in 'I sat on the bank of the river' is built with 'river' available from the first block. That is BERT. But bidirectionality creates a training problem: if the model sees everything, predicting the next word becomes cheating. The fix was to hide words. And a year later, Facebook showed BERT was undertrained, and that sometimes the advance is training better what already existed.

The three points

  1. MLM: hide 15% of the tokens and ask the model to guess them using both sides. It is the objective that makes sense without a causal mask.
  2. RoBERTa did not change the architecture. It changed data, training time, batch size and the masking, which became dynamic.
  3. The structural differences you will touch: tokenizer, special tokens, and the absence of generation.

From the chapter, the beginning

Masked Language Modeling, dynamic masking, and the lesson that sometimes the advance is training better what already existed.

Without the mask, each token sees the whole sentence — past and future. The representation of "banco" in "sentei no banco da praça" (Portuguese: "I sat on the bench in the square") is now built with "praça" available from the very first block.

The gain in comprehension is enormous and immediate. BERT broke records on eleven tasks at once. But there is a price, and it is fatal for one specific thing.

Keep reading chapter 10 →Ler em portuguêsThe PDFs by e-mail →
What the chapter covers · 5 sections · 8 min
  1. The other branch of the tree
  2. The problem bidirectionality creates
  3. What RoBERTa changed (2019)
  4. The structural differences you will run into
  5. In the lab
All chapters of the course · GPT-1 and GPT-2, taken apart
  1. 00 · The seven fossils: why GPT-1, GPT-2 and RoBERTa are a historical cross-section, not a list
  2. Glossary · Course glossary: what token, layer and model mean in AI, and in the rest of IT
  3. 01 · Why GPT-2 sees neither letters nor words, and what that costs in Portuguese
  4. 02 · Embeddings: from a meaningless integer to a vector that knows king and queen are related
  5. 03 · Attention: the single operation that replaced twenty years of recurrent networks
  6. 04 · Twelve heads instead of one, and the single line of code that separates GPT from RoBERTa
  7. 05 · Why GPT-2 needs 48 floors to answer, and what happens inside each one
  8. 06 · What scale really buys: from 124 million to 1.5 billion, measured
  9. 07 · Temperature, top-k and top-p: the decision that changes the text more than switching models
  10. 08 · Perplexity: the one number that says what the model learned, without anecdotes
  11. 09 · GPT-1 to GPT-2: same size, half the perplexity. Four decisions explain it
  12. 10 · RoBERTa: when the advance is training better what already existed
  13. 11 · Encoder vs decoder: one line of code and every consequence that descends from it
  14. 12 · The detector: how a language model becomes a classifier, and why this one should decide nothing
  15. 13 · Reading GPT-2's original code: 174 lines against everything you learned
  16. 14 · Serving models: from function call to HTTP server, and what production does on top
  17. 15 · The lab guide: every command, every script, and everything that was measured
  18. 16 · The ceiling of this path: LeCun's argument, read from inside GPT-2

After this: the Antivision experiment

Rafhael Oliveira
Rafhael Oliveira

Writes the GPT-2 course and runs the Antivision experiment, measuring every run before publishing the number. The LinkedIn posts start here and end in the chapters.

Follow on LinkedIn →