What makes a loss function an effective surrogate for a non-differentiable evaluation metric?

Quick Overview

Asks what makes a training loss a good surrogate for a metric that cannot be optimized directly, such as accuracy, F1, IoU or NDCG. Tests how well you understand the link between the loss used for training and the metric used to judge the model.

What makes a loss function an effective surrogate for a non-differentiable evaluation metric?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: hard

Interview Round: Other

What makes a loss function an effective surrogate for a non-differentiable evaluation metric? Many metrics used to judge models (accuracy, F1, IoU, NDCG) are piecewise constant in the model's outputs, so they cannot be minimized directly with gradient descent. Training therefore minimizes a different loss. ```hint Two ways to fail A surrogate can let you down while training runs, or after training has finished. Think about each case separately. ``` ```hint Compare on the margin Plot the 0-1 loss and the hinge loss against the margin $y f(x)$ and compare both their values and their gradients. ``` ### What a Strong Answer Covers - What makes a loss easy to optimize - How the surrogate's minimizer relates to the metric's - How the surrogate's values and error weighting compare with the metric's - Concrete surrogates for a few metrics - What to do about the remaining gap ### Follow-up Questions - Why is training directly on the 0-1 loss with gradient descent hopeless, even when the model itself is smooth? - Is every convex surrogate consistent for its metric? Give a case where a natural surrogate is not. - If you can only train with cross-entropy, how do you get the best possible F1? - What goes wrong when the surrogate is consistent but the model class cannot represent the optimal scores?

Overview: Asks what makes a training loss a good surrogate for a metric that cannot be optimized directly, such as accuracy, F1, IoU or NDCG. Tests how well you understand the link between the loss used for training and the metric used to judge the model.

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

What makes a loss function an effective surrogate for a non-differentiable evaluation metric?

Many metrics used to judge models (accuracy, F1, IoU, NDCG) are piecewise constant in the model's outputs, so they cannot be minimized directly with gradient descent. Training therefore minimizes a different loss.

What a Strong Answer Covers Guidance

  • What makes a loss easy to optimize
  • How the surrogate's minimizer relates to the metric's
  • How the surrogate's values and error weighting compare with the metric's
  • Concrete surrogates for a few metrics
  • What to do about the remaining gap

Follow-up Questions Guidance

  • Why is training directly on the 0-1 loss with gradient descent hopeless, even when the model itself is smooth?
  • Is every convex surrogate consistent for its metric? Give a case where a natural surrogate is not.
  • If you can only train with cross-entropy, how do you get the best possible F1?
  • What goes wrong when the surrogate is consistent but the model class cannot represent the optimal scores?