TL;DR
autonugget is a JAX-compatible Python package designed to automatically and stably solve ill-conditioned linear systems during rapid prototyping. By combining multiple regularized linear solves via Richardson extrapolation, it achieves high numerical accuracy and stable gradients without requiring manual hyperparameter tuning.
What Problem Does This Paper Address?
Ill-conditioned linear systems ($Ax = b$) are ubiquitous in machine learning, appearing constantly in Gaussian processes, Bayesian optimization, and probabilistic numerics. When a matrix is ill-conditioned, standard numerical solvers explode due to floating-point round-off errors.
To keep things stable during rapid prototyping, researchers typically turn to Tikhonov regularization, which involves adding a small value $\sigma$ (called a "nugget") to the diagonal ($A + \sigma I$). However, choosing the size of this nugget is a notorious headache:
- The Goldilocks Dilemma: If $\sigma$ is too small, the system remains numerically unstable. If it's too large, it introduces massive bias, ruining downstream task performance.
- Breaking Auto-Diff: Data-adaptive methods that automatically tune $\sigma$ rely on conditional logic (like checking the matrix condition number). This breaks automatic differentiation (auto-diff), making end-to-end gradient descent training impossible.
- Computational Waste: Adaptive methods often run multiple linear solves to find the right nugget but throw away all but the final result.
The authors introduce autonugget to solve all three problems at once.
Methods
Instead of trying to find a single "perfect" nugget, autonugget computes solutions across a range of safe, larger nuggets ($\sigma \geq \sigma_\star$) where the numerical solver is perfectly stable. It then uses Richardson extrapolation—a classical numerical analysis technique—to fit a polynomial to these stable solutions and extrapolate backward to estimate the ideal, unbiased solution at $\sigma = 0$.
To make this fully automatic, the package calculates a critical threshold $\sigma_\star$ by balancing the theoretical extrapolation error against finite-precision numerical noise. This calculation relies on a randomized approximation of the matrix's minimum eigenvalue ($\lambda_{\min}(A)$).
Crucially, to maintain compatibility with frameworks like JAX, the authors implemented a custom forward differentiation rule. Instead of differentiating through the adaptive nugget selection logic (which is non-differentiable), they use standard matrix calculus identities to compute exact gradients analytically using separate internal calls to autonugget.
Datasets
The method was evaluated on several synthetic and quasi-realistic linear systems:
- Kernel Gram Matrices: Matrices generated using Squared Exponential and Matérn kernels with uniformly spaced nodes. Ill-conditioning was precisely controlled by varying the kernel length-scale $\ell$ (larger $\ell$ leads to extreme ill-conditioning).
- Non-Kernel Matrices: Positive definite matrices generated via $UDU^\top$, where $U$ is an orthogonal matrix from a Haar measure and $D$ contains randomly sampled eigenvalues.
- Gaussian Process Regression: A realistic hyperparameter optimization task using a centered Gaussian Process to fit noiseless data generated on a $5 \times 5$ grid.
Key Insights and Ideas
- Waste Not, Want Not: Traditional adaptive regularizers perform multiple linear solves to find a good nugget but discard the intermediate results.
autonuggetrecycles these "wasted" solves to construct its polynomial extrapolation, maximizing data efficiency. - Better Than the Best Stable Solve: Counterintuitively, extrapolating from a few larger (and highly stable) nuggets yields a significantly more accurate approximation of the true solution than actually attempting a direct solve at the smallest possible stable nugget.
- Stability Through Higher Order: The math reveals that using a higher number of solves ($n$) for the extrapolation allows the algorithm to safely use even larger nuggets, simultaneously boosting both numerical stability and accuracy.
Key Results
- Solver Accuracy:
autonuggetconsistently outperformed standard baseline methods like LU decomposition, SVD, and fixed-nugget regularizers on severely ill-conditioned matrices. - Smooth Optimization Landscapes: In the Gaussian Process hyperparameter optimization task, standard baseline solvers produced jagged, non-smooth loss surfaces or caused the optimizer to diverge.
autonuggetprovided a perfectly smooth loss surface and highly accurate gradients, allowing standard gradient descent to cleanly find the true length-scale ($\ell = 50$).
Limitations and Future Work
While highly effective for prototyping, the authors note a few limitations:
- Matrix Constraints: The current theoretical framework and implementation are strictly limited to symmetric positive definite (SPD) matrices.
- Computational Overhead: Because it performs multiple linear solves and computes eigenvalue approximations,
autonuggetis slower than a single standard direct solve by a constant factor. - Memory Limits: The package is designed for dense matrices that fit entirely within memory, making it less suitable for massive-scale linear systems.
Future Directions: The authors plan to extend the framework to non-SPD matrices, explore low-cost SVD-centric alternatives to reduce the computational overhead, and incorporate probabilistic error bars into the extrapolated solutions.
Summary updated