Interview conceptSystem Design

Metrics Monitoring And Experimentation

Asked of: Machine Learning Engineer

Last updated

Horizontal pipeline infographic showing stages: Data & exposure logging → Instrumentation & SRM → Metric computation & taxonomy → Experiment analysis & sequential testing → Drift & anomaly detection → Alerting & rollout/rollback. Clean editorial style.

What's being tested

Interviewers are checking your ability to define, instrument, monitor, and experiment on ML-driven metrics so models behave safely and improve reliably in production. Expect to show judgment about metric selection, statistical validity for A/B test designs, drift detection, alerting strategies, and how monitoring ties into model rollout and rollback. LinkedIn cares because model regressions or silent drift directly affect member experience and business outcomes; the engineer must reliably detect, diagnose, and act.

Core knowledge

  • Metric taxonomy: classify metrics as primary business (DAU, revenue-per-user), model quality (CTR, precision@k, NDCG), guardrail (latency, error-rate), and diagnostic (feature distributions, cohort breakdowns).

  • Experiment statistics: know hypothesis tests, type-I/II errors, pp-values, and that the required sample size for a continuous metric is n(Z1α/2+ZpowerΔ/σ)2n\approx\left(\frac{Z_{1-\alpha/2}+Z_{power}}{\Delta/\sigma}\right)^2 where Δ\Delta is detectable effect and σ\sigma is stddev.

  • Multiple comparisons & FDR: when monitoring many metrics or segments use Benjamini–Hochberg to control False Discovery Rate or Bonferroni for conservative familywise control; naive per-metric pp-values inflate false positives.

  • Sequential testing: understand fixed-horizon vs sequential tests (alpha-spending, SPRT, Bayesian), and that naïve peeking invalidates pp-values; use proper corrections or sequential-safe methods for long-running experiments.

  • Sample Ratio Mismatch (SRM): always validate randomization by checking assignment ratios; SRM indicates logging, instrumentation, or bucketing bugs—an early guardrail before analyzing metrics.

  • Drift detection: separate population drift (feature distribution) from concept drift (label relationship). Use KS-test, Population Stability Index (PSI), KL divergence, or model prediction-shift statistics; PSI > 0.1 is moderate drift.

  • Anomaly detection: baseline algorithms: rolling z-score, EWMA, CUSUM for small persistent shifts, and seasonality-aware decompositions; tune sensitivity to balance detection vs alert fatigue.

  • Attribution & exposure logging: for correct experiment evaluation log deterministic exposure events and impressions, not just clicks; without exposures you cannot compute accurate denominators or apply inverse-propensity weighting.

  • Offline vs online parity: track feature freshness, training-serving skew, and reproducing offline metrics; keep a short feedback loop (canary + shadow) to validate online behavior matches offline expectations.

  • Alerting strategy: tier alerts by severity (SLO breach, metric drift, experiment regression) and provide automated triage (top contributing segments, recent model versions, feature changes) to reduce toil.

  • Power & minimum detectable effect (MDE): specify MDE before running experiments; small MDE implies very large sample sizes—prioritize metrics that matter and aggregate thoughtfully (daily vs weekly).

  • Cohort & segmentation: predefine cohorts for diagnostic drilling (device, locale, new vs returning); beware slicing small cohorts which raises variance and false positives; use hierarchical testing to control errors.

Worked example — Design a scalable metrics monitoring system

First 30s: clarify scale (requests/sec, number of metrics), latency needs (real-time vs daily), and ownership (who acts on alerts). Declare assumptions: millions of users, both streaming and daily aggregated metrics, and A/B test experiments run continuously.

Skeleton pillars to communicate:

  1. Metric contract & instrumentation: a canonical metrics registry with definitions, ownership, and deterministic exposure logging to ensure correct denominators.

  2. Aggregation layer: two paths — low-latency streaming summaries for p99/real-time alerts and batch daily aggregates for stable metrics and experiments.

  3. Detection & alerting: combine statistical tests (SRM checks, sequential tests) with anomaly detectors (EWMA, CUSUM) and tiered alerting (auto-mitigate minor alarms; page SRE for SLO breaches).

  4. Experiment integration: tie metrics to assignment token, track treatment/control, run pre-specified analysis pipelines with multiplicity control and power checks.

  5. Operational tooling: dashboards, automatic diagnostic drilldowns (top-k segments, change in top features), runbooks and canary rollback hooks.

Key tradeoff: sensitivity vs alert fatigue — choose higher thresholds or aggregate windows to reduce false positives, but provide fast detection for regressions in critical metrics. Close by saying: if more time, I’d sketch event schema, select specific algorithms for the streaming path, and prototype SRM and FDR workflows end-to-end with canary rollouts.

A second angle — Design LinkedIn Learning course recommendations

Apply the same monitoring and experimentation principles to a recommender: pick primary metrics (course enroll rate, completion rate), engagement proxies (time-spent), and long-term value (skill acquisition signals). Instrument exposures for each recommended item and log downstream signals (start, complete, certification). Use counterfactual or IPS weighting when offline evaluation is biased by existing policy; run bandit or randomized experiments for exploration-exploitation balance. Monitor novelty and diversity guardrails to avoid filter bubbles, and set up cohort-aware drift detectors since learner behavior varies by career stage and seasonality.

Common pitfalls

Pitfall: Treating every statistically significant change as actionable. Small effects with large N often lack business or user impact; always assess practical significance and cost of remediation.

Pitfall: Starting without validating randomization and instrumentation. Failing SRM checks or missing exposure logs makes experiment results useless; run SRM and data-integrity tests before metric analysis.

Pitfall: Building monitoring as a pure infrastructure problem. Engineers often design pipelines but omit metric ownership, runbooks, or diagnostic tooling—alerts with no actioners become noise.

Connections

The interviewer may pivot to model deployment (canarying, rollback strategies), feature store issues (freshness and schema changes), or causal inference topics (backdoor adjustments, IPW) to dig into how you separate correlation from production-impacting causality. Be ready to connect monitoring results to retraining cadence and CI for models.

Further reading

Practice questions

Related concepts