Abstract: Machine learning models are often tuned by nesting optimization of model weights inside the optimization of hyperparameters. We give a method to collapse this nested optimization into joint stochastic optimization of weights and hyperparameters. Our process trains a neural network to output approximately optimal weights as a function of hyperparameters. We show that our technique converges to locally optimal weights and hyperparameters for sufficiently large hypernetworks. We compare this method to standard hyperparameter optimization strategies and demonstrate its effectiveness for tuning thousands of hyperparameters.
1. Introduction
Hyperparameter optimization (HPO) is a fundamental challenge in machine learning, typically formulated as a nested optimization problem. To evaluate a specific set of hyperparameters $\lambda$, one must fully train a model to find its optimal weights $w^*$. This process is computationally expensive and scales poorly, often limiting traditional methods like grid search or Bayesian Optimization to fewer than 20 hyperparameters. While gradient-based methods exist, they often require memory-intensive "unrolling" of the training procedure. This paper proposes "hyper-training," a method to collapse this nested structure into a single joint stochastic optimization.
2. Methodology: Hyper-training and Hypernetworks
The central innovation is the introduction of a Hypernetwork, $w_\phi(\lambda)$, which is trained to output approximately optimal weights for any given hyperparameter configuration.
In this framework, the hypernetwork's parameters $\phi$ are optimized to minimize the primary model's training loss. Because the hypernetwork is differentiable, the validation loss becomes directly differentiable with respect to the hyperparameters $\lambda$ via the chain rule. The authors propose a joint optimization algorithm that simultaneously updates both the hypernetwork parameters $\phi$ and the hyperparameters $\lambda$. This approach ensures that the hypernetwork learns a "local best-response"—a high-quality approximation of the optimal weights in the current neighborhood of the hyperparameter space.
3. Theoretical Framework and Insights
The hypernetwork effectively learns a "best-response function" mapping $\lambda$ to $w$. Unlike Bayesian Optimization, which models the scalar validation loss surface using Gaussian Processes, hypernetworks model the weight space directly. This provides a stronger inductive bias, as the network learns the result of the optimization process itself.
A key finding is that the hypernetwork does not need to be globally perfect. Even a simple linear hypernetwork can provide sufficient gradient information for local hyperparameter updates. By utilizing stochastic gradient descent (SGD) for both sets of parameters, the method bypasses the "train-to-completion" bottleneck inherent in standard HPO.
4. Experimental Results
The method was evaluated on the MNIST dataset, specifically targeting a high-dimensional HPO task: optimizing a unique weight decay parameter for every weight in the model, totaling 7,850 hyperparameters.
- Massive Scalability: Hyper-training successfully handled thousands of hyperparameters, a feat impossible for traditional Bayesian or random search methods.
- Efficiency: The approach converged faster than state-of-the-art "unrolled" optimization techniques.
- Performance: Models tuned via hyper-training outperformed hand-tuned baselines in deeper architectures.
- Surrogate Quality: Hypernetworks provided more accurate validation loss surface estimates than Gaussian Processes when given the same computational budget, due to their ability to leverage a larger volume of noisy samples.
5. Discussion and Future Work
While powerful, hyper-training currently cannot optimize "internal" optimization parameters like learning rates or momentum, as these lack an explicit training loop to differentiate through. Additionally, as a gradient-based method, it is prone to local optima and lacks the global exploration capabilities of Bayesian methods. Future work may involve scaling hypernetworks for massive models like Transformers using factorized linear layers or integrating the method into meta-learning frameworks.
Summary updated