Training Deep Networks
Difficulty: Level 2 (Recall: definitions, standard textbook problems, short derivations) Time Limit: 30 minutes Total Marks: 40
Q1. Define stochastic gradient descent (SGD) and state how it differs from full-batch gradient descent in terms of the data used per update. (3 marks)
Q2. A dataset has training examples. Using a mini-batch size of , how many parameter updates (iterations) occur in one epoch? How many updates occur after epochs? (4 marks)
Q3. Write the update equations for classical (heavy-ball) momentum, defining every symbol. State one practical benefit of momentum over plain SGD. (5 marks)
Q4. For AdaGrad, the per-parameter update is where . Explain in one or two sentences why AdaGrad's learning rate decreases over time, and state how RMSprop fixes this problem. (5 marks)
Q5. Adam maintains biased first and second moment estimates and . Given , a gradient sequence with (after the first update, ), compute the bias-corrected first moment . Show the formula and the numeric value. (4 marks)
Q6. State the formula for batch normalization of an activation over a mini-batch (including the learnable scale and shift). Name one key difference between batch normalization and layer normalization. (5 marks)
Q7. Explain dropout as a regularization technique. If dropout keeps a unit with probability , what scaling is applied to the retained activations at training time under inverted dropout? (4 marks)
Q8. Define L2 weight decay. Write the modified loss function with regularization strength , and give the resulting gradient contribution added to . (4 marks)
Q9. Describe gradient clipping by norm. If the gradient vector has L2 norm and the clipping threshold is , write the rescaled gradient. (3 marks)
Q10. State what early stopping is and name the quantity typically monitored to decide when to stop. (3 marks)
End of paper
Answer keyMark scheme & solutions
Q1. (3 marks)
- SGD updates parameters using the gradient computed from a single training example (or one sample) per step rather than the whole dataset. (1)
- Update: . (1)
- Difference: full-batch uses all examples per update (one update per epoch, smooth but costly); SGD uses one example, giving noisy but frequent/cheaper updates. (1)
Q2. (4 marks)
- Updates per epoch . (2)
- After 8 epochs updates. (2) Why: one epoch = one full pass; number of mini-batches = examples ÷ batch size.
Q3. (5 marks)
- Velocity update: (or with subtraction below). (2)
- Parameter update: (or in the alternate sign convention). (1)
- Symbols: = momentum coefficient (typically 0.9), = learning rate, = gradient at step , = velocity/accumulated update. (1)
- Benefit: accelerates in consistent-gradient directions and dampens oscillations in high-curvature directions → faster convergence. (1)
Q4. (5 marks)
- is a running sum of squared gradients, so it is non-decreasing; the denominator grows over time. (2)
- Hence the effective learning rate shrinks monotonically, eventually becoming too small to learn. (1)
- RMSprop replaces the cumulative sum with an exponentially decaying moving average: . (1)
- This prevents unbounded growth, keeping the effective learning rate from vanishing. (1)
Q5. (4 marks)
- Bias-correction formula: . (2)
- At : . (2)
Q6. (5 marks)
- Batch statistics: , . (1)
- Normalize: . (2)
- Scale & shift: , with learnable . (1)
- Difference: BatchNorm normalizes across the batch dimension (per feature), while LayerNorm normalizes across features within a single example (batch-independent). (1)
Q7. (4 marks)
- Dropout randomly deactivates (zeros) units with some probability during training, forcing the network not to rely on specific neurons → reduces co-adaptation/overfitting. (2)
- With keep probability , inverted dropout scales retained activations by so expected activation is preserved and no scaling is needed at test time. (2)
Q8. (4 marks)
- L2 weight decay adds a penalty proportional to the squared magnitude of weights. (1)
- Loss: (or ). (2)
- Gradient contribution: . (1)
Q9. (3 marks)
- Gradient clipping by norm rescales if : (leave unchanged otherwise). (1)
- Here , so rescaled . (2)
Q10. (3 marks)
- Early stopping halts training when performance on a validation set stops improving (before overfitting sets in), typically restoring best-so-far weights. (2)
- Monitored quantity: validation loss (or validation error/accuracy). (1)
[
{"claim": "One epoch has 200 updates and 8 epochs have 1600 updates", "code": "N=50000; b=250; per_epoch=N//b; total=per_epoch*8; result = (per_epoch==200 and total==1600)"},
{"claim": "Adam bias-corrected first moment at t=1 with beta1=0.9, m1=0.2 equals 2.0", "code": "beta1=Rational(9,10); m1=Rational(1,5); mhat=m1/(1-beta1**1); result = (mhat==2)"},
{"claim": "Inverted dropout scaling with p=0.8 is 1.25", "code": "p=Rational(4,5); scale=1/p; result = (scale==Rational(5,4))"},
{"claim": "Gradient clip: norm 10 with threshold 4 gives factor 0.4", "code": "g_norm=10; c=4; factor=Rational(c,g_norm); result = (factor==Rational(2,5))"}
]