Why does random search often outperform grid search given an equal evaluation budget?

Quick Overview

Asks why random search tends to find better hyperparameters than grid search for the same number of training runs. Tests your understanding of how each method covers the search space as hyperparameters are added, how many trials a search needs, and when a grid is still a reasonable choice.

Why does random search often outperform grid search given an equal evaluation budget?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

You have a fixed budget of training runs to tune a model's hyperparameters. Grid search spends it on every combination of a few chosen values per hyperparameter; random search spends it on configurations sampled independently from each hyperparameter's range. Why does random search often outperform grid search given an equal evaluation budget? ```hint One axis at a time Assume only one of the hyperparameters really affects the score, and count how many different values of that one each method gets to try. ``` ```hint Add dimensions Look at how the cost of a grid and the number of values each hyperparameter sees change as you add hyperparameters. ``` ### What a Strong Answer Covers - What property of typical hyperparameter spaces decides the comparison - The projection argument, with a concrete count of distinct values tried - How cost and per-parameter coverage change with the number of hyperparameters for each method - Practical properties: continuous ranges, stopping early, and not needing to know which parameters matter - When grid search is just as good ### Follow-up Questions - How would you sample a learning rate between ${10^{-5}}$ and ${10^{-1}}$, and why? - How many random trials do you need for a 95% chance of at least one landing in the top 5% of configurations? - When would Bayesian optimization or Hyperband beat random search? - What do quasi-random designs such as Sobol sequences or Latin hypercube sampling add over plain random sampling?

Overview: Asks why random search tends to find better hyperparameters than grid search for the same number of training runs. Tests your understanding of how each method covers the search space as hyperparameters are added, how many trials a search needs, and when a grid is still a reasonable choice.

PracHub logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

You have a fixed budget of training runs to tune a model's hyperparameters. Grid search spends it on every combination of a few chosen values per hyperparameter; random search spends it on configurations sampled independently from each hyperparameter's range. Why does random search often outperform grid search given an equal evaluation budget?

What a Strong Answer Covers Guidance

  • What property of typical hyperparameter spaces decides the comparison
  • The projection argument, with a concrete count of distinct values tried
  • How cost and per-parameter coverage change with the number of hyperparameters for each method
  • Practical properties: continuous ranges, stopping early, and not needing to know which parameters matter
  • When grid search is just as good

Follow-up Questions Guidance

  • How would you sample a learning rate between 10−5{10^{-5}} and 10−1{10^{-1}} , and why?
  • How many random trials do you need for a 95% chance of at least one landing in the top 5% of configurations?
  • When would Bayesian optimization or Hyperband beat random search?
  • What do quasi-random designs such as Sobol sequences or Latin hypercube sampling add over plain random sampling?