DeepLLM Quiz
Deep Learning

Why gradient descent zig-zags: learning rate, valleys and the condition number

10 questions on narrow valleys, oscillation, divergence, the largest stable learning rate and the condition number. With explanations.

  • 10 questions
  • Stopwatch
  • Instant feedback

Shown publicly with your score. Don’t use your full real name.

Sample questions

Play now ↑

Answers stay hidden. Start the quiz to play them.

  1. Sample 1

    Along one direction, every step multiplies the remaining distance to the minimum by 1 minus (learning rate times curvature). The learning rate is 0.1, the curvature is 5 and the distance is 8. What is the distance after 3 steps?

    • 1
    • 4
    • 0, since it converges at once
  2. Sample 2

    Convergence along a direction requires the factor 1 minus (learning rate times curvature) to have size below one. The steepest direction has curvature 10. Which learning rate is the largest that is still stable?

    • Any value below 20
    • Anything below 0.2
    • Any value below 2

How it works

  • One question per screen. An answer is final once sent.
  • You see right away whether you were right, with a short explanation.
  • The stopwatch runs: on equal scores, the faster player ranks first.
  • Only your best attempt counts, so replaying is never risky.

About this quiz

Every practitioner has seen the learning curve that jitters up and down, or the training run whose error suddenly turns into not-a-number. The usual advice is to lower the learning rate and try again. This quiz explains why that advice works, and why it comes at a price. The explanation is a story about the shape of the error surface near a minimum, and it is one of the cleanest pieces of theory in deep learning.

Imagine a long, narrow canyon. Walls on both sides are steep, and the canyon floor slopes very gently towards the exit. A walker who always steps in the steepest downhill direction bounces from wall to wall, because the steepest direction points across the canyon, not along it. Make the steps longer and the bouncing grows until the walker is thrown out. Make them shorter and the bouncing stops, but progress along the floor becomes a crawl. That is the dilemma at the heart of gradient descent.

The quiz turns this picture into practice. You will work out what happens to the distance from the minimum along each direction at every step, and see that it is multiplied by a factor that depends on the learning rate and on the curvature. You will find out when that factor means steady shrinking, when it means shrinking with a sign flip, and when it means runaway growth. You will see which direction limits how large the step can be, and which direction limits how fast you can go. And you will meet the condition number, the single figure that tells you how stretched the canyon is.

Common misunderstandings are worth naming. Many people expect a larger learning rate to give faster convergence, which is true only up to a limit. Others think oscillation always signals failure, although some oscillation is harmless and even unavoidable. And it is easy to forget that the steepest direction sets the speed limit while the gentlest one sets the pace.

The quiz suits learners who have met gradient descent and want to understand its behaviour, and practitioners who tune learning rates by trial. It includes a few short calculations with friendly numbers, no more than you can do in your head. Working through them once makes the abstract talk of learning rates concrete, and many learners find that the numbers explain, in a few lines, behaviour that looked mysterious on a loss plot. The same reasoning also tells you what the later remedies, from momentum to input scaling, are meant to repair. There are 10 questions with explanations, and it takes about four minutes.

Questions and answers

›How long does the quiz take?

About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. Each answer is followed by an explanation, including the arithmetic where a question uses numbers.

›Do I need to be good at maths?

No. A few questions use small numbers, and the rule you need is given in the question itself. If you can multiply and subtract simple decimals, you can do every calculation. The rest is about picturing a narrow valley. If you have not met the idea of curvature, the quiz on the Hessian and the local quadratic picture is a good warm-up, though not a requirement.

›Why doesn't the gradient point straight at the minimum?

The gradient is perpendicular to the contour line through the current point. When the contours are circles, that means pointing at the centre. When they are long ellipses, the perpendicular direction mostly points across the narrow way, not along the long one. So the best local direction and the best global direction can differ a lot, and only on the axes of the valley do they agree.

›What does it mean for gradient descent to diverge?

It means the weights move further from the minimum with every step, not closer. The error grows, often quickly, until numbers overflow. It happens when the steps are large enough that each one overshoots the valley floor by more than the distance it started from. Lowering the learning rate is the usual cure.

›What is the condition number?

It is the ratio of the largest curvature to the smallest, measured around a minimum. If the curvatures are similar, the number is close to one and the contours are round. If one direction is far steeper than another, the number is large and the contours are long ellipses. A large condition number is the technical name for a hard-to-descend valley.

›Why does the steepest direction limit the learning rate?

Because the learning rate has to be small enough to be stable in every direction, and stability is hardest to achieve where the surface bends most sharply. A step that is gentle on a shallow slope can overshoot wildly across a steep one. So the sharpest curvature sets an upper limit for the whole procedure, and the other directions have to live with it.

›Why is convergence called linear?

Near a minimum, each step reduces the remaining distance by a fixed fraction, so the distance falls like a geometric series. On a graph with a logarithmic error axis this looks like a straight line. It is steady, but not fast: halving the distance every step is good, whereas cutting it by one per cent per step takes hundreds of steps.

›Can I fix a badly conditioned problem?

You can reduce its effects. Rescaling the inputs changes the shape of the surface, and methods such as momentum and adaptive learning rates are designed to cope with uneven curvature. Each is covered in its own quiz, and each can be understood as an answer to the dilemma described here.

More quizzes