ML MATH & LINEAR ALGEBRA · INTERVIEW QUESTION
What are gradients, Jacobians, and Hessians? When do you use each in ML?
🟡 intermediate · Calculus & Optimization
Hint: First derivative vector, first derivative matrix, second derivative matrix.
Answer
Gradient (∇f): vector of partial derivatives of a scalar function f. Points in the direction of steepest ascent. Used in: gradient descent for optimizing loss functions. Jacobian (J): matrix of partial derivatives of a vector-valued function. J_{ij} = ∂f_i/∂x_j. Used in: backpropagation (chain rule with Jacobians), normalizing flows (determinant of Jacobian for density transformation). Hessian (H): matrix of second partial derivatives. H_{ij} = ∂²f/∂x_i∂x_j. Used in: Newton's method (x ← x - H⁻¹∇f for quadratic convergence), analyzing loss landscape curvature, natural gradient methods, understanding optimization difficulty (condition number of Hessian). Computing full Hessian is — approximations used in practice (L-BFGS, Fisher information matrix).
Related questions
- Derive the gradient of the cross-entropy loss for softmax output.
- What is the difference between convex and non-convex optimization? Why does it matter in deep learning?
- What is gradient descent? Explain the intuition behind it.
- What is the vanishing/exploding gradient problem? How do modern architectures solve it?
- Explain learning rate scheduling strategies. Which are most effective?