DeepLLM Quiz
Deep Learning

Why gradients? How batch gradient descent updates a network

10 questions on why gradient information makes training affordable, the update rule, the learning rate, steepest descent and batch methods.

  • 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

    A search that uses only error values needs on the order of the number of weights cubed in total work, while a search that also uses gradients needs about the number of weights squared. A model grows from 1,000 to 10,000 weights. Roughly how does the work grow in each case?

    • About 1,000 times without gradients and 100 times with gradients
    • About 10 times without gradients and 10 times with gradients
    • About 100 times without gradients and 1,000 times with gradients

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

Picture a sound engineer with a mixing desk that has ten thousand dials and a single meter that reads how bad the sound is. If the only thing she can do is nudge one dial and look at the meter, she will be there for a very long time. Now give her a second gadget that, at every setting, reports for every dial which way to turn it and how strongly. Suddenly the job becomes realistic. That second gadget is the gradient, and it is the reason networks with millions of weights can be trained at all.

This quiz covers the first, simplest way of using it. You will see why gradient information changes the cost of finding a good set of weights from something enormous to something merely large, and what makes each gradient affordable to compute. Then you will look at the update rule itself: take a small step against the gradient, recompute, and repeat. The questions ask what each piece of that rule does, what the learning rate controls, and why the method has two familiar names.

The second half is about the word batch. In the basic method, the error is defined over the whole training set, so every single step needs a pass over every example. That is easy to state and surprisingly easy to misjudge in practice, so the questions give you data sets of different sizes and ask what happens to the cost of a step and to the number of updates you can afford in a given time.

Several habits of thought get tested. One is to compare methods by counting how many numbers each evaluation gives you, which is a more useful measure than raw speed. Another is to keep apart the direction of a step, which comes from the gradient, and its length, which is partly under your control. A third is to notice that a method can be perfectly correct and still be impractical when the data grows. Nearly every training method used for deep networks, however sophisticated its name, is a refinement of the loop you will meet here: measure the slope, step, measure again. If that loop is clear in your mind, momentum, adaptive learning rates and mini-batches become small, understandable modifications instead of a list of recipes to memorise.

The quiz suits learners who know that training means reducing an error by adjusting weights and now want to see the mechanism clearly. No algebra is required, only comfort with ideas such as direction, step size and repetition. 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. An explanation follows each answer, whether you got it right or not.

›Do I need to know how backpropagation works?

No. All you need is the fact that backpropagation is an efficient way of computing the gradient. Its inner workings have their own quiz, so here it appears only as a tool whose cost matters. You should also be comfortable with the idea that a network has many adjustable weights and that training tries to reduce one number, the error, by changing them.

›What is gradient descent?

It is an iterative method for lowering an error function. Starting from some initial weights, you compute the gradient, which points in the direction of fastest increase, move a small distance the opposite way, and then do it again at the new position. Each repetition should reduce the error a little, and the process stops when progress becomes negligible or the budget runs out.

›What does the learning rate do?

It scales the step. The gradient supplies a direction and a magnitude, and the learning rate decides how much of that is used. It must be positive so that the step goes downhill. If it is tiny, training crawls, and if it is too big, the steps can overshoot the valley and make things worse, which is why its value matters so much in practice.

›Why is gradient information so valuable compared with just trying weights?

An evaluation of the error alone returns one number, the height at one place. An evaluation of the gradient returns a number for every weight, telling you how the error responds to each of them at that place. With a model of any size, that difference means you learn about the surface far faster. Efficient gradient computation then makes each of those evaluations only modestly more expensive.

›What is the difference between gradient descent and steepest descent?

In this setting they are two names for the same basic method. The negative gradient is the direction in which the error falls fastest for a very small step, so moving along it is the steepest descent. The names emphasise different things: one the quantity being followed, the other the property of the direction. They are not two different algorithms.

›What is a batch method?

A batch method uses the entire training set to compute each update. That gives the exact gradient of the error as defined over all the data, with no randomness. The price is that every step costs a full pass over the data, which becomes a serious burden as data sets grow into the millions of examples, and it is the motivation for the cheaper variants that use only part of the data.

›Does a smaller step always make gradient descent safer?

A smaller step reduces the risk of overshooting, but it makes progress slower, and with a cost per step proportional to the data size it can become impractically slow. The sensible aim is a step that is as large as the surface allows without becoming unstable, and later quizzes show how momentum, schedules and adaptive methods help with that balance.

More quizzes