Gradient descent and optimization
Explore how parameter updates change the loss landscape.
Tune learning rates with validation experiments and track optimizer stability.
Interview questions
Choose a question to reveal its answer.
01EasyCoreWhat information does a loss gradient provide?
Answer
What information does a loss gradient provide?
Vector of partial derivatives pointing toward steepest local increase under the Euclidean norm.
Calculate derivatives of a loss with respect to every weight.
02EasyCoreVisualWhat happens if the learning rate is too high?
Answer
What happens if the learning rate is too high?
Scalar controlling the size of an optimizer update.
Choose a small step to avoid overshooting a minimum.
w, lr = -3.0, 0.2
for _ in range(7):
w -= lr * 2*w
print(w, w*w)The update minimizes f(w)=w² for 0 < lr < 1.
03EasyCoreHow does full-batch gradient descent work?
Answer
How does full-batch gradient descent work?
Computes gradients using the whole training dataset per update.
Use every observation to calculate a single parameter step.
04MediumHigh priorityHow does stochastic gradient descent differ from full-batch training?
Answer
How does stochastic gradient descent differ from full-batch training?
Uses a single random example per step in the strict definition; minibatch variants use small batches.
Update frequently from a sampled observation.
05MediumHigh priorityWhy train with mini-batches?
Answer
Why train with mini-batches?
Subset of training observations used to estimate a gradient.
Process 32 samples before updating the network.
06MediumHow does momentum reduce oscillations?
Answer
How does momentum reduce oscillations?
Accumulates gradient information across steps to smooth updates.
Reduce zigzag movement across a narrow valley.
07MediumHow does Adam use gradient moments?
Answer
How does Adam use gradient moments?
Uses bias-corrected moving moments of gradients and squared gradients.
Adapt update scales to different parameters.
08MediumIs weight decay always equivalent to L2 regularization?
Answer
Is weight decay always equivalent to L2 regularization?
Shrinks parameters during optimization; decoupled decay is not identical to L2 regularization for adaptive optimizers.
Apply AdamW to a neural network.
09HardWhy use gradient clipping?
Answer
Why use gradient clipping?
Limits gradient magnitude according to a specified rule.
Prevent very large updates in recurrent models.
10HardWhy schedule the learning rate?
Answer
Why schedule the learning rate?
Changes step size over training according to a rule.
Warm up and then decay the optimizer step size.
Priority and difficulty are editorial study recommendations.
Technical reference: Documentation / paper ↗
Try a few practice questions
Explore the questions before creating a free account.
1. For f(w)=w², w=3 and learning rate 0.1, what is the next gradient descent parameter?
2. What can happen when the learning rate is excessively large?
3. What is gradient clipping intended to control?
RNN, LSTM and sequence learning
Continue to the next set of interview questions.