Why can hyperparameters not be learned directly via gradient descent on the training dataset?

Quick Overview

Asks why hyperparameters such as regularization strength or model depth are not fit by gradient descent on the training data. It tests whether you know what objective hyperparameters should be judged on, which ones have usable gradients, and how tuning is done in practice.

Why can hyperparameters not be learned directly via gradient descent on the training dataset?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Why can hyperparameters not be learned directly via gradient descent on the training dataset? ```hint Follow one hyperparameter Take an L2 penalty weight and ask which direction a gradient step on the training loss would push it. ``` ```hint Check differentiability List a few hyperparameters you have tuned and check whether the loss is even a differentiable function of each one. ``` ### What a Strong Answer Covers - Why training loss is the wrong objective for hyperparameters, with a concrete hyperparameter as the example - Which hyperparameters are discrete, categorical or part of the training procedure itself - The bilevel structure of the problem and what computing a hypergradient would require - The gradient-based methods that do exist and why black-box search is used more often ### Follow-up Questions - How would you compute the gradient of validation loss with respect to weight decay, and what does it cost in memory? - Why does random search often beat grid search for the same number of trials? - If you try hundreds of configurations against one validation set, what goes wrong and how do you guard against it? - How does Hyperband decide which configurations get more training budget?

Overview: Asks why hyperparameters such as regularization strength or model depth are not fit by gradient descent on the training data. It tests whether you know what objective hyperparameters should be judged on, which ones have usable gradients, and how tuning is done in practice.

General logo
General
Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

Why can hyperparameters not be learned directly via gradient descent on the training dataset?

What a Strong Answer Covers Guidance

  • Why training loss is the wrong objective for hyperparameters, with a concrete hyperparameter as the example
  • Which hyperparameters are discrete, categorical or part of the training procedure itself
  • The bilevel structure of the problem and what computing a hypergradient would require
  • The gradient-based methods that do exist and why black-box search is used more often

Follow-up Questions Guidance

  • How would you compute the gradient of validation loss with respect to weight decay, and what does it cost in memory?
  • Why does random search often beat grid search for the same number of trials?
  • If you try hundreds of configurations against one validation set, what goes wrong and how do you guard against it?
  • How does Hyperband decide which configurations get more training budget?