KatInterview

Defining Core Metrics for a Web Threat Detection Classifier

Machine LearningModel answer
HardModel answerMachine LearningMetricsMachine LearningSystem Design

Last updated

Define and evaluate a primary metric for an automated web threat detection system, balancing user protection, false alarm friction, and ground-truth validation strategies.

Assume you are building an automated safety system embedded in a web browser that flags unsafe or malicious URLs (such as phishing, malware, or credential harvesting sites) in real time before a user interacts with them.

Design a comprehensive evaluation framework for this classifier by addressing the following key areas:

  1. North Star Metric: Define a single core metric that captures true user safety impact. Specify the exact mathematical unit of evaluation and why raw page-level offline metrics (like simple Precision or Recall) are insufficient.
  2. Guardrail Metrics: Propose specific guardrails to ensure that optimizing your primary metric does not inadvertently destroy user experience or system usability.
  3. Ground Truth & Sampling Strategy: Explain how you will obtain reliable, unbiased ground-truth labels—especially for pages that your model fails to flag (false negatives)—in an environment where labeled data is heavily imbalanced and dynamic.

Hints

Hint 1

Consider weighting your metrics by active user exposure (impressions or traffic) rather than treat every unique URL in the catalog equally.

Hint 2

Distinguish between blocking an unheard-of spam site vs. blocking a major search engine or bank domain (false positive impact).

Hint 3

Think about how to measure unseen malicious URLs (False Negatives) using randomized audit streams or post-hoc threat telemetry.