Hyperparameter Tuning Through Pessimistic Bilevel Optimization

Meltem Apaydin Ustun, Liang Xu, Bo Zeng, Xiaoning QianarXiv 2024 · DOI

Abstract

Standard hyperparameter tuning typically assumes a "cooperative" training process, often referred to as an optimistic bilevel optimization framework. However, this assumption frequently leads to overfitting, particularly in data-scarce environments. This paper proposes a pessimistic bilevel optimization framework for hyperparameter tuning. By optimizing for the worst-case model within the set of optimal training solutions, the resulting hyperparameters are more robust to training uncertainty and adversarial shifts. Experimental results on benchmark datasets and transfer learning tasks demonstrate that the pessimistic approach significantly outperforms traditional optimistic methods in small-data regimes and distribution-shift scenarios.

Introduction

Hyperparameter tuning is a fundamental challenge in machine learning, naturally formulated as a bilevel optimization problem. The "outer level" involves searching for hyperparameters (e.g., regularization coefficients) that maximize performance on a validation set, while the "inner level" involves training the model weights given those hyperparameters.

Most contemporary AutoML tools adopt an "optimistic" view, assuming that if multiple weight configurations achieve the same training loss, the training algorithm will conveniently select the one that performs best on the validation set. This paper argues that such an assumption is a liability when training data is limited. In small-data regimes, many distinct models may achieve identical training performance but generalize poorly. Optimistic tuning overfits by selecting hyperparameters that rely on these "lucky" training outcomes.

Methodology: Pessimistic Bilevel Optimization

The authors introduce the Pessimistic Bilevel (PBL) framework, defined as: $$\min_{x} \max_{y \in \Psi(x)} F(x, y)$$ where $x$ represents hyperparameters, $y$ represents model weights, and $\Psi(x)$ is the set of optimal solutions for the inner training problem. Unlike optimistic models, PBL optimizes for the worst-case model in the optimal training set, ensuring robustness regardless of the specific solution reached by the training algorithm.

To address the NP-hard nature of pessimistic bilevel problems, several techniques are employed:

  • Relaxation-based Approximation: Converts the complex three-level problem into a more tractable min-max problem.
  • Label Flipping Trick: For binary linear classifiers, the authors prove that finding the worst-case model is equivalent to a minimization problem involving strategically "flipped" labels in the validation set, effectively creating adversarial validation examples.
  • $\epsilon$-Approximation: Accounts for near-optimal solutions, recognizing that global optimality is rarely achieved in practice.
  • KKT Linearization: The problem is transformed into a single-level optimization using Karush-Kuhn-Tucker (KKT) conditions and "big-M" linearization, solvable by standard tools like CPLEX.

Experimental Results

The framework was evaluated on UCI datasets (Cancer, Diabetes) and a transfer learning task (MNIST to FashionMNIST).

Performance in Small Data Regimes

A key finding is the significant advantage of the pessimistic approach when training data is extremely limited. As shown in Figure 1, when the training set size is as small as 5 samples, the optimistic approach performs near the level of random chance (~60% accuracy), whereas the pessimistic approach maintains a high accuracy of approximately 86%.

Comparison of accuracy between Pessimistic and Optimistic approaches across different training set sizes.

Stability and Transfer Learning

Beyond raw accuracy, the pessimistic approach exhibits greater stability. Across multiple random data splits, the standard deviation of accuracy was consistently lower for PBL than for optimistic tuning. In transfer learning (MNIST to FashionMNIST), the pessimistic approach achieved 97% accuracy compared to 86% for the optimistic baseline, demonstrating its ability to find hyperparameters that generalize across distribution shifts.

Conclusion and Future Work

Pessimistic bilevel optimization offers a robust alternative to standard hyperparameter tuning, particularly for small-data and transfer learning applications. While currently limited by the computational complexity of KKT-based solvers and a focus on linear models, future research into scalable first-order gradient methods could make this framework a cornerstone of robust AutoML.

Summary updated

Abstract

Automated hyperparameter search in machine learning, especially for deep learning models, is typically formulated as a bilevel optimization problem, with hyperparameter values determined by the upper level and the model learning achieved by the lower-level problem. Most of the existing bilevel optimization solutions either assume the uniqueness of the optimal training model given hyperparameters or adopt an optimistic view when the non-uniqueness issue emerges. Potential model uncertainty may arise when training complex models with limited data, especially when the uniqueness assumption is violated. Thus, the suitability of the optimistic view underlying current bilevel hyperparameter optimization solutions is questionable. In this paper, we propose pessimistic bilevel hyperparameter optimization to assure appropriate outer-level hyperparameters to better generalize the inner-level learned models, by explicitly incorporating potential uncertainty of the inner-level solution set. To solve the resulting computationally challenging pessimistic bilevel optimization problem, we develop a novel relaxation-based approximation method. It derives pessimistic solutions with more robust prediction models. In our empirical studies of automated hyperparameter search for binary linear classifiers, pessimistic solutions have demonstrated better prediction performances than optimistic counterparts when we have limited training data or perturbed testing data, showing the necessity of considering pessimistic solutions besides existing optimistic ones.
BibTeX
@misc{ustun2024hyperparameter,
  author = {Meltem Apaydin Ustun and Liang Xu and Bo Zeng and Xiaoning Qian},
  title = {{Hyperparameter Tuning Through Pessimistic Bilevel Optimization}},
  year = {2024},
  eprint = {2412.03666},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.03666},
}
Figure