NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Hyperparameter optimization with approximate gradient

Fabian Pedregosa

The Bottleneck in Hyperparameter Tuning

In machine learning, training a model involves a "nested" optimization problem. The inner loop trains model parameters (like neural network weights), while the outer loop selects hyperparameters (like regularization strength) to minimize validation error.

Traditionally, gradient-based hyperparameter optimization is a massive bottleneck. To compute the gradient of the validation loss with respect to a hyperparameter, the model parameters typically must reach their exact optimum first. This requires solving the entire training problem to high precision for every single step of hyperparameter tuning. Alternative methods like grid search or random search avoid gradients entirely but scale poorly as the number of hyperparameters increases.

Introducing HOAG: Approximate Gradients for Faster Tuning

The HOAG (Hyperparameter Optimization with Approximate Gradient) algorithm speeds up the tuning of continuous hyperparameters by using "inexact" gradients. Instead of waiting for a model to fully converge before updating hyperparameters, HOAG allows for simultaneous updates with increasing precision.

The key innovation is the use of a tolerance sequence ($\epsilon_k$). At each iteration $k$:

  1. Approximate Training: The inner optimization problem is solved only until the error is within $\epsilon_k$.
  2. Approximate Linear System: The linear system required for the implicit gradient (derived from the Karush-Kuhn-Tucker conditions) is also solved only to tolerance $\epsilon_k$.
  3. Gradient Update: The hyperparameters are updated using this "noisy" or approximate gradient.

The paper proves that if the sequence of tolerances is "summable" (meaning the errors decrease fast enough, such as $1/k^2$ or exponentially), the algorithm is guaranteed to converge to a stationary point of the validation loss. This allows the algorithm to make "cheap" hyperparameter moves early in the process and only invest heavy computation as it nears the optimum.

Key Insights

  • The "Good Enough" Gradient: You don't need a perfect map to start walking in the right direction. By using approximate gradients early on, HOAG saves massive amounts of computation time that "exact" gradient methods waste on over-optimizing model parameters for sub-optimal hyperparameters.
  • Warm-Starting is Key: Because HOAG doesn't require model parameters to be perfectly optimized at each step, it can "warm-start" the next training iteration using the parameters from the previous step. This creates a significant speed advantage over "Iterative Differentiation" methods, which often struggle to reuse previous work effectively.
  • Theoretical Safety Net: The requirement for a "summable" error sequence provides a rigorous bridge between heuristic "early stopping" and formal optimization theory, dictating exactly how much practitioners can "cheat" on accuracy without losing convergence.

Experimental Results

The algorithm was evaluated on standard benchmarks including the 20news, real-sim, and Parkinson datasets.

Efficiency and Convergence HOAG reached the neighborhood of the optimal hyperparameter significantly faster than "Exact" gradient methods. By employing decreasing tolerance sequences (like quadratic, cubic, or exponential), HOAG converges in a fraction of the time required by the exact baseline.

Comparison of exact vs. approximate gradient methods across three datasets.

Comparison to Baselines Compared to Sequential Model-Based Optimization (SMBO, a popular "black-box" method), Grid Search, and Random Search, HOAG proved to be generally faster and more accurate, especially as the dimensionality of the hyperparameter space increases.

HOAG outperforms SMBO, Grid Search, and Random Search on the real-sim dataset.

Limitations and Future Work

  • Continuous Only: HOAG is designed for continuous hyperparameters and cannot directly handle discrete choices like the number of network layers or activation functions.
  • Flat Regions: The method can occasionally get "stuck" in flat regions of the hyperparameter space where the gradient is near zero, particularly if the initial step size is poorly chosen.
  • Stochastic Extension: The current version is a "batch" method. Developing a stochastic variant for mini-batches is a promising direction for massive deep learning datasets.
  • Adaptive Strategies: While the theoretical proof assumes constant step sizes, experiments utilized an adaptive step size. Formalizing the theory for this adaptive behavior remains an open research area.

Summary updated

BibTeX
@inproceedings{pedregosa2016hyperparameter,
  author = {Fabian Pedregosa},
  title = {{Hyperparameter optimization with approximate gradient}},
  booktitle = {International Conference on Machine Learning},
  year = {2016},
  url = {https://openreview.net/forum?id=r142RibO-S},
}
Figure