ATLAS NOVA My AtlasVelocer ↗

Method · Machine learning

Hyperparameter optimization

Machine learning optimization method

Hyperparameter optimization is the process of choosing the values set before a machine learning algorithm's learning process runs, as distinct from the model parameters that the algorithm itself derives from the training data.

A machine learning model is not built by data alone. Before training begins, someone has to decide how the algorithm will learn: how large a step it takes, how strongly it is penalized for complexity, how wide a kernel reaches. In a neural network, the weights are model parameters, fitted by training, while the learning rate, the regularization parameter and the kernel parameter are hyperparameters.⁠[1] The distinction is easy to state and easy to lose sight of: parameters are learned, hyperparameters are chosen.

Key facts
80Czarnecki et al. 2015: Bayesian optimization gave top accuracy in 80 experiments versus 22 for grid search⁠[2]
10,000Tetko et al. 2024: pre-set hyperparameters matched tuned models using about 10,000 times fewer resources⁠[3]
81.98Tabares-Soto et al. 2020: support vector classifier accuracy rose from 10.82 to 81.98 percent after tuning⁠[4]
13Arnold et al. 2024: only 13 of 64 political science papers reported hyperparameters and tuning⁠[5]

Overview

What hyperparameter optimization is and why it matters

The choice is not cosmetic. Hyperparameters control the learning process itself, and a poorly chosen set can leave a capable algorithm performing far below its potential. The same algorithm, trained on the same data with different settings, can perform very differently.⁠[2] This is why hyperparameter optimization (HPO) exists: it is the systematic search for the configuration that minimizes a performance or loss measure over the configuration space.⁠[1] The search is over a configuration space, the set of all combinations of values the hyperparameters are allowed to take, and the objective is a performance measure computed by training and evaluating a model at each candidate configuration.

Why the settings matter so much

A concrete case shows the scale of the effect. Support vector machines, a workhorse of classification, depend critically on two hyperparameters, the regularization strength C and the kernel width gamma, and their classification efficiency can change dramatically across different values of these two numbers.⁠[2] The same pattern appears across model families. Tuning is therefore not a ritual performed for tidiness; it can be the difference between a model that works and one that does not.

There is a second reason HPO matters, less about accuracy than about process. Left to manual trial and error, the search for good settings is time-consuming and hard to reproduce; in a survey of 64 machine learning manuscripts in three political science journals, only 13 reported their hyperparameters and how they were tuned.⁠[6][5] Automated HPO replaces that with a procedure that can be repeated and reported. The problem it addresses is genuinely awkward: the function mapping a configuration to a performance score is a black box, meaning its inner form is unknown and only its output can be observed for a given input, and each evaluation is expensive, taking minutes on small datasets and hours or days on large ones.⁠[1] A search method therefore has to be frugal with evaluations, because every one of them costs a full training run.

What the search is up against

The difficulty is not merely cost. The performance surface as a function of the hyperparameters has a complex shape, which is why finding an optimal configuration is much harder than fitting the model parameters themselves; for a support vector machine the inner fitting problem is well behaved, but the outer problem over the hyperparameters is not.⁠[2] And the best configuration is not a fixed property of an algorithm. Different datasets call for different hyperparameter settings, so a configuration that is optimal for one problem may be mediocre for the next.⁠[1]

Hyperparameters are chosen, not learned, and the choice can move a model from unusable to competitive, which is why the search deserves a method rather than a guess.

This section has treated HPO as a single idea, but the idea admits many implementations, from exhaustive grids to adaptive searches that learn from each evaluation. The sections that follow trace how the practice moved from hand-tuning to automated search, explain the main families of search strategy and the evidence on when each helps, and examine the risks, including the possibility that aggressive tuning buys a better score on the validation data without buying a better model.

History

How it works

The basic search strategies: grid, random, and heuristic

The simplest way to search a configuration space is to decide in advance which configurations to try, and then try all of them. Grid search does exactly this: it lays a regular lattice over the allowed range of each hyperparameter and trains a model at every point on the lattice. If the regularization strength C is allowed to range over several orders of magnitude, the grid might take values in a geometric progression, and the search returns whichever of those settings scored best.⁠[2] Nothing about the procedure is subtle. It is exhaustive within the range it covers, easy to explain, and easy to reproduce, and it is among the most popular optimization strategies in cheminformatics applications.⁠[2]

The trouble with a lattice is that it multiplies. A grid with ten values for one hyperparameter and ten for another has a hundred points to evaluate; add a third and it has a thousand. Each point is not a cheap lookup but a full training run, and a single training run can take hours.⁠[2]

The cost of an exhaustive grid therefore grows explosively as the number of hyperparameters rises, and grid search is only feasible for a limited number of parameters and levels.⁠[9] A review of the field lists grid search among the simple HPO techniques, alongside more advanced methods such as evolution strategies, Bayesian optimization, Hyperband, and racing.⁠[6] Practical workarounds exist: one study of text categorization with a k-nearest-neighbour classifier and three hyperparameters to tune proposed a technique for speeding up grid search that was at least an order of magnitude faster than conventional tuning.⁠[10] Such tricks ease the arithmetic without changing its shape.

Random search abandons the lattice. Instead of a regular set of points, it draws configurations independently from the allowed ranges, so that each trial is a fresh sample rather than a position on a predetermined grid. The appeal is not obvious at first, since a grid at least guarantees even coverage. The review that surveys the field lists random search next to grid search among the simple HPO techniques.⁠[6]

A direct comparison in cheminformatics made the point concretely. Working with support vector machines for classifying bioactive compounds, researchers set Bayesian optimization, random search, grid search and heuristic choice against one another across many target and fingerprint combinations. Random search led to significantly better performance than grid search and the heuristic approaches, and the authors concluded that, despite its simplicity, it should be used as a second choice when a Bayesian approach is not feasible.⁠[2] The result is a useful corrective to the intuition that a more structured search must be a better one.

The third strategy is not really a search at all. Heuristic choice sets hyperparameters by a fixed rule of thumb rather than by testing candidates, so the values are assigned before any model is trained and no evaluation guides them. In the same cheminformatics setting, the most popular optimization strategies were grid search and heuristic choice, and depending on the problem heuristic choice could deliver high classification accuracy.⁠[2] Its virtue is that it costs nothing to apply. Its limitation is that a fixed rule cannot adapt to the dataset in front of it, and the same study noted that classification efficiency can change dramatically across different values of those two parameters.⁠[2]

Set side by side, the three strategies differ in how they spend evaluations. Grid search spends them evenly and exhaustively, random search spends them independently and widely, and heuristic choice spends none at all. None of the three learns from the evaluations it has already performed: each new configuration is chosen without reference to how previous ones scored. That gap is what the adaptive methods covered later in this chapter were built to close, and the evidence on which strategy wins in practice is taken up in a later section.

A grid is exhaustive but multiplies with every hyperparameter added; random sampling covers more of what matters for the same budget; a rule of thumb costs nothing and adapts to nothing.

Speeding up the search: early stopping and resource allocation

The strategies considered so far share an assumption that is rarely stated: that every configuration is judged on equal terms, each one trained to completion before its score is compared with the rest. That assumption is expensive. A search that trains every candidate fully pays the full price for configurations that were clearly hopeless after a few iterations, and in deep learning, where a single training run can take hours, those wasted runs dominate the budget. The methods in this section attack the problem from a different angle. Rather than asking which configuration to try next, they ask how much of a limited resource, such as training iterations, data samples or features, each configuration deserves before a verdict is reached.

Four columns connect eight lettered candidates to four, two, and one survivor at increasing epoch budgets.
The example halves the candidate set while increasing total training epochs for survivors. Early stopping saves work but can discard slow starters. View full-size image.Successive Halving Allocates Training Resources by Atlas Nova. Illustration generated with AI for this article and checked against its text.

Successive halving: promote the promising few

The core idea is successive halving, which begins by drawing many configurations and giving each a small budget, enough to train briefly and obtain a rough score. The weakest half or so are discarded, the survivors receive a larger budget, and the process repeats, halving the field at each round until one configuration remains. Most candidates are eliminated cheaply, and the full training cost is paid only for the few that survive early screening. The gamble is that a configuration which looks poor after a short run would also have looked poor after a long one, which is not always true, since some models improve slowly before overtaking faster starters.

Hyperband takes this idea and wraps a search strategy around it. It treats hyperparameter optimization as a problem of allocating a predefined resource across randomly sampled configurations, and runs several successive-halving brackets with different trade-offs between the number of configurations tried and the budget each receives.⁠[8] One bracket explores broadly with tiny budgets, another explores narrowly with generous ones, so the method does not commit in advance to a single guess about which regime suits the problem. In comparisons on a suite of deep-learning and kernel-based problems, Hyperband can provide over an order-of-magnitude speedup over the competitor set.⁠[8] The gain comes from spending less on configurations that reveal their weakness early, not from choosing better configurations in the first place.

Combining guidance with early exits

Hyperband's weakness is the mirror of its strength. Because it samples configurations at random and discards them on the basis of partial training, it does not use what earlier evaluations revealed about where good configurations tend to lie. Bayesian optimization has the opposite profile: it uses past results to choose each next configuration carefully, but it commits to training each one fully, which becomes computationally infeasible for state-of-the-art deep models with long training times.⁠[13] Each method has what the other lacks, and the obvious move is to combine them.

BOHB does exactly that, merging Bayesian optimization with bandit-based evaluation so that configurations are chosen with guidance and evaluated with early stopping. BOHB consistently outperforms both Bayesian optimization and Hyperband on a wide range of problem types, including support vector machines, feed-forward and Bayesian neural networks, deep reinforcement learning and convolutional networks.⁠[13] A related combination paired Hyperband with Bayesian optimization, noting that Hyperband does not utilize history information of previously explored configurations and thus the solution found is suboptimal, with experiments showing the combination superior to other hyperparameter optimization approaches including Hyperband.⁠[14] The lesson generalizes beyond these two systems: guidance about where to look and thrift about how long to look are separate savings, and they add.

What early stopping assumes

All of these methods rest on a bet that partial training predicts final performance well enough to rank configurations. When that bet holds, the savings are large and the risk is small. When it fails, a configuration that would have excelled given more time is cut before it has a chance to show it, and the search returns a worse answer than a slower method would have found. The strength of the correlation between short-run and long-run rankings therefore governs how aggressively the budget can be cut, and it is a property of the problem rather than of the algorithm. The practical consequence is that early-stopping methods reward problems where progress is visible early and punish those where the signal emerges late, which is why the choice among search strategies remains tied to the model and data at hand rather than settled once for all.

Early stopping and Bayesian guidance save in different currencies, one by training less and the other by choosing better, and combining them can pay twice.

Evolutionary and other derivative-free approaches

The search strategies covered so far choose each configuration by reasoning about the objective: a surrogate predicts, an acquisition function scores, a bracket allocates. There is another family that reasons differently. Evolutionary algorithms keep a population of candidate configurations, score each one by training a model, and then breed the next generation from the better performers, combining and mutating them so that good settings propagate and poor ones die out. No surrogate is fitted and no gradient is needed; improvement comes from selection pressure applied over many generations. The approach belongs to the broader class of derivative-free optimization, in which the search proceeds using only the values the objective returns, never its slope.

A slide titled "Genetic Algorithms" with diagrams of bit-string chromosomes (A1–A6) labeled gene, chromosome, and population, plus a crossover illustration with arrows and a red dividing line.
A slide titled "Genetic Algorithms" with diagrams of bit-string chromosomes (A1–A6) labeled gene, chromosome, and population, plus a crossover illustration with arrows and a red dividing line. View full-size image.Genetic algorithm by Kacperkossa12. CC BY-SA 4.0, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

Differential evolution

Differential evolution is a population-based variant built for search spaces that mix discrete and continuous values. It borrows the population structure of a genetic algorithm and the self-adapting mutation of evolution strategies, and can loosely be viewed as a population-based simulated annealing in which the mutation rate shrinks as the population converges.⁠[9] That description points to its practical virtue: it can search a space where some hyperparameters take a handful of named options and others range over the real line, without the user first discretizing everything. A genetic algorithm applied to the same problem typically requires each hyperparameter's options to be either already discrete or discretized before the search begins.⁠[9]

The evidence for it comes from genomic prediction, where deep networks are tuned to predict livestock phenotypes from genetic markers. On two pig and cattle datasets with real genotypes and simulated phenotypes, comprising 7,539 animals and 48,541 markers, and on one real dataset of 910 individuals and 28,916 markers, models whose hyperparameters were optimized by differential evolution showed a clear improvement in predictive performance across all three datasets. The optimized models also overfit less and varied less in performance when retrained, compared with non-optimized models.⁠[9]

Covariance matrix adaptation

A third population method, the Covariance Matrix Adaptation Evolution Strategy (CMA-ES), is known for strong performance in derivative-free optimization and carries invariance properties that suit it to awkward search spaces, along with a structure friendly to evaluating many candidate solutions in parallel.⁠[15] Its distinguishing move is to adapt not just the average of the population but the shape of the distribution from which new candidates are drawn, so that the search learns the correlations between hyperparameters as it goes.

Evolution inside Bayesian optimization

Evolutionary ideas also turn up in an unexpected place: inside Bayesian optimization itself. The acquisition function, which scores each candidate configuration, must itself be maximized to pick the next point, and that inner maximization is another optimization problem, usually over a surface that is cheap to evaluate but not necessarily smooth. Nothing requires the standard solver for it to be used, and a study of image classification with automated machine learning systems tested evolutionary algorithms in that role, proposing genetic algorithms, differential evolution and CMA-ES for acquisition function optimization and comparing each against conventional Bayesian optimization.⁠[1] The results were mixed in an instructive way. Using CMA-ES and differential evolution improved the performance of standard Bayesian optimization, while Bayesian optimization tended to perform poorly when a genetic algorithm was used for the acquisition step.⁠[1] The choice of optimizer for the inner problem, in other words, is not a detail that can be assumed away.

What the family shares, and what it costs

These methods differ in mechanism but share a temperament. They evaluate many configurations rather than reasoning carefully about which single configuration to try next, so they tolerate objectives that are noisy, discontinuous or defined over mixed types, where a surrogate model would struggle to fit anything sensible. The price is evaluations. A population of candidates must be trained before a single generation completes, and many generations may be needed, which is affordable when training is cheap and painful when it is not. A comparison of four swarm and evolutionary algorithms for tuning a support vector machine found that the genetic algorithm had lower temporal complexity than the others tested, a reminder that within this family the computational cost varies considerably from one method to the next.⁠[16] Whether that cost is worth paying depends on the same trade-off that runs through every strategy in this chapter: how expensive a single evaluation is, and how many can be afforded.

Evolutionary methods trade cleverness for robustness: they need no gradient and no surrogate, but they pay for that tolerance in training runs.

Gradient-based and multi-objective optimization

Every strategy so far has treated the objective as a black box, something whose slope cannot be read and whose only usable output is a score. That is a safe assumption for many models, but it is not always true. When the training procedure is itself a sequence of differentiable steps, the performance of the trained model can be differentiated with respect to the hyperparameters that shaped it, and the search can then use gradients like any other optimization problem.

A scatterplot shows three blue Pareto points and one red dominated point, with a lower-left improvement arrow.
Configurations A, B, and C trade prediction speed for accuracy. B dominates D because it has both lower prediction time and lower error. View full-size image.Pareto Trade-offs Between Error and Time by Atlas Nova. Illustration generated with AI for this article and checked against its text.

Differentiating through training

The obstacle is that the hyperparameters influence performance only indirectly, by changing the model parameters that training produces. To get a gradient, the chain of derivatives must be carried backwards through the entire training run, from the final validation score back through every update the learning algorithm made. Gradient-based hyperparameter optimization does exactly this: it computes exact gradients of cross-validation performance with respect to all hyperparameters by chaining derivatives backwards through the whole training procedure, which makes it possible to optimize thousands of hyperparameters at once, including step-size and momentum schedules, weight initialization distributions, richly parameterized regularization schemes and neural network architectures. The gradients are obtained by exactly reversing the dynamics of stochastic gradient descent with momentum, so the training run is replayed in reverse to attribute the final score to each setting.⁠[17]

An alternative is to accept an approximation. A related method optimizes continuous hyperparameters using inexact gradient information, with the practical advantage that hyperparameters can be updated before the model parameters have fully converged, so the search does not have to wait for each training run to finish before adjusting the settings that govern it. The same work gives sufficient conditions for the method's global convergence, based on regularity conditions of the functions involved and on the errors summing to something finite, and validates it empirically on estimating the regularization constants of L2-regularized logistic regression and kernel ridge regression, where it proved competitive with state-of-the-art methods.⁠[18] The appeal of the whole family is precision: a gradient says which direction to move and by how much, rather than merely which of several sampled configurations scored best.

When there is more than one thing to optimize

Gradient methods sharpen the search for a single number. Many real problems, though, are not about a single number. A model may need to be accurate and fast, or accurate and fair, and these goals pull against each other. Multi-objective hyperparameter optimization treats the search as the problem of finding configurations that balance several conflicting objectives at once, rather than collapsing them into one score. Most HPO work has focused on optimizing one performance measure, usually an error-based one, and the literature on such single-objective problems is vast; algorithms for optimizing multiple conflicting objectives simultaneously are a more recent arrival.⁠[19]

The shift changes what counts as an answer. With one objective there is a single best configuration, or a set of equally good ones. With several there is usually no configuration that wins on every measure, only a set of trade-offs in which improving one objective means giving ground on another, and the useful output of the search is that set rather than a single point. A survey of the field distinguishes multi-objective methods that are metaheuristic-based, those built on metamodels, and approaches mixing the two, and discusses the quality metrics used to compare such procedures.⁠[19] The objectives that motivate the work are practical ones: operating conditions, prediction time, sparseness, fairness, interpretability and robustness have all been treated as goals to be balanced against accuracy in applied machine learning.⁠[20]

The practical neglect of this framing is attributed less to doubt about its value than to a lack of knowledge and of readily available software implementations for multi-objective hyperparameter optimization.⁠[20]

A gradient turns tuning into an ordinary optimization problem; a second objective turns it into a negotiation, whose answer is a set of trade-offs rather than a single best configuration.

Both approaches depart from the sampling-and-scoring pattern that dominates the rest of the chapter, one by exploiting the internal structure of training and the other by widening what the search is asked to deliver. Whether the extra machinery pays depends on the same question that runs through every strategy here: what an evaluation costs, and what the search is ultimately for. The evidence on whether tuning delivers better models at all is taken up later.

Research

Does hyperparameter optimization actually help?

The case for tuning rests on comparisons in which one search strategy beat another, and those comparisons are real. In the cheminformatics study of support vector machines, Bayesian optimization gave the highest classification accuracy in 80 experiments against 22 for grid search, and needed fewer iterations to get there.⁠[2] A study tuning an XGBoost model for breast cancer and cardiovascular disease prediction found Bayesian optimization more stable than grid search and random search.⁠[11] Tuning a convolutional network for image classification improved accuracy by up to 6 percent.⁠[21] Read one at a time, such results look like a settled verdict: searching the configuration space pays.

Read together, they are less settled than they look, because each answers a narrower question than the one that matters. A comparison between two search methods establishes that one way of spending a budget of training runs is better than another. It does not establish that the budget needed to be spent at all. The question of whether tuning helps has two parts that are easy to run together: given that a search will be performed, which search is best, and given a model and a dataset, is a search worth performing in the first place. The evidence on the first part is strong and on the second part surprisingly mixed.

When the search earns its keep

The clearest gains appear where the untuned model is genuinely badly configured. A support vector classifier classifying eleven tumor types from microarray gene expression data scored 10.82 percent accuracy before tuning and 81.98 percent after, a rise from near-useless to competitive.⁠[4] That is not a marginal improvement from a clever search strategy; it is the difference between a model that works and one that does not, and it reflects how badly the default settings suited that particular dataset. The same study found that while most of the algorithms tested improved somewhat after tuning, only two showed statistically significant changes, which is a useful reminder that a large gain in one model says nothing about the next.⁠[4]

% correct. The tuned classifier rose from near-useless accuracy to competitive accuracy on microarray data. From this article: “A support vector classifier classifying eleven tumor types from microarray gene expression data scored 10.82 percent accuracy before tuning and 81.98 percent after, a rise from near-useless to competitive.⁠”⁠[4]

A second setting where tuning clearly paid was genomic prediction with deep networks. On two pig and cattle datasets with real genotypes and simulated phenotypes, comprising 7,539 animals and 48,541 markers, and on a real dataset of 910 individuals and 28,916 markers, models whose hyperparameters were optimized by differential evolution showed a clear improvement in predictive performance across all three datasets, compared with models using published best-practice settings or randomly specified ones. The optimized models also overfit less and varied less when retrained.⁠[9] Here the comparison is not between two search algorithms but between searching and not searching, and searching won on every dataset tested.

What these two cases share is a large gap between what the defaults deliver and what the problem requires. When the default configuration is far from suitable, almost any systematic search will find something better, and the choice among search methods matters less than the decision to search at all.

When a simpler method wins

The reverse also happens, and it happens often enough to complicate any general recommendation. In the same cheminformatics comparison that favored Bayesian optimization overall, random search led to significantly better performance than grid search and the heuristic approaches, and the authors concluded that despite its simplicity it should be used as a second choice when a Bayesian approach is not feasible.⁠[2] A method that ignores every previous evaluation outperformed one that steps systematically through a lattice, which is hard to reconcile with the intuition that a more structured search must be a better one.

The result is not an isolated curiosity. In a comparison of hyperparameter optimization methods for image classification with automated machine learning systems, random search gave the lowest test error rates of the four techniques tested across all four datasets, ahead of Bayesian optimization, Hyperband and a genetic algorithm. Bayesian optimization was not the best optimizer for those datasets, and the authors responded by looking for ways to improve it rather than by declaring it the winner.⁠[1] Two independent studies, in different fields and with different models, found plain random sampling beating the methods designed to be cleverer than it.

The explanation lies in what the clever methods assume. A surrogate model has to be fitted to the scores observed so far, and those scores are noisy: two runs of the same configuration can differ because of random initialization, data ordering or the split of the data. When the noise is large relative to the differences between configurations, the surrogate learns patterns that are not there and directs the search toward configurations that merely got lucky. Random search makes no such inference, so it cannot be misled by noise. It also parallelizes trivially, since no trial depends on the result of another, which matters when many machines are available and the wall-clock time of the whole search is what constrains the work.

When tuning buys little, or costs something

The most uncomfortable evidence comes from a study that set out to reproduce a published solubility prediction pipeline and found the tuning hard to justify. Working with seven thermodynamic and kinetic solubility datasets, the researchers compared models built with extensive hyperparameter optimization against models using a fixed set of pre-optimized hyperparameters, and found that optimization did not provide consistent improvement. Models with pre-set hyperparameters gave similar performance while requiring roughly 10,000 times fewer computational resources. In 18 of 34 pairwise comparisons, the models without fresh tuning actually performed better.⁠[3]

The proposed explanation is overfitting by hyperparameter selection: when the same data, or the same statistical measure, guides the choice of settings and then reports how good those settings are, the reported score can improve without the model improving. The risk grows as the search space grows and as the dataset shrinks, because a small dataset gives a noisy estimate of performance, and a search that tries enough configurations will find one that happens to score well on that particular estimate. The authors note that for many biological and physicochemical properties, datasets run from a few hundred to at most a thousand data points, and at that size performance fluctuates strongly between data splits, so a configuration can be optimal for one split and mediocre in general.⁠[3] The safeguard is procedural: the settings should not be judged on the same data used to choose them, a discipline taken up later in this chapter.

A benchmark study of tunability reached a compatible conclusion from a different direction. Using 59 datasets from the OpenML platform, researchers asked whether particular hyperparameters need to be tuned at all or can safely be left at a default value, and found that leaving certain hyperparameters at their defaults was non-inferior to tuning them; in some cases the default even outperformed tuning with a search procedure limited to a small number of iterations.⁠[22] The lesson is not that tuning never helps but that its value is unevenly distributed across the settings of a model, and a search that spends its budget on the settings that barely matter is spending it badly.

Reading the evidence

The pattern across these studies is consistent with a simple rule. Tuning helps most when the gap between defaults and good settings is large, when evaluations are cheap enough to afford many of them, and when the performance estimate guiding the search is reliable. It helps least when the dataset is small, the noise is large, or the search is so extensive that it begins to fit the validation data rather than the problem. The choice of search method is a second-order question that only arises once those conditions are met, and even then the ranking of methods shifts with the problem: Bayesian optimization won in one comparison, random search in another, and neither dominated.⁠[1][2]

Tuning is not free improvement. It pays when defaults are far off and the performance signal is trustworthy, and it can quietly buy a better score on the data used to choose the settings without buying a better model.

None of this makes the search pointless, and none of it settles which strategy to use. It does mean that the decision to tune, and how hard, is itself a judgment about the problem rather than a step to be performed by reflex. The practical question of how to run a search once that judgment is made, from choosing a starting strategy to documenting what was tried, is taken up next.

In practice

Using hyperparameter optimization in practice

A practitioner facing a new model and a new dataset has, by this point in the chapter, a menu of search strategies and a body of evidence about how they compare. What the menu does not supply is an order of operations. The practical question is not which method is best in the abstract but which to reach for first, when to escalate to something more elaborate, and how to keep a record of what was done. A few habits, drawn from the methodological literature and from the way the tools are built, make the difference between a search that is worth its cost and one that merely consumes it.

Start simple, then escalate

The sensible first move is a random search over the ranges the hyperparameters are allowed to take. It requires almost no setup, it makes no assumptions about the shape of the performance surface, and because no trial depends on the result of another it parallelizes without effort. A review of the field's methods lists random search among the simple HPO techniques, alongside more advanced methods such as evolution strategies, Bayesian optimization, Hyperband, and racing.⁠[6] Running a random search first also produces something valuable in its own right: a map of which regions of the configuration space produce workable models and which produce failures, obtained before any surrogate model is asked to reason about them.

Escalation is warranted when evaluations are expensive. If a single training run takes hours, the budget of runs is small, and a method that learns from each result to choose the next is worth its overhead. Bayesian optimization is the natural next step, and the SMAC3 package offers a robust and flexible framework for it that can improve performance within a few evaluations, with pre-sets for typical use cases such as optimizing hyperparameters or configuring an algorithm across multiple problem instances.⁠[23] The same package illustrates a practical virtue of the mature tools: the search is configured rather than coded, so the effort goes into defining the problem instead of implementing the optimizer.

Define the search space with care

A search can only return what its space contains, and a space drawn too widely wastes evaluations on configurations that were never plausible while one drawn too narrowly can exclude the best setting entirely. The ranges matter as much as the algorithm that samples them. A benchmark study of tunability, using 38 datasets from the OpenML platform and six common machine learning algorithms, set out to quantify how much each hyperparameter of each algorithm actually repays tuning, and its results yield default values together with guidance on which parameters are worth the effort and which spaces are adequate for tuning them.⁠[24] The practical implication is that not every hyperparameter deserves a place in the search: a budget spread over settings that barely move performance is a budget not spent on the ones that do.

The same study offers a way to decide whether to search at all. Its measures are designed to let a user judge whether a possibly time-consuming tuning strategy is worth conducting for a given algorithm and dataset.⁠[24] That is a more useful question than the generic one, because the answer depends on the model. Some algorithms arrive with defaults close to good and some do not, and the difference determines whether the search will find much.

Know what the defaults already give you

Defaults deserve more respect than they often receive. The random forest is a case in point: it has several hyperparameters that must be set, including the number of observations drawn for each tree, the number of variables drawn for each split, the splitting rule, the minimum node size and the number of trees, and it is well known that in most cases the algorithm works reasonably well with the default values specified in software packages, though tuning can still improve performance.⁠[25] That is a useful calibration. A default is not a failure to tune; it is a starting point whose distance from the optimum varies by model and by data, and the size of that distance is what a search is buying down.

Plan for the cost before committing

The resource question should be settled before the search begins rather than discovered halfway through. Two levers reduce cost without changing the search algorithm. The methodological literature on running HPO in practice gives practical recommendations on runtime improvements and parallelization, alongside performance evaluation and combining HPO with machine learning pipelines. Both are properties of how the search is run rather than of which strategy is chosen, and the methodological literature on running HPO in practice gives practical recommendations on runtime improvements and parallelization, alongside performance evaluation and combining HPO with machine learning pipelines.⁠[6] A search planned around the resources actually available will be run to completion; one planned around an imagined cluster may not be run at all.

Write down what was tried

The last habit is the least technical and the most often skipped. A tuning run produces a history: which configurations were evaluated, what each scored, and which was finally chosen. That history is the evidence for the configuration, and without it the settings in a finished model are unexplained numbers. Recording the search space, the strategy, the budget and the selection criterion costs little at the time and is what allows another person to retrace the work, or the same person to retrace it months later. Tooling helps here as well: the Hyperopt library provides facilities for describing search spaces and analyzing the results collected in the course of minimization.⁠[7] The risks that make this record essential, including the possibility that an extensive search fits the validation data rather than the problem, are covered later in this chapter.

Run a random search first, escalate to a guided method when evaluations are expensive, keep the space honest, and keep the log.

Start with a random search, escalate to a guided method when evaluations are expensive, and document the search.

Current directions and open problems

The methods described so far treat each tuning problem as if it stood alone. A search begins with no knowledge, samples configurations, and ends with a set of settings that suits one model on one dataset. That isolation is wasteful in a way that becomes obvious once a practitioner tunes the same kind of model repeatedly: the second search rediscovers much of what the first one learned. Meta-learning, in this context, means carrying knowledge from previous tuning problems into a new one, so that the search starts from experience rather than from nothing. One approach learns the geometry of the search space itself from evaluations of earlier black-box functions, replacing the usual practice of defining arbitrary ranges in advance with search spaces shaped by historical data; combined with random search, this yields a parameter-free strategy that reduces the size of the space and so accelerates optimization.⁠[26] The idea is not to find better configurations by cleverer sampling but to shrink the region that must be sampled at all.

A flowchart of boxes with icons and captions: data collection and pre-processing, model definition (Decision Tree Classifier), hyperparameters search space definition (max_depth, min_samples_leaf), Optuna optimization, and model training with optimal hyperparameters, connected by arrows.
A flowchart of boxes with icons and captions: data collection and pre-processing, model definition (Decision Tree Classifier), hyperparameters search space definition (max_depth, min_samples_leaf), Optuna optimization, and model training with optimal hyperparameters, connected by arrows. View full-size image.Standard pipeline for the optimization of hyperparameters for the training of a Decision Tree Classfier using Optuna by Susauron. CC BY-SA 4.0, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

A related line of work moves the adaptation inside the learning algorithm. Rather than fixing a learning rate or a weight decay coefficient before training and tuning it from outside, a small meta-network can generate those values per step, adapting them as the model trains; this adaptive learning of hyperparameters for fast adaptation was shown to be an equally important ingredient in few-shot learning, with fast adaptation from random initialization with ALFA already outperforming MAML.⁠[27] Here the hyperparameter stops being a setting chosen before the run and becomes something produced during it, which blurs the line between tuning and learning that the earlier sections of this chapter drew.

Searching architecture and settings together

A separate assumption has also come under pressure: that the architecture of a network is settled first and its hyperparameters tuned afterwards. In practice the two interact, and a study of neural architecture search found that architectural choices and other hyperparameter settings interact in a way that can make this separation suboptimal. The same work examined a second common shortcut, using very few training epochs during the architecture search and many more in a later post-processing step, and found it inefficient because the relative rankings of candidates under the two training regimes correlate little. The proposed remedy is to search the two jointly, using a combination of Bayesian optimization and Hyperband for efficient joint neural architecture and hyperparameter search.⁠[28] The finding is a caution about staged pipelines in general: a decision made cheaply at one stage may not survive the conditions of the next.

Spending less per evaluation

Cost remains the constraint that shapes most of this work. Multi-fidelity methods attack it by evaluating configurations at reduced fidelity, on a subset of the data or for fewer epochs, and reserving full evaluations for the candidates that survive. The joint search above combines Bayesian optimization with Hyperband, and the broader family of multi-fidelity methods was surveyed alongside evolution strategies, Bayesian optimization and racing in a review of the field's methods and practical recommendations.⁠[6] The open question is how far fidelity can be cut before the ranking it produces stops agreeing with the ranking full training would give, a trade-off that the earlier discussion of early stopping framed as a property of the problem rather than of the algorithm.

Explaining what the search found

A final direction concerns trust rather than speed. Automated search returns a configuration and a score, but little about why that configuration works or how sensitive the result is to each setting, and this lack of insight makes it difficult to trust and understand the process and its results.⁠[29] A partial answer comes from applying interpretable machine learning to the data the search itself produced. Bayesian optimization concentrates its sampling in promising regions, which biases the data collected during the search, so a variant of the partial dependence plot was introduced that uses the surrogate model's posterior uncertainty to attach estimated confidence bands, together with a partition of the hyperparameter space that yields more reliable plots within relevant sub-regions.⁠[29] A systematic review of optimization techniques for convolutional networks aims to help researchers choose a method for a particular problem and dataset while flagging unresolved issues in the field.⁠[30] What unites these threads is a shift in what counts as a good search: not only the score it reaches, but what it costs, what it can reuse, and what it can explain.

The frontier is less about finding a better configuration than about reusing past searches, searching architecture and settings together, evaluating cheaply, and explaining what the search found.

The risks that make careful bookkeeping essential, including the possibility that an extensive search fits the validation data rather than the problem, are covered later.

Criticism

Overfitting and other pitfalls

The validation set as a second training set

A diagram titled "K-cross fold validation (K=4)" showing four rows of red and green balls split into training and test segments for each of four folds, with Catalan labels.
A diagram titled "K-cross fold validation (K=4)" showing four rows of red and green balls split into training and test segments for each of four folds, with Catalan labels. View full-size image.Cross-Validation by Joan.domenech91. CC BY-SA 3.0, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

The search for good hyperparameters is itself a form of learning, and like any learning it can fit too closely to the data that guides it. Each configuration is scored on a validation set, and the configuration that wins is the one that scored best on that particular set. When many configurations are tried, the winner is not necessarily the best configuration in general; it may simply be the one that happened to suit the validation data best. The reported score then overstates how the model will perform on genuinely new data. This is overfitting by hyperparameter selection: the settings are chosen and then judged on the same evidence, so the judgment inherits the luck of the choice.⁠[3]

The mechanism is the same one that makes any model overfit, applied one level up. A model with many parameters can memorize noise in its training data; a search over many configurations can memorize noise in its validation scores. The risk is greater for small datasets, where performance fluctuates strongly between data splits, and heavy hyperparameter selection on small sets should be carefully addressed. For many biological and physicochemical properties, datasets run from a few hundred to at most a thousand data points, and at that size performance fluctuates strongly between data splits, so a configuration can be optimal for one split and mediocre in general.⁠[3]

Keeping selection and evaluation apart

The safeguard is procedural rather than algorithmic, and it is simple to state: the data used to choose the settings must not be the data used to report how good they are. A model developed with tuning on one portion of the data should be evaluated on a portion the search never saw. The point is easy to accept in principle and easy to violate in practice, because the most convenient number to report is the one the search was already optimizing.

The violation can be subtle. In a study that re-examined a published solubility prediction pipeline, the original authors had performed their cross-validation correctly, in the sense that data from the test folds were not used to tune the hyperparameters; even so, comparing their tenfold cross-validation results with models built on pre-optimized settings showed that the extensive tuning had produced overfitted results.⁠[3] Correct fold discipline, in other words, is necessary but not sufficient. When the same statistical measure guides the selection and reports the outcome, the reported figure can improve while the underlying model does not.

A related trap appears in competitions with public leaderboards. Because teams can submit repeatedly and see their scores, the leaderboard becomes a validation set that the whole field tunes against. The organizers of a solubility challenge noted that higher performance on the public leaderboard was most likely due to its exposure to multiple submissions by each team, leading to overfitting, and a similar effect was observed in a toxicity challenge where leaderboard scores were higher than scores on the blind set.⁠[3] The lesson transfers directly to ordinary tuning: every look at the validation score is a submission, and enough of them turn the validation set into a training set.

The cost of looking, and the cost of not recording

The second family of pitfalls is practical. A thorough search multiplies training runs, and the multiplication is not gentle. In the solubility study, models using a fixed set of pre-optimized hyperparameters gave similar performance to extensively tuned ones while requiring more than 10,000 times fewer computational resources.⁠[3] That figure is specific to one comparison, but the shape of it is general: the last increments of accuracy are bought with disproportionate computation, and the buyer should know the exchange rate before committing.

Cost also creates a reproducibility problem. When a result depends on a long search, reproducing it means repeating the search, which may be beyond the resources of anyone reading the paper. The solubility authors found that although the original scripts were publicly available, reusing them was challenging, and that the optimized hyperparameters, developed models and calculated values had not been deposited, making reproduction extremely difficult if not impossible; they recommended reporting intermediate logs of results alongside scripts, particularly for calculations that require extensive computation to reproduce.⁠[3] A configuration without its search history is an unexplained number, and an unexplained number cannot be checked.

Transparency is uneven in practice. An analysis of 64 machine learning related manuscripts published in three leading political science journals between 2016 and 2021 found that only 13 publications, about 20 percent, reported the hyperparameters and how they were tuned, in either the paper or the appendix. The same work illustrates the dangers of cursory attention to model and tuning transparency by comparing models that predict electoral violence from tweets, and argues that tuning and its documentation should become a standard component of robustness checks.⁠[5] The recommendation is modest and hard to argue with: state the space searched, the strategy used, the budget spent and the criterion for choosing, so that a reader can judge the result rather than take it on faith.

None of this argues against tuning. It argues for treating the search as part of the model, with its own capacity to overfit and its own cost to account for. A review of the field's methods gives practical recommendations regarding important choices in conducting hyperparameter optimization, including the HPO algorithms themselves, performance evaluation, runtime improvements, and parallelization.⁠[6] The habits that follow are unglamorous: hold out data the search never touches, prefer the simpler configuration when scores are close, report the search as well as its winner, and remember that a better number on the validation set is evidence, not proof, of a better model.

A search that is judged on the data that guided it will always look better than it is; the fix is a held-out set, an honest log, and a willingness to accept that the simpler configuration may be the better one.

Key studies

YearStudySampleDesignFinding
2015Czarnecki et al.⁠[2]21 protein targets and six fingerprintscomparative classification experimentsBayesian optimization gave the highest accuracy in 80 experiments versus 22 for grid search.
2016Lisha et al.⁠[8]suite of HPO problemsalgorithm comparisonHyperband provided over an order-of-magnitude speedup over the competitor set.
2018Probst et al.⁠[24]38 datasets from OpenML and six algorithmslarge-scale benchmarking studyThe study produced default values and measures of how much each hyperparameter is worth tuning.
2020Gao & Ding⁠[11]breast cancer and cardiovascular disease datasetscomparative ML study with fivefold cross-validationBayesian optimization was more stable than grid and random search, and XGBoost reached 94.74% accuracy on breast cancer and 73.50% on cardiovascular disease.
2020Weerts et al.⁠[22]59 datasets from OpenMLbenchmark study with non-inferiority testsLeaving some hyperparameters at defaults was non-inferior to tuning, and sometimes better than a limited search.
2021Han et al.⁠[9]N = 7,539 animals and M = 48,541 markers (simulated), plus N = 910 individuals and M = 28,916 markers (real)differential evolution tuning of deep learning modelsTuned models predicted better on all three datasets with less overfitting and less variation.
2024Wojciuk et al.⁠[21]three public image datasetscomparison of four HPO methods for fine-tuned CNNsTuning improved accuracy by up to 6%, and balanced class distribution in the tuning subset mattered.
2024Tetko et al.⁠[3]seven solubility datasetscomparison of tuned and pre-set hyperparametersOptimization did not always improve models, and pre-set values cut effort by around 10,000 times.
2024Arnold et al.⁠[5]64 machine learning manuscripts in three political science journalsreview of published papersOnly 13 publications (20.31 percent) reported their hyperparameters and how they tuned them.

See also

References

  1. Vincent, A. M., & Jidesh, P. (2023). An improved hyperparameter optimization framework for AutoML systems using evolutionary algorithms. Scientific Reports, 13(1). doi:10.1038/s41598-023-32027-3
  2. Czarnecki, W. M., Podlewska, S., & Bojarski, A. J. (2015). Robust optimization of SVM hyperparameters in the classification of bioactive compounds. Journal of Cheminformatics, 7(1). doi:10.1186/s13321-015-0088-0
  3. Tetko, I. V., van Deursen, R., & Godin, G. (2024). Be aware of overfitting by hyperparameter optimization! Journal of Cheminformatics, 16(1). doi:10.1186/s13321-024-00934-w
  4. Tabares-Soto, R., Orozco-Arias, S., Romero-Cano, V., Segovia Bucheli, V., Rodríguez-Sotelo, J. L., & Jiménez-Varón, C. F. (2020). A comparative study of machine learning and deep learning algorithms to classify cancer types based on microarray gene expression data. PeerJ Computer Science, 6, e270. doi:10.7717/peerj-cs.270
  5. Arnold, C., Biedebach, L., Küpfer, A., & Neunhoeffer, M. (2024). The role of hyperparameters in machine learning models and how to tune them. Political Science Research and Methods, 12(4), 841-848. doi:10.1017/psrm.2023.61
  6. Bischl, B., Binder, M., Lang, M., Pielok, T., Richter, J., Coors, S., Thomas, J., Ullmann, T., Becker, M., Boulesteix, A., Deng, D., & Lindauer, M. (2023). Hyperparameter optimization: Foundations, algorithms, best practices, and open challenges. WIREs Data Mining and Knowledge Discovery, 13(2). doi:10.1002/widm.1484
  7. Bergstra, J., Komer, B., Eliasmith, C., Yamins, D., & Cox, D. D. (2015). Hyperopt: a Python library for model selection and hyperparameter optimization. Computational Science & Discovery, 8(1), 014008. doi:10.1088/1749-4699/8/1/014008
  8. Lisha, L., Jamieson, K., DeSalvo, G., Rostamizadeh, A., & Talwalkar, A. (2016). Hyperband: A Novel Bandit-Based Approach to Hyperparameter Optimization. arXiv. doi:10.48550/arxiv.1603.06560 Free full text
  9. Han, J., Gondro, C., Reid, K., & Steibel, J. P. (2021). Heuristic hyperparameter optimization of deep learning models for genomic prediction. G3 Genes|Genomes|Genetics, 11(7). doi:10.1093/g3journal/jkab032
  10. Ghawi, R., & Pfeffer, J. (2019). Efficient Hyperparameter Tuning with Grid Search for Text Categorization using kNN Approach with BM25 Similarity. Open Computer Science, 9(1), 160-180. doi:10.1515/comp-2019-0011
  11. Gao, L., & Ding, Y. (2020). Disease prediction via Bayesian hyperparameter optimization and ensemble learning. BMC Research Notes, 13(1). doi:10.1186/s13104-020-05050-0
  12. Galuzzi, B. G., Giordani, I., Candelieri, A., Perego, R., & Archetti, F. (2020). Hyperparameter optimization for recommender systems through Bayesian optimization. Computational Management Science, 17(4), 495-515. doi:10.1007/s10287-020-00376-3
  13. Falkner, S., Klein, A., & Hutter, F. (2018). BOHB: Robust and Efficient Hyperparameter Optimization at Scale. arXiv. doi:10.48550/arxiv.1807.01774 Free full text
  14. Wang, J., Xu, J., & Wang, X. (2018). Combination of Hyperband and Bayesian Optimization for Hyperparameter Optimization in Deep Learning. arXiv. doi:10.48550/arxiv.1801.01596 Free full text
  15. Loshchilov, I., & Hutter, F. (2016). CMA-ES for Hyperparameter Optimization of Deep Neural Networks. arXiv. doi:10.48550/arxiv.1604.07269 Free full text
  16. Ali, Y., Awwad, E., Al-Razgan, M., & Maarouf, A. (2023). Hyperparameter Search for Machine Learning Algorithms for Optimizing the Computational Complexity. Processes, 11(2), 349. doi:10.3390/pr11020349
  17. Maclaurin, D., Duvenaud, D., & Adams, R. P. (2015). Gradient-based Hyperparameter Optimization through Reversible Learning. arXiv. doi:10.48550/arxiv.1502.03492 Free full text
  18. Pedregosa, F. (2016). Hyperparameter optimization with approximate gradient. arXiv. doi:10.48550/arxiv.1602.02355 Free full text
  19. Morales-Hernández, A., Van Nieuwenhuyse, I., & Rojas Gonzalez, S. (2023). A survey on multi-objective hyperparameter optimization algorithms for machine learning. Artificial Intelligence Review, 56(8), 8043-8093. doi:10.1007/s10462-022-10359-2
  20. Karl, F., Pielok, T., Moosbauer, J., Pfisterer, F., Coors, S., Binder, M., Schneider, L., Thomas, J., Richter, J., Lang, M., Garrido-Merchán, E. C., Branke, J., & Bischl, B. (2023). Multi-Objective Hyperparameter Optimization in Machine Learning—An Overview. ACM Transactions on Evolutionary Learning and Optimization, 3(4), 1-50. doi:10.1145/3610536
  21. Wojciuk, M., Swiderska-Chadaj, Z., Siwek, K., & Gertych, A. (2024). Improving classification accuracy of fine-tuned CNN models: Impact of hyperparameter optimization. Heliyon, 10(5), e26586. doi:10.1016/j.heliyon.2024.e26586
  22. Weerts, H., Mueller, A., & Vanschoren, J. (2020). Importance of Tuning Hyperparameters of Machine Learning Algorithms. arXiv. doi:10.48550/arxiv.2007.07588 Free full text
  23. Lindauer, M., Eggensperger, K., Feurer, M., Biedenkapp, A., Deng, D., Benjamins, C., Tim, R., Sass, R., & Hutter, F. (2021). SMAC3: A Versatile Bayesian Optimization Package for Hyperparameter Optimization. arXiv. doi:10.48550/arxiv.2109.09831 Free full text
  24. Probst, P., Bischl, B., & Boulesteix, A. (2018). Tunability: Importance of Hyperparameters of Machine Learning Algorithms. arXiv. doi:10.48550/arxiv.1802.09596 Free full text
  25. Probst, P., Wright, M. N., & Boulesteix, A. (2019). Hyperparameters and tuning strategies for random forest. WIREs Data Mining and Knowledge Discovery, 9(3). doi:10.1002/widm.1301
  26. Perrone, V., Shen, H., Seeger, M., Archambeau, C., & Jenatton, R. (2019). Learning search spaces for Bayesian optimization: Another view of hyperparameter transfer learning. arXiv. doi:10.48550/arxiv.1909.12552 Free full text
  27. Baik, S., Choi, M., Choi, J., Kim, H., & Lee, K. M. (2020). Meta-Learning with Adaptive Hyperparameters. arXiv. doi:10.48550/arxiv.2011.00209 Free full text
  28. Zela, A., Klein, A., Falkner, S., & Hutter, F. (2018). Towards Automated Deep Learning: Efficient Joint Neural Architecture and Hyperparameter Search. arXiv. doi:10.48550/arxiv.1807.06906 Free full text
  29. Moosbauer, J., Herbinger, J., Casalicchio, G., Lindauer, M., & Bischl, B. (2021). Explaining Hyperparameter Optimization via Partial Dependence Plots. arXiv. doi:10.48550/arxiv.2111.04820 Free full text
  30. Raiaan, M. A. K., Sakib, S., Fahad, N. M., Mamun, A. A., Rahman, M. A., Shatabda, S., & Mukta, M. S. H. (2024). A systematic review of hyperparameter optimization techniques in Convolutional Neural Networks. Decision Analytics Journal, 11, 100470. doi:10.1016/j.dajour.2024.100470

Cite this page: Atlas Nova editors. (2026). Hyperparameter optimization. Atlas Nova. https://velocer.io/atlas/hyperparameter-tuning/