Summary and Revision Notes

Key Ideas

IdeaMeaning
objectivequantity optimized by training
lossobjective usually minimized
metricnumber used to evaluate behavior, not always the training loss
gradient descentupdate opposite the gradient
mini-batchsmall sample used to estimate an update
learning ratescale of the update step
momentummemory of recent update direction
adaptive methodoptimizer that changes effective step sizes
convexityspecial case where local minima are global
regularizationadded preference or penalty
stability checkinspection for numerical training failure

The important habit is to keep the pieces separate. A loss is not the whole task. A gradient is not the whole landscape. A learning rate is not a direction. An optimizer choice is not evidence of generalization.

Formulas to Remember

Squared loss:

L=(yhaty)2L = (yhat - y)^2

Gradient descent:

wnew=wηL(w)w_{new} = w - \eta \nabla L(w)

Regularized objective:

objective=data loss+λpenaltyobjective = data\ loss + \lambda penalty

How To Read A Training Loop

When you see training code, identify these pieces:

  • the objective or loss being reduced
  • the data used for each update
  • the optimizer and update rule
  • the learning rate and schedule
  • any momentum or adaptive scaling
  • any regularization or penalty
  • stability checks such as loss, gradient norm, and update size

This turns a training loop from a black box into a set of choices.

Common Patterns

PatternMeaning
mini-batch trainingcheaper noisy estimate of the full gradient
learning-rate schedulelarger or smaller steps at different training stages
momentumsmooth recent directions
Adam/RMSProp/Adagradadapt effective step sizes from gradient history
weight decay or penaltiesprefer some parameter patterns over others
gradient norm checksdetect unstable updates

Common Traps

  • Optimizing a loss that does not match the desired behavior.
  • Moving with the gradient when minimizing.
  • Choosing a learning rate without checking loss behavior.
  • Treating adaptive optimizers as a substitute for understanding scale.
  • Assuming convex guarantees apply to most deep networks.
  • Treating regularization as a guarantee of generalization.
  • Ignoring validation and generalization.
  • Treating numerical failures as only modeling failures.
  • Treating NaN as a diagnosis instead of a symptom.
  • Forgetting that a useful local direction can become a bad finite step.
  • Assuming an adaptive optimizer removes the need to reason about scale.

Mental Model

Optimization is a loop: measure, compute direction, step, and check.