Abstract
Hyperparameter optimization (HPO) aims to identify an optimal hyperparameter configuration (HPC) such that the resulting model generalizes well to unseen data. As the expected generalization error cannot be optimized directly, it is estimated with a resampling strategy, such as holdout or cross-validation. This approach implicitly assumes that minimizing the validation error leads to improved generalization. However, since validation error estimates are inherently stochastic and depend on the resampling strategy, a natural question arises: Can excessive optimization of the validation error lead to overfitting at the HPO level, akin to overfitting in model training based on empirical risk minimization? In this paper, we investigate this phenomenon, which we term overtuning, a form of overfitting specific to HPO. Despite its practical relevance, overtuning has received limited attention in the HPO and AutoML literature. We provide a formal definition of overtuning and distinguish it from related concepts such as meta-overfitting. Our results show that overtuning is more common than previously assumed, typically mild but occasionally severe. In approximately 10% of cases, overtuning leads to the selection of a seemingly optimal HPC with worse generalization error than the default or first configuration tried. Our results highlight the need to raise awareness of overtuning, particularly in the small-data regime, indicating that further mitigation strategies should be studied.
Introduction
In machine learning, we rarely have access to the "true" generalization error of a model. Instead, we use hyperparameter optimization (HPO) to find the best settings by minimizing an estimate—usually calculated via holdout sets or cross-validation. The implicit assumption is that a lower validation error always translates to better performance on new data. However, validation estimates are stochastic and noisy. If you optimize these noisy signals too aggressively, you might fall into a trap: picking a configuration that looks like a winner on your validation set but is actually a "loser" on the final test set. This phenomenon is defined as overtuning.
Quantifying the Cost of Optimization
To analyze this phenomenon, we introduce several key metrics to quantify the "cost" of optimization:
- Overtuning ($ot_t$): The difference between the test error of the current "best" configuration (the incumbent) and the best test error seen so far in the HPO trajectory.
- Relative Overtuning ($\tilde{ot}_t$): A normalized version that expresses the loss as a fraction of the total improvement possible. A value of 1.0 means HPO essentially "erased" all its progress and ended up worse than the starting default.
- Meta-overfitting: The simple gap between validation and test error. While meta-overfitting is common, it only leads to overtuning if it causes the optimizer to pick the wrong configuration.
Prevalence and Severity across Benchmarks
Through a massive reanalysis of seven major HPO benchmarks (including WDTB, TabZilla, TabRepo, LCBench, FCNet, and PD1), we assessed the prevalence of overtuning across thousands of tasks. Our findings indicate that while approximately 60% of HPO runs show no overtuning, 30% show mild effects, and 10% are severe.
In these severe cases, the final chosen model is actually worse than the very first configuration or default the user tried. This highlights that more optimization does not always yield a better model.
Drivers of Overtuning
Overtuning is not uniform across all settings; it is heavily influenced by the choice of model, metric, and dataset size.
- Model Complexity: Flexible, high-capacity models like CatBoost and MLPs overtune significantly more than simpler models like Elastic Net. The more "knobs" a model has, the easier it is for HPO to find a setting that overfits the validation noise.
- Metric Choice: Accuracy and ROC AUC are more prone to overtuning than Log Loss. Log Loss provides a "smoother" signal, making it harder for the optimizer to be misled by random noise in the validation set.
- Data Volume: Increasing dataset size from $n=500$ to $n=5000$ drastically reduces both the probability and the magnitude of overtuning.
Mitigation Strategies
Our analysis suggests several effective defenses against overtuning:
- Robust Resampling: Moving from a simple holdout split to 5-fold cross-validation is one of the most effective ways to mitigate the overtuning effect.
- Bayesian Optimization (BO): BO (using tools like HEBO or SMAC) generally results in less severe overtuning than Random Search. The surrogate model used in BO acts as a "smoother," helping the optimizer ignore high-variance noise in validation scores.
- Reshuffling: Changing the random seeds of cross-validation folds during the HPO process significantly improves generalization, effectively "hedging" against picking a configuration that just got lucky on one specific set of splits.
Conclusion
Overtuning remains a significant hurdle, particularly in the "small-data" regime. Our results highlight the need for noise-aware selection methods and adaptive resampling strategies that can ensure the final hyperparameter choice is robust to validation noise. Future work should focus on developing HPO optimizers that explicitly account for the stochasticity of validation estimates to avoid the overtuning trap.
Summary updated