Skip to content

Backends ​

Backend choice changes how Basin stores parameters and performs linear algebra. These comparisons keep each solver and problem fixed, vary the backend, and measure the time for a complete solve as the number of parameters nn grows.

The cases below progress from vector operations to dense matrices and sparse factorizations. Read the spread between backends within each figure. Different figures use different algorithms and problems, so their times do not compare solver quality.

These results were measured on 2026-09-16. Absent lines describe the coverage of this saved run, rather than the current capabilities of a backend. The API documentation records each solver's supported parameter and matrix types.

Vector methods ​

These methods operate on vectors without a dense Hessian or covariance matrix. All four dense backends appear in each comparison: Vec<f64>, nalgebra, ndarray, and faer.

Gradient descent ​

Gradient descent on Rosenbrock provides a baseline for the cost of repeated vector operations and evaluations. In this snapshot, Vec<f64> has the lowest solve time at each measured size. With relatively cheap operations, the choice of representation can make a visible difference to the complete solve.

10 µs100 µs1 ms262060200 time/solve n (parameters) Vec<f64>nalgebrandarrayfaer
Gradient Descent on Rosenbrock. Mean time per solve across the measured problem sizes; both axes are logarithmic. Lower is better.

Nelder–Mead ​

Nelder–Mead maintains and updates a simplex on the multimodal Ackley problem. The measured backends remain closer together here than in the gradient-descent case, especially at the largest size. This illustrates why the importance of backend choice depends on the work the solver performs.

10 µs100 µs1 ms10 ms262060200 time/solve n (parameters) Vec<f64>nalgebrandarrayfaer
Nelder–Mead on Ackley. Mean time per solve across the measured problem sizes; both axes are logarithmic. Lower is better.

L-BFGS ​

L-BFGS uses a short history of vector pairs to represent curvature without a dense inverse-Hessian matrix. The Styblinski–Tang case exercises that compact path across all four backends. Vec<f64> has the lowest measured time throughout this snapshot, while the relative ordering of the other backends changes with problem size.

1 µs10 µs100 µs262060200 time/solve n (parameters) Vec<f64>nalgebrandarrayfaer
L-BFGS on Styblinski–Tang. Mean time per solve across the measured problem sizes; both axes are logarithmic. Lower is better.

Dense matrix methods ​

Dense matrix updates and decompositions change the balance of work. The smallest problem can favor a different backend from the largest one, so inspect the scaling curve as well as a single timing.

BFGS ​

BFGS maintains a dense inverse-Hessian approximation and updates it after each step. On Levy, faer starts with a higher solve time but becomes the fastest of the measured backends as the dimension grows. A backend decision based only on the two-dimensional case would miss that crossover.

1 µs10 µs100 µs1 ms262060200 time/solve n (parameters) Vec<f64>nalgebrafaer
BFGS on Levy. Mean time per solve across the measured problem sizes; both axes are logarithmic. Lower is better.

This snapshot includes Vec, nalgebra, and faer. ndarray was not measured here; the current BFGS backend documentation also lists ndarray support.

CMA-ES ​

CMA-ES adds covariance adaptation and a symmetric eigendecomposition. The Rastrigin case shows a different scaling pattern again: the Vec implementation is fastest at the smallest size, while nalgebra has the lowest measured times at the larger sizes. Supporting the same mathematical operations does not guarantee the same cost as matrices grow.

100 µs1 ms10 ms100 ms2481632 time/solve n (parameters) Vec<f64>nalgebrafaer
CMA-ES on Rastrigin. Mean time per solve across the measured problem sizes; both axes are logarithmic. Lower is better.

Only Vec, nalgebra, and faer appear in this snapshot. See the CMA-ES backend documentation for current support, including ndarray. The solver is stochastic; the benchmark uses a fixed seed so the backend comparison is reproducible.

SLSQP ​

SLSQP runs on unconstrained Rosenbrock with accuracy 10−1010^{-10} and a 200-iteration cap. All four backends use the same internal least-squares kernel. Their curves are comparatively close in this snapshot, showing a case where changing the surrounding vector and matrix representation has a smaller effect on solve time.

10 µs100 µs1 ms10 ms100 ms2481632 time/solve n (parameters) Vec<f64>nalgebrandarrayfaer
SLSQP on Rosenbrock. Mean time per solve across the measured problem sizes; both axes are logarithmic. Lower is better.

This is an unconstrained test of SLSQP's optimization path. It does not measure the cost of evaluating or enforcing constraints.

Sparse least squares ​

These cases use sparse Jacobians and sparse Cholesky factorizations. Only nalgebra and faer supply the sparse matrix representations used by this benchmark. The omitted Vec and ndarray lines concern this sparse setup; both solvers also have dense implementations.

Levenberg–Marquardt ​

Levenberg–Marquardt solves damped normal equations built from the sparse Jacobian JJ. On this fixture, nalgebra has the lower measured solve time at every size, with the relative gap narrowing as the dimension grows.

1 µs10 µs100 µs262060200 time/solve n (parameters) nalgebrafaer
Levenberg–Marquardt on Sparse least-squares. Mean time per solve across the measured problem sizes; both axes are logarithmic. Lower is better.

Gauss–Newton ​

Gauss–Newton uses the same sparse, zero-residual design without damping. The Jacobian has full column rank, so the normal-equation matrix JTJJ^\mathsf{T}J remains positive definite for this fixture. nalgebra again has the lower measured times in this snapshot.

100 ns1 µs10 µs100 µs262060200 time/solve n (parameters) nalgebrafaer
Gauss–Newton on Sparse least-squares. Mean time per solve across the measured problem sizes; both axes are logarithmic. Lower is better.

This favorable least-squares design does not exercise rank deficiency or the cases where damping helps. Use it to compare the measured sparse paths, and choose the solver based on your problem's numerical properties.

Benchmark methodology and reproduction

Basin v3.6.0