ML0047 Parameters

What are the differences between parameters and hyperparameters?

Two dashed panels from one image-classifier project: a config.yaml file listing learning rate, batch size, epochs, number of layers and dropout, and a model_checkpoint.pt file listing weight and bias tensors with sample values. Below them, a question asks how the two kinds of numbers differ.

The Problem: Two files sit side by side in the same image-classifier project. The first is a short config.yaml with a handful of settings. The second is a model checkpoint holding over a million numeric values. Both contain numbers that shape the final model, so what actually distinguishes them?

Answer

Parameters are the values a model learns from its training data, while hyperparameters are settings defined by the user that guide the training process and model architecture. Parameters represent the model’s internal knowledge and decision rules; hyperparameters govern how the model learns, influencing its architecture, training dynamics, and ultimately its ability to generalize to unseen data: choosing them well is crucial for building an effective model.

(1) Parameters: Internal variables learned from data (e.g., weights and biases); adjusted during training by the optimization algorithm; capture the model’s learned patterns and information.
(2) Hyperparameters: External configurations set before training (e.g., learning rate, batch size, number of layers); remain fixed during training and are not updated by the learning process; influence how the model learns and its overall structure.
(3) Who Updates Whom: The optimizer updates parameters by minimizing the loss; the practitioner (or a search procedure) updates hyperparameters by watching validation performance.

Diagram contrasting parameters updated inside the training loop with hyperparameters set outside before training begins

Figure 1: The two knobs of a model: parameters (weights, biases) live inside the training loop and are updated every step by the optimizer; hyperparameters (learning rate, batch size, depth, …) are set before training and shape how that loop behaves.

Mathematical Formulation:
\theta_{t+1} = \theta_t - \eta \, \nabla_\theta \mathcal{L}(\theta_t)
\lambda^* = \arg\min_{\lambda} \; \mathcal{L}_{\text{val}}\big(\hat{\theta}(\lambda)\big)

Where:

  • \theta denotes the parameters (weights and biases), updated every training step t by gradient descent.
  • \eta is the learning rate, itself a hyperparameter, set before training and never learned by the optimizer.
  • \lambda stands for hyperparameters generally; \hat{\theta}(\lambda) is the fully trained model under that setting, and the outer minimization over validation loss is hyperparameter search.

Login to view more content
Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *