TExcelTAD
Home › Optimization › The Wolfe Conditions

The Wolfe Conditions

The Armijo condition stops steps from being too long. It does nothing about steps that are too short, and some methods need that protection: quasi-Newton updates learn curvature from the step, and a tiny step teaches them nothing. The Wolfe conditions add a curvature requirement.

The two conditions

For a descent direction d\mathbf{d} and ϕ(t)=f(x+td)\phi(t) = f(\mathbf{x} + t\mathbf{d}), a step tt satisfies the Wolfe conditions with 0<c1<c2<10 < c_1 < c_2 < 1 if

ϕ(t)≤ϕ(0)+c1t ϕ′(0)sufficient decrease (Armijo)ϕ′(t)≥c2 ϕ′(0)curvature\begin{aligned} \phi(t) &\le \phi(0) + c_1t\,\phi'(0) && \text{sufficient decrease (Armijo)} \\ \phi'(t) &\ge c_2\,\phi'(0) && \text{curvature} \end{aligned}

The curvature condition says the slope at the new point must be less steep than c2c_2 times the starting slope: if the function is still dropping steeply, you should have gone further. The strong Wolfe conditions use ∣ϕ′(t)∣≤c2∣ϕ′(0)∣\lvert \phi'(t) \rvert \le c_2\lvert \phi'(0) \rvert, which also rules out points far past a minimum of ϕ\phi. Typical values: c1=10−4c_1 = 10^{-4}, and c2=0.9c_2 = 0.9 for Newton and quasi-Newton or 0.10.1 for nonlinear conjugate gradient.

Mapping the acceptable steps

python · try it yourself
import numpy as np

f = lambda p: (1 - p[0])**2 + 100 * (p[1] - p[0]**2)**2
grad = lambda p: np.array([-2 * (1 - p[0]) - 400 * p[0] * (p[1] - p[0]**2), 200 * (p[1] - p[0]**2)])
x = np.array([0.0, 0.0]); d = -grad(x)                     # steepest descent from the origin
phi = lambda t: f(x + t * d)
dphi = lambda t: grad(x + t * d) @ d
c1, c2 = 1e-4, 0.9
ts = np.linspace(0.0005, 0.6, 1200)
armijo = np.array([phi(t) <= phi(0) + c1 * t * dphi(0) for t in ts])
curv = np.array([dphi(t) >= c2 * dphi(0) for t in ts])
strong = np.array([abs(dphi(t)) <= c2 * abs(dphi(0)) for t in ts])
both = armijo & curv
print("Armijo holds up to t =", round(float(ts[armijo].max()), 4))
print("curvature holds from t =", round(float(ts[curv].min()), 4))
print("Wolfe interval:", round(float(ts[both].min()), 4), "to", round(float(ts[both].max()), 4))
print("strong Wolfe steps found:", int((armijo & strong).sum()), "of", len(ts))
Armijo holds up to t = 0.1295
curvature holds from t = 0.0295
Wolfe interval: 0.0295 to 0.1295
strong Wolfe steps found: 145 of 1200

Why the curvature condition matters for BFGS

Quasi-Newton methods update a Hessian approximation from the pair s=xk+1−xk\mathbf{s} = \mathbf{x}_{k+1} - \mathbf{x}_k and y=∇fk+1−∇fk\mathbf{y} = \nabla f_{k+1} - \nabla f_k. The update keeps the approximation positive definite only if sTy>0\mathbf{s}^T\mathbf{y} > 0. The curvature condition gives exactly that:

sTy=t(ϕ′(t)−ϕ′(0))≥t (c2−1) ϕ′(0)>0\mathbf{s}^T\mathbf{y} = t\left(\phi'(t) - \phi'(0)\right) \ge t\,(c_2 - 1)\,\phi'(0) > 0

since ϕ′(0)<0\phi'(0) < 0 and c2<1c_2 < 1. A Wolfe line search therefore keeps BFGS well defined on any function, convex or not.

Existence

If ff is smooth and bounded below along the ray, steps satisfying the (strong) Wolfe conditions always exist. Algorithms find one with a bracketing and zoom procedure: expand tt until an interval is known to contain acceptable steps, then shrink it by interpolation.

python · try it yourself
import numpy as np
from scipy.optimize import line_search

f = lambda p: (1 - p[0])**2 + 100 * (p[1] - p[0]**2)**2
grad = lambda p: np.array([-2 * (1 - p[0]) - 400 * p[0] * (p[1] - p[0]**2), 200 * (p[1] - p[0]**2)])
x = np.array([0.0, 0.0]); d = -grad(x)
t, fc, gc, new_f, old_f, _ = line_search(f, grad, x, d, c1=1e-4, c2=0.9)
print(f"SciPy strong-Wolfe step: t = {t:.4f}, f: {old_f:.4f} -> {new_f:.4f}, {fc} function evaluations")
SciPy strong-Wolfe step: t = 0.0868, f: 1.0000 -> 0.7737, 6 function evaluations

Zoutendijk's theorem in one line

With Wolfe steps and directions not too close to perpendicular to the gradient (cos⁡θk≥δ>0\cos\theta_k \ge \delta > 0), the gradients must go to zero: ∥∇f(xk)∥→0\lVert \nabla f(\mathbf{x}_k) \rVert \to 0. This is the global convergence guarantee behind every line-search method in this part.

In software

  • scipy.optimize.line_search and the line searches inside minimize(method="BFGS") and "CG" enforce the strong Wolfe conditions.
  • L-BFGS in PyTorch (torch.optim.LBFGS(line_search_fn="strong_wolfe")) offers the same option.

Exercises

Exercise 1: Check the conditions

For ϕ(t)=(t−1)2\phi(t) = (t - 1)^2 (so ϕ′(0)=−2\phi'(0) = -2), c1=0.1c_1 = 0.1, c2=0.5c_2 = 0.5, does t=0.2t = 0.2 satisfy Wolfe? t=0.8t = 0.8?

Answer

t=0.2t = 0.2 fails the curvature condition; t=0.8t = 0.8 satisfies both.

Solution

Curvature needs ϕ′(t)=2(t−1)≥−1\phi'(t) = 2(t - 1) \ge -1, i.e. t≥0.5t \ge 0.5. Armijo needs (t−1)2≤1−0.2t(t - 1)^2 \le 1 - 0.2t, i.e. t2−1.8t≤0t^2 - 1.8t \le 0, true for 0≤t≤1.80 \le t \le 1.8. So t=0.8t = 0.8 passes both, t=0.2t = 0.2 fails curvature.

Exercise 2: Why c1<c2c_1 < c_2?

What could go wrong if c1>c2c_1 > c_2?

Answer

There might be no step satisfying both conditions.

Solution

For a quadratic ϕ\phi with minimum at t∗t^*, Armijo holds for t≤2(1−c1)t∗t \le 2(1 - c_1)t^* and curvature for t≥(1−c2)t∗t \ge (1 - c_2)t^*. The interval [(1−c2)t∗, 2(1−c1)t∗][(1 - c_2)t^*,\ 2(1 - c_1)t^*] is non-empty when c1<c2c_1 < c_2 (and c1<12c_1 < \frac{1}{2} is enough to keep t∗t^* itself acceptable); with c1c_1 close to 1 and c2c_2 small, it can be empty.

Exercise 3: sTy\mathbf{s}^T\mathbf{y} is positive (code)

Take the SciPy Wolfe step from the origin of Rosenbrock and compute sTy\mathbf{s}^T\mathbf{y}.

Answer

It is positive.

Solution
python · try it yourself
import numpy as np
from scipy.optimize import line_search
f = lambda p: (1 - p[0])**2 + 100 * (p[1] - p[0]**2)**2
grad = lambda p: np.array([-2 * (1 - p[0]) - 400 * p[0] * (p[1] - p[0]**2), 200 * (p[1] - p[0]**2)])
x = np.zeros(2); d = -grad(x)
t = line_search(f, grad, x, d)[0]
s = t * d; y = grad(x + s) - grad(x)
print(f"s^T y = {s @ y:.6f} > 0: {s @ y > 0}")
s^T y = 0.423083 > 0: True

Test yourself

The curvature condition ϕ′(t)≥c2ϕ′(0)\phi'(t) \ge c_2\phi'(0) prevents steps that are…

  1. too long
  2. too short
  3. negative
  4. exactly optimal

For quasi-Newton methods, the Wolfe conditions guarantee…

  1. sTy>0\mathbf{s}^T\mathbf{y} > 0, keeping the Hessian approximation positive definite
  2. a convex function
  3. an exact line search
  4. a step of length 1

Typical Wolfe parameters for BFGS are…

  1. c1=0.9c_1 = 0.9, c2=10−4c_2 = 10^{-4}
  2. c1=10−4c_1 = 10^{-4}, c2=0.9c_2 = 0.9
  3. c1=c2=0.5c_1 = c_2 = 0.5
  4. c1=1c_1 = 1, c2=0c_2 = 0