Back to the topic

AI · 5.2

Gradient Descent: How Models Learn by Rolling Downhill

Section A: 10 multiple choice questions, 10 marks. Section B: 3 written questions, 12 marks. Total 22 marks.

Name

Class

Date

Mark  / 22

Section A

Circle the letter of the correct answer. One mark each.

  1. 1What is the gradient descent update for a parameter?1
    1. Aparameter ← learning rate − gradient
    2. Bparameter ← parameter − learning rate × gradient
    3. Cparameter ← parameter + learning rate × gradient
    4. Dparameter ← gradient ÷ learning rate
  2. 2What happens if the learning rate is far too large?1
    1. AThe model stops using its training data altogether
    2. BTraining becomes slow but always reaches the minimum
    3. CThe gradients all become exactly zero at once
    4. DSteps overshoot the minimum and the loss bounces or explodes
  3. 3A dataset has 60,000 examples and the batch size is 200. How many steps make one epoch?1
    1. A200
    2. B300
    3. C60,000
    4. D12,000,000
  4. 4Which is a hyperparameter?1
    1. AThe gradient of the loss
    2. BA bias inside the model
    3. CThe learning rate
    4. DA weight inside the model
  5. 5Training loss keeps falling but validation loss has started rising. What is happening?1
    1. AThe data has been scaled twice
    2. BThe learning rate is too small
    3. CThe model is underfitting
    4. DThe model is starting to overfit
  6. 6What is a saddle point?1
    1. AA flat point that is low in some directions and high in others
    2. BThe place on the landscape where training always starts
    3. CThe lowest point anywhere in the whole loss landscape
    4. DA point where the loss becomes infinitely large
  7. 7Why does mini-batch gradient descent use random batches rather than the whole dataset?1
    1. AThe whole dataset cannot be stored on any computer
    2. BRandom batches guarantee the global minimum is found
    3. CEach step is far cheaper, and the noise can help training
    4. DUsing every example would give the wrong gradient
  8. 8How does momentum help in a long narrow ravine?1
    1. AZigzags across the ravine cancel while progress along it builds up
    2. BIt makes the learning rate larger every step
    3. CIt recalculates the gradient on the whole dataset
    4. DIt stops the model from overfitting the data
  9. 9What does Adam add to momentum?1
    1. AA second, larger learning rate for the bias
    2. BA way to find the exact minimum in one step
    3. CLabels for data that has none
    4. DA separately adapted step size for every parameter
  10. 10Two balls start at different points on the same loss landscape. Why might they end in different places?1
    1. AOnly one can use the training data
    2. BOne of them has a different loss function
    3. CThey can roll into different valleys
    4. DGradient descent is completely random

Section B

Answer in the space provided. The number of marks tells you how many separate points to make.

  1. 1DescribeDescribe the gradient descent algorithm.4
  2. 2ExplainExplain the effect of choosing a learning rate that is too small and one that is too large.4
  3. 3ExplainA model's training loss falls steadily, while its validation loss falls until epoch 20 and then rises. Explain what is happening and what the engineer should do.4

Mark scheme

Section A

1B2D3B4C5D6A7C8A9D10C

Section B

1 Describe the gradient descent algorithm. 4

One mark for each of the following, to a maximum of 4.

  • Start with random or initial values for the parameters
  • Calculate the gradient of the loss
  • Update each parameter by subtracting learning rate × gradient
  • Repeat until the loss stops decreasing / converges

Model answer. Gradient descent starts with random or initial values for the parameters. It calculates the loss on the training data and the gradient of the loss with respect to each parameter. It then updates every parameter by subtracting the learning rate multiplied by its gradient, a small step downhill. These steps are repeated until the loss stops decreasing, when the parameters have converged near a minimum.

2 Explain the effect of choosing a learning rate that is too small and one that is too large. 4

One mark for each of the following, to a maximum of 4.

  • Too small: very small steps
  • So training is very slow / may not reach the minimum in time
  • Too large: steps overshoot the minimum
  • So the loss oscillates or diverges / explodes

Model answer. If the learning rate is too small, every step is tiny, so training is very slow and may run out of time before reaching the minimum. If it is too large, each step overshoots the minimum and lands on the other side of the valley, so the loss oscillates and can even increase every step until it diverges, or explodes, to enormous values.

3 A model's training loss falls steadily, while its validation loss falls until epoch 20 and then rises. Explain what is happening and what the engineer should do. 4

One mark for each of the following, to a maximum of 4.

  • Up to epoch 20 the model learns patterns that generalise
  • After epoch 20 it is overfitting / memorising the training data
  • Use early stopping
  • Keep the parameters from epoch 20, the lowest validation loss

Model answer. Until epoch 20 both losses fall, so the model is learning patterns that generalise to new data. After that the validation loss rises while the training loss keeps falling, which means the model is overfitting: memorising the training examples, including their noise. The engineer should use early stopping, keeping the parameters saved at epoch 20, where the validation loss was lowest, and could also add regularisation or more data.