ArticleslgStudy

computer science

Limited-memory BFGS

Limited-memory BFGS is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Limited-memory BFGS rather than just read about it. In short: Limited-memory BFGS (L-BFGS or LM-BFGS) is an optimization algorithm in the collection of quasi-Newton methods that approximates the Broyden–Fletcher–Goldfarb–Shanno algorithm (BFGS) using a limited amount of computer memory. It is a popular algorithm for parameter estimation in machine learning.

Key takeaways

  • Limited-memory BFGS belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Limited-memory BFGS to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Limited-memory BFGS from memory before moving on to harder problems.

Reference excerpt

Limited-memory BFGS (L-BFGS or LM-BFGS) is an optimization algorithm in the collection of quasi-Newton methods that approximates the Broyden–Fletcher–Goldfarb–Shanno algorithm (BFGS) using a limited amount of computer memory. It is a popular algorithm for parameter estimation in machine learning. The algorithm's target problem is to minimize f(𝐱) over unconstrained values of the real-vector 𝐱 where f is a differentiable scalar function. Like the original BFGS, L-BFGS uses an estimate of the inverse Hessian matrix to steer its search through variable space, but where BFGS stores a dense n×n approximation to the inverse Hessian (n being the number of variables in the problem), L-BFGS stores only a few vectors that represent the approximation implicitly. Due to its resulting linear memory requirement, the L-BFGS method is particularly well suited for optimization problems with many variables. Instead of the inverse Hessian Hk, L-BFGS maintains a history of the past m updates of the position x and gradient ∇f(x), where generally the history size m can be small (often m<10). These updates are used to implicitly do operations requiring the Hk-vector product.

Algorithm The algorithm starts with an initial estimate of the optimal value, 𝐱0, and proceeds iteratively to refine that estimate with a sequence of better estimates 𝐱1,𝐱2,…. The derivatives of the function gk:=∇f(𝐱k) are used as a key driver of the algorithm to identify the direction of steepest descent, and also to form an estimate of the Hessian matrix (second derivative) of f(𝐱). L-BFGS shares many features with other quasi-Newton algorithms, but is very different in how the matrix-vector multiplication dk=−Hkgk is carried out, where dk is the approximate Newton's direction, gk is the current gradient, and Hk is the inverse of the Hessian matrix. There are multiple published approaches using a history of updates to form this direction vector. Here, we give a common approach, the so-called "two loop recursion." We take as given xk, the position at the k-th iteration, and gk≡∇f(xk) where f is the function being minimized, and all vectors are column vectors. We also assume that we have stored the last m updates of the form

sk=xk+1−xk yk=gk+1−gk. We define ρk=1yk⊤sk, and Hk0 will be the 'initial' approximate of the inverse Hessian that our estimate at iteration k begins with. The algorithm is based on the BFGS recursion for the inverse Hessian as

Hk+1=(I−ρkskyk⊤)Hk(I−ρkyksk⊤)+ρksksk⊤. For a fixed k we define a sequence of vectors qk−m,…,qk as qk:=gk and qi:=(I−ρiyisi⊤)qi+1. Then a recursive algorithm for calculating qi from qi+1 is to define αi:=ρisi⊤qi+1 and qi=qi+1−αiyi. We also define another sequence of vectors zk−m,…,zk as zi:=Hiqi. There is another recursive algorithm for calculating these vectors which is to define zk−m=Hk0qk−m and then recursively define βi:=ρiyi⊤zi and zi+1=zi+(αi−βi)si. The value of zk is then our ascent direction. Thus we can compute the descent direction as follows:

q=gk𝙵𝚘𝚛 i=k−1,k−2,…,k−mαi=ρisi⊤qq=q−αiyiγk=sk−m⊤yk−myk−m⊤yk−mHk0=γkIz=Hk0q𝙵𝚘𝚛 i=k−m,k−m+1,…,k−1βi=ρiyi⊤zz=z+si(αi−βi)z=−z This formulation gives the search direction for the minimization problem, i.e., z=−Hkgk. For maximization problems, one should thus take -z instead. Note that the initial approximate inverse Hessian Hk0 is chosen as a diagonal matrix or even a multiple of the identity matrix since this is numerically efficient. The scaling of the initial matrix γk ensures that the search direction is well scaled and therefore the unit step length is accepted in most iterations. A Wolfe line search is used to ensure that the curvature condition is satisfied and the BFGS updating is stable. Note that some software implementations use an Armijo backtracking line search, but cannot guarantee that the curvature condition yk⊤sk>0 will be satisfied by the chosen step since a step length greater than 1 may be needed to satisfy this condition. Some implementations address this by skipping the BFGS update when yk⊤sk is negative or too close to zero, but this approach is not generally recommended since the updates may be skipped too often to allow the Hessian approximation Hk to capture important curvature information. Some solvers employ so called damped (L)BFGS update which modifies quantities sk and yk in order to satisfy the curvature condition. The two-loop recursion formula is widely used by unconstrained optimizers due to its efficiency in multiplying by the inverse Hessian. However, it does not allow for the explicit formation of either the direct or inverse Hessian and is incompatible with non-box constraints. An alternative approach is the compact representation, which involves a low-rank representation for the direct and/or inverse Hessian. This represents the Hessian as a sum of a diagonal matrix and a low-rank update. Such a representation enables the use of L-BFGS in constrained settings, for example, as part of the SQP method.

Applications L-BFGS has been called "the algorithm of choice" for fitting log-linear (MaxEnt) models and conditional random fields with ℓ2-regularization.

Variants Since BFGS (and hence L-BFGS) is designed to minimize smooth functions without constraints, the L-BFGS algorithm must be modified to handle functions that include non-differentiable components or constraints. A popular class of modifications are called active-set methods, based on the concept of the active set. The idea is that when restricted to a small neighborhood of the current iterate, the function and constraints can be simplified.

L-BFGS-B The L-BFGS-B algorithm extends L-BFGS to handle simple box constraints (a.k.a. bound constraints) on variables; that is, constraints of the form li ≤ xi ≤ ui where li and ui are per-variable constant lower and upper bounds, respectively (for each xi, either or both bounds may be omitted). The method works by identifying fixed and free variables at every step (using a simple gradient method), and then using the L-BFGS method on the free variables only to get higher accuracy, and then repeating the process.

OWL-QN Orthant-wise limited-memory quasi-Newton (OWL-QN) is an L-BFGS variant for fitting ℓ1-regularized models, exploiting the inherent sparsity of such models. It minimizes functions of the form

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Limited-memory BFGS

Start with the simplest possible case. Write down what Limited-memory BFGS claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Limited-memory BFGS before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Limited-memory BFGS ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Limited-memory BFGS

In research
Limited-memory BFGS appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Limited-memory BFGS in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Limited-memory BFGS is common in secondary-school and first-year university syllabi. It links to neighbouring topics Optimization algorithms and methods, so understanding it makes those chapters shorter.
In everyday life
Look for Limited-memory BFGS outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Limited-memory BFGS” →

How to study Limited-memory BFGS in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Limited-memory BFGS means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Limited-memory BFGS out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Limited-memory BFGS in simple terms?

Limited-memory BFGS (L-BFGS or LM-BFGS) is an optimization algorithm in the collection of quasi-Newton methods that approximates the Broyden–Fletcher–Goldfarb–Shanno algorithm (BFGS) using a limited amount of computer memory. It is a popular algorithm for parameter estimation in machine learning.

Why does Limited-memory BFGS matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Limited-memory BFGS?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Limited-memory BFGS.

Tags

  • Optimization algorithms and methods

Keep exploring