Step Size Seeders#
Introduction#
In Pyralysis, step size seeders (StepSizeSeeder) estimate an initial step size
\(\alpha_k\) before a Line Searchers refines it. Seeders use gradient history,
function values, or proximal residuals to provide a good starting point, which reduces
backtracking iterations and improves convergence.
Why seeders matter — illustrative paths on an ill-conditioned quadratic: (a) step too small (slow zig-zag); (b) step too large (oscillation); (c) seeded / near-optimal steps. Full discussion: Step size geometry: too short, too long, and why seeders help in Line Searchers.#
Step-size seeder hierarchy (StepSizeSeeder, Barzilai–Borwein family, and
interpolation seeders).#
Note
Seeders do not replace line search. They only supply the initial guess passed to
_get_initial_step_size().
See Line Searchers for Armijo, Brent, and related strategies.
Role in the optimization stack#
Each gradient-based optimizer (see Optimizers) calls a LineSearcher at every
iteration. When a seeder is attached to the line searcher, the workflow is:
Optimizer computes a search direction \(d_k\).
Seeder estimates \(\alpha_k^{(0)}\) from history.
Line searcher accepts or backtracks from \(\alpha_k^{(0)}\) until its conditions hold.
Barzilai–Borwein family#
All BB seeders inherit from BarzilaiBorwein and share two secant step estimates
computed from
where \(g_k = \nabla f(x_k)\) [Barzilai and Borwein, 1988].
Long step (BB1)
Short step (BB2)
On the first iteration (no history), all BB seeders return init_step (default 1.0).
Invalid denominators yield np.nan; selection logic then falls back to the other variant
or to min_step.
BarzilaiBorweinCyclic#
Class: BarzilaiBorweinCyclic
Cycles through BB1 and BB2 with configurable period cycle_length (default 4, must be
\(\geq 2\)). At cycle position iteration % cycle_length:
Even position: prefer BB1, fall back to BB2.
Odd position: prefer BB2, fall back to BB1.
Use when: you want explicit control over how often long vs short BB steps are tried;
default cycle_length=4 alternates two BB1 and two BB2 steps per cycle.
BarzilaiBorweinAlternating#
Class: BarzilaiBorweinAlternating
Backward-compatible alias for BarzilaiBorweinCyclic(cycle_length=2): odd iterations
prefer BB2, even iterations prefer BB1. Any cycle_length passed at construction is
ignored.
BarzilaiBorweinAdaptiveMin1 (ABBmin1)#
Class: BarzilaiBorweinAdaptiveMin1
Adaptive rule from Dai & Fletcher [Dai and Fletcher, 2005] using a sliding window of recent BB2 values:
Parameters: tau (default 0.8), window (default 10).
Use when: ill-conditioned problems where short BB steps become overly conservative.
BarzilaiBorweinAdaptiveMin2 (ABBmin2)#
Class: BarzilaiBorweinAdaptiveMin2
Simpler adaptive rule:
Parameters: tau (default 0.9).
Use when: well-conditioned problems with relatively stable step sizes.
BarzilaiBorweinRetarded#
Class: BarzilaiBorweinRetarded
Uses a delayed gradient difference instead of the standard one-step difference:
where \(s_k = x_k - x_{k-1}\) and m is delay (default 3). When
delay=1, this reduces to BB1 with the usual \(y_k = g_k - g_{k-1}\).
Falls back to init_step until the circular gradient buffer holds delay past
gradients. Only BB1 is selected (BB2 is computed but not used).
Use when: you want BB1 with a longer effective gradient memory; can help on noisy or slowly varying curvature landscapes.
ProximalBarzilaiBorwein#
Class: ProximalBarzilaiBorwein
Extends BarzilaiBorweinCyclic for proximal objectives (FISTA). Replaces
\(y\) with the proximal residual
and uses cyclic BB1/BB2 proximal formulas:
with \(\rho = 1 / \alpha_{k-1}\) from the previous accepted step.
Requirements: exactly 0 or 1 non-differentiable term in the objective. With no non-smooth term the proximal map is the identity and gradient-based BB seeders should be used instead.
Not compatible with SDMM when multiple non-smooth terms are split separately; use gradient-based BB seeders for the inner SDMM optimizer. See Compressed Sensing & Proximal Methods.
Interpolation seeders#
CubicInterpolationSeeder#
Class: CubicInterpolationSeeder
Fits a cubic polynomial along the previous search direction using \(f(x_{k-1})\), \(f(x_k)\), and gradients at both points, finds the minimizer \(\alpha_{\mathrm{opt}}\) along that direction, then scales to the current direction:
Use when: smooth objectives with varying curvature; more accurate than quadratic but needs reliable function and gradient history.
QuadraticInterpolationSeeder#
Class: QuadraticInterpolationSeeder
Same framework as the cubic seeder but with a quadratic fit (function value and gradients at endpoints of the previous step). Closed-form minimizer when the quadratic curvature coefficient is positive.
Use when: smoother, more stable alternative to cubic; good fallback when cubic interpolation fails numerically.
Selection guide#
Problem type |
Suggested seeder |
|---|---|
General smooth imaging |
|
Ill-conditioned |
|
Well-conditioned, stable |
|
Longer gradient memory |
|
FISTA / single prox term |
|
Strongly quadratic local behavior |
|
Cubic unstable |
|
Fixed / no history |
No seeder (line searcher default step) |
Implementation example#
from pyralysis.optimization.linesearch import (
BacktrackingArmijo,
BarzilaiBorweinCyclic,
BarzilaiBorweinRetarded,
ProximalBarzilaiBorwein,
CubicInterpolationSeeder,
)
# Gradient-based BB with 4-step cycle
seeder = BarzilaiBorweinCyclic(cycle_length=4, min_step=1e-10)
ls = BacktrackingArmijo(objective_function=of, seeder=seeder)
# Retarded BB1 with delay m=3
seeder = BarzilaiBorweinRetarded(delay=3, init_step=0.5)
# FISTA: attach ProximalBarzilaiBorwein to FISTABacktracking (see linesearchers)
from pyralysis.optimization.linesearch import FISTABacktracking
prox_seeder = ProximalBarzilaiBorwein(cycle_length=2)
fista_ls = FISTABacktracking(objective_function=of, seeder=prox_seeder)
References#
Jonathan Barzilai and Jonathan M. Borwein. Two-point step size gradient methods. IMA Journal of Numerical Analysis, 8(1):141–148, 1988. doi:10.1093/imanum/8.1.141.
Yu-Hong Dai and Roger Fletcher. Projected barzilai–borwein methods for large-scale box-constrained quadratic programming. Numerische Mathematik, 100(1):21–47, 2005. doi:10.1007/s00211-004-0543-6.
See also#
Line Searchers — how seeders connect to line search algorithms
Optimizers — gradient and quasi-Newton methods that consume line searchers
Compressed Sensing & Proximal Methods — FISTA and proximal seeding