§11.1Scaling Transformers: Scaling Laws & Challenges

Part III NLPT pp. 75–81 · ~4 min read

  • the bitter lesson
  • scaling laws
  • power law
  • cross-entropy loss
  • zero-shot learning
  • few-shot learning
  • sample efficiency

This final chapter looks at where transformers are going, along three axes: scaling them up, making attention efficient, and pushing them into new modalities. We start with scale.

The bitter lesson

Richard Sutton, “The Bitter Lesson” (2019)

“The biggest lesson that can be read from 70 years of AI research is that general methods that leverage computation are ultimately the most effective, and by a large margin… the only thing that matters in the long run is the leveraging of computation.”

The bitter lesson is playing out with transformers: while early BERT/GPT descendants tweaked architectures and objectives, the best 2021 models (GPT-3) are essentially scaled-up originals. Model size has grown by four-plus orders of magnitude since the 2017 Transformer:

0.1B1B10B100BTransformerGPTBERTGPT-2T5GPT-3Gopher20172018201920202021parameters (log scale) over time
Figure 11-1 (recreated). Parameter counts of prominent transformers, 2017–2021 — over four orders of magnitude of growth.

This is driven by evidence that larger models do better downstream, and that zero-shot and few-shot abilities emerge in the 10–100B-parameter range. But parameters aren’t the only lever — compute and data must scale too. Since a GPT-3-sized run costs ~$4.6M, it pays to predict performance in advance. Remarkably, you can.

Scaling laws

Scaling laws quantify “bigger is better” by charting the cross-entropy loss L against three factors: compute budget C, dataset size D, and model size N. Each follows a power law — a straight line on log-log axes:

L(X)1Xα,X{N,C,D}L(X) \propto \frac{1}{X^{\alpha}}, \qquad X \in \{N, C, D\}

Explore it: pick an axis and drag the exponent α. The book’s fitted values are α ≈ 0.050 (compute), 0.095 (data), 0.076 (parameters):

10⁻⁸10⁻⁶10⁻⁴10⁻²10⁰Compute (PF-days)test loss L →
L = (X / 2.3e+8)0.050

A power law is a straight line on log-log axes; its slope is −α. Bigger α → loss falls faster as you scale compute. Typical values are 0.05–0.095.

Figure 11-2 (recreated). Test loss is a power law in each of compute, dataset size, and model size. Drag α to change the slope.

Three takeaways:

  • Scale beats tweaking. Rather than tuning layers or heads on a fixed dataset, increasing N, C, and D in tandem is the more productive path.
  • Smooth power laws. L is a clean power law over several orders of magnitude, so the early part of a loss curve extrapolates to predict the loss of a much longer (or larger) run — before paying for it.
  • Sample efficiency . Larger models reach a given loss in fewer training steps.

Note — not just language

Power-law scaling has also been observed for images, video, and math problem solving — hinting it may be a broad property of these models, though whether it is truly universal is still unknown.

The challenges of scaling

“Just add more layers” is easy to say and hard to do. Scaling a language model runs into very practical walls:

The practical challenges of scaling. Click a row for detail.
What makes it hard
InfrastructureProvisioning hundreds–thousands of GPU nodes
CostSeveral million dollars per GPT-3-sized run
Dataset curationTerabytes of high-quality, de-biased text
Model evaluationProbing for bias and toxic generations
DeploymentServing hundreds-of-GB models
Dotted-underlined cells have explanations — click one.

Because these barriers concentrate power in a few well-resourced labs, community efforts like BigScience (an open research workshop) and EleutherAI (a decentralized collective behind GPT-Neo/GPT-J) aim to build and probe large models in the open.

Scale is one frontier; the other is making the attention mechanism itself cheaper — the subject of efficient self-attention.

Check yourself: scaling & scaling laws

1.What is the 'bitter lesson' as it applies to transformers?

2.Scaling laws relate the model's loss L to which three factors?

3.On a log-log plot, what does a power-law relationship L(X) ∝ 1/X^α look like, and what does α control?

4.Why are smooth power-law scaling curves so useful in practice?

5.In what parameter range do zero-shot and few-shot abilities tend to emerge?

6.Which is a real challenge of scaling that the chapter highlights?

6 questions