Choosing a Learning Rate for a Billion Tokens
The learning rate controls how large a step the model takes when it updates its weights. I wanted to choose one for a billion-token run on English web pages. Training every candidate for that long sounded expensive, so I tried picking a winner after just 100 million tokens. Here are two candidates scored on the same held-out text. Lower bits per byte (BPB) is better.
| Learning rate | BPB at 100M tokens | BPB at 1B tokens |
|---|---|---|
| 0.001 | 1.668 | 1.1471 |
| 0.002 | 1.681 | 1.1212 |
At 100 million tokens I would have picked 0.001. At a billion, 0.002 led by about 0.026 BPB. I tried doubling the rate again to 0.004, and the score went back up to 1.1450. Even the way I started each run mattered. With only 20 warmup steps to bring the learning rate up to speed, the larger rates stalled early. Extending the warmup to 100 steps gave me the short-run results in the table. I kept 0.002 and used 1.1212 BPB as my first baseline.
How big a difference should I trust?
I repeated the billion-token run at 0.001 with three random seeds. A seed affects both the starting weights and the order in which the model sees the text. The scores were 1.1471, 1.1442, and 1.1445. Given that spread, I treated differences below about 0.005 between two individual runs as too small to act on for this recipe. The 0.026 gap between learning rates cleared that threshold comfortably.
I also tried models with roughly 5M, 10M, and 20M parameters, giving each about 20 tokens per parameter. All three smaller models did best at 0.004 among the rates I tested. When recording a learning rate, it pays to write down the model size and training budget beside it.
How often should the model update its weights?
Batch size is the number of tokens the model reads before making one update. In a billion-token run, a batch of about 524,000 tokens gives roughly 1,900 updates. A batch of about 131,000 gives roughly 7,600. Both processed text at about the same speed on my card. At the best learning rates I tested for each batch size, the large, medium, and small batches scored 1.1212, 1.1006, and 1.0996 BPB. The two smaller batches were close, and I chose the smaller of the two. The warmup lasted 100 steps in each case, so it covered different amounts of text. That limits how precisely this experiment can identify an ideal batch size.
I also changed the learning-rate schedule. I raised the rate at the start, held it steady for most of training, then lowered it to zero over the final fifth of the budget. This warmup, stable, decay schedule (WSD) made later experiments cheaper. I could save the model during the stable phase, let one copy cool down and finish, and keep training the other copy. I eventually used this trick to compare five token budgets.
With the smaller batch, WSD, and a learning rate of 0.002, three runs scored 1.0850, 1.0901, and 1.0919. Their mean of 1.0890 was about 0.032 below the first baseline. The variation between seeds had also grown. For this recipe I wanted a gap of about 0.01 BPB before calling a difference between two single runs meaningful. The trial that changed the schedule alone gained only about 0.008 and also changed the final learning rate, so I could say more about the recipe as a whole than about the shape of its cooldown. Baseline and training recipe experiments