Learning rate
The learning rate is a training setting that controls how large a step a model's parameters take on each update, trading the speed of learning against the risk of overshooting.
Training a model means repeatedly working out which way to adjust each parameter, the gradient, and then moving a little in that direction. The learning rate decides how far. Google's machine learning glossary describes it as the number that tells gradient descent how strongly to adjust the weights on each iteration: the update is the gradient multiplied by the learning rate. A rate of 0.3 adjusts parameters three times as strongly as a rate of 0.1.
Getting it right is a balancing act. Set it too low and training creeps along and can get stuck. Set it too high and each step overshoots, jumping over good solutions, so training oscillates or fails to settle at all. Google's glossary calls it a key hyperparameter, and its Machine Learning Crash Course says lowering it is often a good idea when debugging a training problem.
The rate rarely stays fixed. A learning rate schedule changes it during training, typically starting larger and shrinking so the model can settle. Meta's Llama 2 models, trained in 2023, used a common modern pattern: a warm-up over the first 2,000 steps, then a cosine-shaped decay down to 10% of the peak. The peak was 0.0003 for the smaller models and 0.00015 for the 34 and 70 billion parameter ones, showing that larger models were trained with smaller rates.
Adaptive optimisers go further by adjusting the effective rate for each parameter as training proceeds. Adagrad, Adadelta, RMSprop and Adam are well-known examples, built into libraries such as Keras. They reduce the need to hand-tune a schedule, but they still take a base learning rate.
Fine-tuning usually uses much smaller rates than pre-training, because the aim is to adjust a capable model without wiping out what it already knows. Hugging Face's TRL library, for instance, defaults to a learning rate of 0.000001 for DPO preference training, compared with 0.00005 for the general-purpose trainer it builds on.
It is a number that sets how big a step a model's parameters take on each training update. The gradient says which direction to move; the learning rate says how far. Too high and the updates overshoot, so the loss jumps around or diverges instead of settling. Too low and training is very slow and may stall in a poor solution. Finding a rate in between is one of the main jobs of hyperparameter tuning. It is a plan for changing the learning rate during training. Common patterns start with a short warm-up in which the rate rises, then decay it gradually, for example along a cosine curve, so that the model makes big moves early and fine adjustments late. It depends on the model, optimiser and task. Meta's Llama 2 models used peaks of 0.0003 and 0.00015 for pre-training, while fine-tuning methods often use far smaller values, such as the 0.000001 default in Hugging Face's DPO trainer.Common questions
What is the learning rate in machine learning?
What happens if the learning rate is too high or too low?
What is a learning rate schedule?
What is a typical learning rate?
Search for "learning rate", "learning rate schedule", "warmup cosine decay" or "Adam optimizer" to learn more. Google's machine learning glossary and Crash Course explain the basics; the Adam paper and developers' technical reports show what is used in practice; framework documentation lists default values. Treat learning rates quoted in blog posts as starting points for a particular setup, not general rules.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.