Behind every successful machine learning model are a handful of important decisions made before training even begins, choices like how fast the model should learn, how many layers it should have, or how many examples it should see at once. These settings are called hyperparameters, and getting them right is often the difference between a model that trains smoothly to strong performance and one that never quite works.

What Is a Hyperparameter?

A hyperparameter is a configuration setting for a machine learning model that is chosen before training begins and is not learned from the data during the training process itself. This distinguishes hyperparameters from a model’s actual parameters, such as the weights adjusted through backpropagation, which are learned automatically as the model trains. Hyperparameters, by contrast, are set by the person or team building the model, often through a combination of experience, experimentation, and systematic search.

In short, parameters are what the model learns; hyperparameters are what a practitioner decides ahead of time about how that learning process should happen in the first place.

Common Examples of Hyperparameters

Hyperparameters show up throughout the design of a machine learning system. Some of the most common include:

  • Learning rate: Controls how large a step the model takes when updating its weights during gradient descent. Too high, and training can become unstable; too low, and training crawls along far too slowly.
  • Batch size: The number of training examples processed together before the model’s weights are updated once. Larger batches give more stable gradient estimates but require more memory and compute per step.
  • Number of layers and units: How deep a neural network is, and how many neurons each layer contains, directly determines the model’s overall capacity and complexity.
  • Number of training epochs: How many full passes through the training dataset the model makes before training stops.
  • Regularization strength: How heavily the training process penalizes model complexity, directly influencing the balance between underfitting and overfitting.
  • Dropout rate: In neural networks, the fraction of neurons randomly ignored during each training step, used as a technique to reduce overfitting.

A Simple Analogy

Think of baking a cake. The actual ingredients that chemically transform during baking, flour binding with eggs, sugar caramelizing, are something like a model’s learned parameters, they change and interact as the process unfolds. But before any of that happens, a baker has to decide the oven temperature, how long to bake, and the size of the pan. These decisions are set in advance, based on experience or a recipe, and they are not something the batter figures out on its own as it bakes. Get the oven temperature badly wrong, and no amount of good batter will save the cake. Hyperparameters play exactly that role for a machine learning model: critical settings chosen up front that shape whether the actual learning process can succeed at all.

How Hyperparameters Are Chosen

Because hyperparameters are not learned automatically from data the way model weights are, practitioners rely on a mix of strategies to choose good values:

  • Manual tuning: Relying on prior experience and intuition from similar problems to pick reasonable starting values.
  • Grid search: Systematically trying every combination within a defined set of possible values for each hyperparameter, then comparing results.
  • Random search: Sampling random combinations of hyperparameter values, which often finds good settings more efficiently than an exhaustive grid search, especially when only a few hyperparameters really matter.
  • Automated hyperparameter optimization: Using algorithms, such as Bayesian optimization, that intelligently choose which combinations to try next based on the results of previous attempts, converging on strong settings more efficiently than brute-force search.

Whichever method is used, hyperparameter choices are typically evaluated by training the model and checking its performance on a separate validation set, since the whole point is to find settings that help the model generalize well rather than just memorize its training data.

Why Hyperparameters Matter

The same model architecture, trained on the exact same data, can produce dramatically different results depending purely on its hyperparameter settings. A learning rate that is too high can prevent a model from ever converging to a good solution; a regularization term that is too strong can leave a model badly underfit even though it had plenty of capacity to perform well. In this sense, hyperparameters act as the control knobs that determine whether a model’s learning process even has a fair chance to succeed.

This is also why so much of practical machine learning work involves not just designing a model architecture but carefully searching for the right hyperparameter settings for a specific dataset and task. Getting the underlying model design right is necessary, but without sensible hyperparameters to guide the training process itself, even the best architecture can fail to reach its potential.