What is a hyperparameter?
A hyperparameter is a setting of a machine learning model chosen before or for training by a person or a search method and not learned from data during training; learning rate, batch size, number of epochs, layer count and regularisation strength are examples.
Unlike a parameter, such as a weight learned from data in training, a hyperparameter sets how that learning happens and is chosen externally. Finding good values systematically is called hyperparameter tuning.
- Topic
- Machine learning, models and training
- Also known as
- Hyper-parameter
How a hyperparameter works
- Training hyperparameters, such as learning rate, batch size and epochs, set the speed and stability of learning.
- Architecture hyperparameters, such as layer count and hidden size, set model capacity.
- Regularisation hyperparameters, such as weight decay and dropout rate, limit overfitting.
- Values are chosen by validation performance; the test set is not used for this.
In more detail
Hyperparameters in LLM fine-tuning
In LLM fine-tuning and PEFT workflows, key hyperparameters extend beyond classic layer counts to LoRA rank (r), scaling factor (alpha), target modules, warmup ratio and gradient accumulation steps, while runtime decoding settings like temperature and top-p are separate inference parameters rather than training hyperparameters.
Schedules and optimiser hyperparameters
Some hyperparameters change deterministically during training according to a schedule, such as cosine learning-rate decay with linear warmup, rather than staying constant. They remain hyperparameters because their schedule rules are fixed externally rather than learned by gradient descent.
Hyperparameter transfer across scales (μP)
For large neural networks, scaling-aware techniques such as maximal update parametrisation (μP) allow practitioners to tune learning rates cheaply on a small proxy model and transfer them reliably to much larger models without exhaustive large-scale sweeps.
Commonly confused terms
| Term | How it differs |
|---|---|
| Evaluation metric | Hyperparameters are configuration choices fixed for a training run, while evaluation metrics (accuracy, F1, perplexity, loss) measure how well the resulting model performs. |
Why a hyperparameter matters for on-premises AI
Two models trained on the same data and architecture can differ greatly only because of hyperparameters; a wrong learning rate can make training diverge or crawl. Hyperparameter search is costly since each trial is a separate training run. One study showed random search is more efficient than grid search, as usually only a few hyperparameters markedly affect results. Recording chosen values is needed to reproduce results.
Fine-tuning its claims classifier, an insurer runs a small random search over learning rate and epochs; it measures each trial on the validation set and writes the best settings to the model registry.
Common questions
How does a hyperparameter differ from a parameter?
Parameters are learned from data in training. Hyperparameters are chosen before training and set how learning happens.
How are hyperparameters chosen?
By validation performance, using trial and error, grid or random search or more advanced search methods.
Related terms
Sources
- Goodfellow, Bengio and Courville, Deep Learning, MIT Press, 2016
- Bergstra and Bengio, Random Search for Hyper-Parameter Optimization, JMLR, 2012
In the glossary: Glossary, D to L