What is the difference between an evaluation metric and a loss function?

Quick Overview

Explain how a loss function differs from an evaluation metric in machine learning. Tests why training needs a differentiable surrogate, why metrics such as accuracy, F1 and AUC cannot be optimized directly, and how to close the gap between the two.

What is the difference between an evaluation metric and a loss function?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

What is the difference between an evaluation metric and a loss function? ```hint Ask who uses each number Think about what gradient descent needs from the quantity it minimizes, and compare that with what a person deciding whether to ship the model needs to know. ``` ### What a Strong Answer Covers - The role of each: what training optimizes versus what is used to compare, select and report models - Why a loss needs smoothness or tractability and why many metrics lack it - How the loss acts as a surrogate for the metric, with a case where the two disagree - Practical ways to close the gap between them ### Follow-up Questions - Why can't you train a classifier by running gradient descent directly on accuracy? - Validation loss rises while validation accuracy also rises. What is happening? - How would you train a ranking model when the metric you care about is NDCG? - When would you use a metric instead of the validation loss for early stopping or hyperparameter search?

Overview: Explain how a loss function differs from an evaluation metric in machine learning. Tests why training needs a differentiable surrogate, why metrics such as accuracy, F1 and AUC cannot be optimized directly, and how to close the gap between the two.

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

What is the difference between an evaluation metric and a loss function?

What a Strong Answer Covers Guidance

  • The role of each: what training optimizes versus what is used to compare, select and report models
  • Why a loss needs smoothness or tractability and why many metrics lack it
  • How the loss acts as a surrogate for the metric, with a case where the two disagree
  • Practical ways to close the gap between them

Follow-up Questions Guidance

  • Why can't you train a classifier by running gradient descent directly on accuracy?
  • Validation loss rises while validation accuracy also rises. What is happening?
  • How would you train a ranking model when the metric you care about is NDCG?
  • When would you use a metric instead of the validation loss for early stopping or hyperparameter search?