AI Hints
Home›Generative AI Tutorial›Attention and the Transformer
Generative AI · Lesson 15 of 77

Pre-training at Scale

How a language model learns from the internet.

⏱ 2 min read▶ Video at 38:05🎓 Free
Watch this lesson in the Generative AI courseWatch on YouTube ↗Full Generative AI course

How does a transformer actually learn language? Not with a teacher. With a very simple game, played billions of times. In this lesson, you will learn what pre-training is, how much data and computing it needs, and why bigger has usually meant better.

Pre-training at Scale
From the video: Pre-training at Scale
  • Learning without a teacher
  • A simple game, played billions of times
  • Bigger has usually meant better

The pre-training game

Pre-training is a fill in the blank game. Take a sentence from a book or a web page. Hide the next word. Ask the model to guess it. Compare the guess with the real word, measure the loss, and nudge the weights. The text itself provides the answers, so no human labelling is needed. Do this over trillions of words, and the model learns grammar, facts, and style. This is called self supervised learning.

  1. Take real textfrom books, web, code
  2. Hide the next wordthe text is its own answer
  3. Guess and comparemeasure the loss
  4. Nudge the weightsthen repeat trillions of times
No human labels needed
The pre-training game
From the video: The pre-training game

How much data?

The amounts are staggering. Early models trained on a few billion words. GPT three saw hundreds of billions of tokens. Modern models train on trillions. That is more text than a person could read, in many thousands of lifetimes. And the training runs on thousands of specialised chips, called GPUs, for weeks, or months, costing millions of dollars.

GPT-2 era
about 10 billion
GPT-3 era
about 300 billion
Modern models
trillions of tokens

Scaling laws

Researchers made a surprising discovery. Performance improves smoothly and predictably, when you scale up three things together. The size of the model. The amount of data. And the amount of computing. These are called scaling laws. They gave companies the confidence to invest in ever larger models, because they could predict the improvement before spending the money.

More parametersa bigger model
More datamore to learn from
More computemore training steps
Predictable gainsimprovement you can forecast

Summary

Good. Pre-training is a giant fill in the blank game, played on trillions of words, with the text providing its own answers. It needs huge data, and huge computing. And scaling laws show that more of both gives predictably better models. But a pre-trained model is not yet a helpful assistant. Next, we turn it into one.

Key takeaways
  • Pre-training: predict the hidden next word
  • Trillions of tokens, weeks of GPU time
  • Scaling laws: more of everything helps
Next up: Tuning and Alignment — from text predictor to helpful assistant