How does L-BFGS approximate the Hessian without storing the full matrix?

Quick Overview

Asks how the L-BFGS optimizer gets curvature information without ever storing the full Hessian matrix. Tests knowledge of curvature pairs, the secant condition, the two-loop recursion, memory cost and the line search conditions that keep the method stable.

How does L-BFGS approximate the Hessian without storing the full matrix?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: hard

Interview Round: Other

How does `L-BFGS` approximate the Hessian without storing the full matrix? Newton-type methods use curvature information, and for a model with $n$ parameters the Hessian has $n^2$ entries. Explain what L-BFGS keeps in memory instead and how it turns that into a search direction. ```hint What the history tells you Look at the differences between successive iterates and between successive gradients. What relation should those two vectors satisfy under a quadratic model of the function? ``` ```hint Apply instead of store The optimizer never needs the matrix itself, only its product with the current gradient. Think about how a short chain of low-rank updates can be applied to a vector one at a time. ``` ```hint Keep it a descent direction Ask what condition on each stored pair keeps the implied matrix positive definite, and which part of the algorithm enforces it. ``` ### What a Strong Answer Covers - What L-BFGS stores (the last m pairs of iterate differences and gradient differences) and the secant condition those pairs encode - How the BFGS update is replayed implicitly from a scaled identity, and how the two-loop recursion produces the inverse-Hessian-times-gradient product - Memory and time cost compared with full BFGS and Newton's method - What keeps the approximation positive definite and the role of the line search - Practical limits such as the choice of m, noisy gradients and nonsmooth objectives ### Follow-up Questions - What goes wrong if you run L-BFGS on small minibatch gradients, and how do stochastic variants deal with it? - Why is the initial matrix scaled by $s^\top y / y^\top y$, and what happens with the plain identity? - How would you handle an L1-regularized objective, where the gradient is undefined at zero? - On a nonconvex problem, what do you do when a new pair has $s^\top y \le 0$?

Overview: Asks how the L-BFGS optimizer gets curvature information without ever storing the full Hessian matrix. Tests knowledge of curvature pairs, the secant condition, the two-loop recursion, memory cost and the line search conditions that keep the method stable.

General logo
General
Nov 25, 2026
hardMachine Learning EngineerOtherMachine Learning
0
0

How does L-BFGS approximate the Hessian without storing the full matrix?

Newton-type methods use curvature information, and for a model with nn parameters the Hessian has n2n^2 entries. Explain what L-BFGS keeps in memory instead and how it turns that into a search direction.

What a Strong Answer Covers Guidance

  • What L-BFGS stores (the last m pairs of iterate differences and gradient differences) and the secant condition those pairs encode
  • How the BFGS update is replayed implicitly from a scaled identity, and how the two-loop recursion produces the inverse-Hessian-times-gradient product
  • Memory and time cost compared with full BFGS and Newton's method
  • What keeps the approximation positive definite and the role of the line search
  • Practical limits such as the choice of m, noisy gradients and nonsmooth objectives

Follow-up Questions Guidance

  • What goes wrong if you run L-BFGS on small minibatch gradients, and how do stochastic variants deal with it?
  • Why is the initial matrix scaled by s⊤y/y⊤ys^\top y / y^\top y , and what happens with the plain identity?
  • How would you handle an L1-regularized objective, where the gradient is undefined at zero?
  • On a nonconvex problem, what do you do when a new pair has s⊤y≤0s^\top y \le 0 ?