الانتقال إلى المحتوى
Machine LearningSupervised Learning· 7 دقائق للقراءة

The Learning Rate Isn't a Speed Knob: How Step Size Makes or Breaks Training

A bigger step can stop training sooner and land somewhere worse, or blow up without a single error.

ReadIn

مقال كل يوم يفرق معاك

21 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

A nightly training job takes too long, so a developer raises the learning rate from 0.001 to 0.1. The job now stops after 9 epochs instead of 21, the pipeline stays green, and the change ships as a performance fix. A week later the model's error is clearly worse, and nobody links it to the "speed-up", because nothing failed. The job didn't get faster at reaching the same place. It gave up somewhere else.

The common misconception

Many developers treat the learning rate like a speed setting: turn it up and training finishes sooner with the same result. That's not a careless belief:

  • The name suggests it. A higher "rate" of learning sounds like learning the same thing faster.
  • Google's Machine Learning Crash Course itself describes the learning rate as a number that influences how quickly the model converges, and below a certain point that's exactly what you see.
  • Training cost really is the pain point. When a job takes hours, the knob with "rate" in its name is the first thing people reach for.

It's a half-truth. Raising a too-small learning rate does speed things up. But past a problem-dependent point, a bigger step stops changing how fast you arrive and starts changing where you end up, or whether you arrive at all.

What actually happens

The learning rate scales every step

repeats one loop: compute the loss, compute the gradient (the direction in which the loss grows fastest), and move the weights a small step the opposite way. The is that step's multiplier. The Crash Course's example: with a gradient of 2.5 and a learning rate of 0.01, the weight changes by 0.025. Multiply the learning rate by 100 and every step is 100 times longer, whether or not the minimum is that far away.

Three regimes, not one dial

Picture walking down into a valley in fog, where you can only feel the slope under your feet.

  • Too small: each step is tiny, so you need many of them. The Crash Course says such a rate can take too many iterations to converge.
  • About right: you get close to the bottom within a reasonable number of steps, and the loss flattens out.
  • Too big: you step over the bottom to the other side, again and again. The Crash Course describes the model bouncing around the best weights without converging, with a loss that fluctuates or keeps rising. Far too big, and every step overshoots further than the last: the loss explodes.

Google's Deep Learning Tuning Playbook puts it bluntly: any workload becomes unstable if the learning rate is too large.

What it looks like in code

Here's a linear model trained with stochastic gradient descent on scikit-learn's built-in diabetes dataset (442 patients, 10 measurements), with a constant learning rate (eta0) at four sizes.

Python
from sklearn.datasets import load_diabetesfrom sklearn.linear_model import SGDRegressorfrom sklearn.metrics import mean_squared_errorfrom sklearn.preprocessing import StandardScalerX, y = load_diabetes(return_X_y=True)X = StandardScaler().fit_transform(X)# "Training is slow: raise the learning rate so it finishes sooner"for eta0 in [0.0001, 0.001, 0.1, 1.0]:    sgd = SGDRegressor(learning_rate="constant", eta0=eta0, random_state=0)    sgd.fit(X, y)  # no error, no warning, even when it diverges    mse = mean_squared_error(y, sgd.predict(X))    print(f"eta0={eta0:<6} epochs {sgd.n_iter_:<4} training MSE {mse:.4g}")# eta0=0.0001 epochs 184  training MSE 2879# eta0=0.001  epochs 21   training MSE 2879# eta0=0.1    epochs 9    training MSE 4624# eta0=1.0    epochs 6    training MSE 9.336e+25

Read the first output top to bottom. Going from 0.0001 to 0.001 is a real speed-up: 184 epochs down to 21, same error. That's the regime where the myth is true. At 0.1, training stops after only 9 epochs, but with an error of 4624 instead of 2879. At 1.0, it stops after 6 epochs with an error around 10²⁵, and fit returns normally.

"Stopped" doesn't mean "converged"

Fewer epochs looked like faster training, so why is the result worse? scikit-learn's SGD stops when the training loss fails to improve by tol for n_iter_no_change epochs in a row. With a big constant step, the weights keep jumping across the minimum, the loss stops improving, and the stopping rule fires. The run ended early because it got stuck bouncing, not because it arrived.

The second output shows the fix. With learning_rate="adaptive", scikit-learn divides the step by 5 each time the stopping criterion is reached, and only stops once the step drops below 1e-6. Big steps early, small steps late: starting at 0.1, it reaches 2860, the same training error as the exact least-squares solution that LinearRegression computes directly.

The best value depends on everything else

The Crash Course stresses that the ideal learning rate is problem-dependent, so there's no universal default to copy. It also moves when other settings change: the Tuning Playbook lists the learning rate among the hyperparameters that interact most with batch size, and says changing the batch size typically means tuning again from scratch. Feature scale matters too; the scikit-learn guide notes SGD is sensitive to it, which is why both scripts standardize first.

Learning rateLoss curveIn the first scriptWhat to do
Too smallFalls slowly and steadily0.0001: 184 epochs, MSE 2879Try 10 times larger
About rightFalls fast, then flattens0.001: 21 epochs, MSE 2879Keep it, consider a schedule
Too bigDrops, then bounces at a higher level0.1: 9 epochs, MSE 4624Lower it, or let it decay
Far too bigClimbs or explodes1.0: 6 epochs, MSE about 10²⁵Lower it a lot, check feature scaling

How to apply it in your project

  1. Scale your features firstPut StandardScaler before any gradient-based model in a pipeline, so one learning rate suits every feature.
  2. Compare loss, not epochsWhen you change the learning rate, compare the final training and validation loss. A run that stops sooner may simply have stopped improving.
  3. Sweep, then refineSearch on a log scale, pick the best region, then try a few values in between. Keep the sweep's loss curves in your experiment notes.
  4. Use a scheduleIn scikit-learn, try learning_rate="adaptive" with SGDRegressor or SGDClassifier. In deep learning, the Playbook suggests a warmup, which ramps the learning rate up from 0, when training is unstable early on.
  5. Retune after big changesA new batch size, optimizer or feature set can move the best learning rate. Rerun the sweep instead of reusing an old value.

Key takeaways

  • The learning rate multiplies every step; it changes where training goes, not just how fast.
  • Below the best value, raising it speeds training up; above it, the loss bounces or explodes.
  • Fewer epochs can mean the run stopped improving, not that it converged; compare final loss.
  • Find it with a log-scale sweep, use a schedule, and retune when batch size or features change.

📚 المصادر

  1. Linear regression: Hyperparameters — Google Machine Learning Crash Course
  2. Linear regression: Gradient descent — Google Machine Learning Crash Course
  3. Deep Learning Tuning Playbook: FAQs — Google for Developers
  4. Deep Learning Tuning Playbook: Guide for starting a new project — Google for Developers
  5. Stochastic Gradient Descent — scikit-learn User Guide

التعليقات (0)