KatInterview

Audit a Feature Pipeline for Silent Failures, Then Design for Freshness

Machine LearningModel answer
HardModel answerMachine Learningfeature engineeringtraining-serving skewfeature store

Last updated

Spot every category of production risk in a passing-tests feature pipeline PR, then choose the right serving architecture for batch, near-real-time, and request-time features.

You are reviewing a pull request that rewrites part of a feature pipeline — the code responsible for turning raw event data into model inputs. Every unit test in the PR is green. The interviewer wants two things from you.

Part 1: Walk through the PR and explain what could silently break in production, even though the tests pass. Rank the issues by potential impact, and for each one describe how you would catch it before the change ships or detect it after.

Part 2: The same features need to be served to an online model under three different freshness requirements: values computed once a day are fine, values must reflect events from the last few minutes, and values depend on the live request itself. For each scenario, describe the architecture, its trade-offs, and how you keep training and serving consistent.


Setup and clarifying questions

Before diving in, a strong reviewer asks:

  • Are these features used at training time, inference time, or both? Does the same code path compute them in both places?
  • What are the upstream data sources — event streams, warehouse snapshots, or both — and how late can events arrive?
  • Is this a scheduled batch job, a streaming job, or a function called at request time?
  • What does the model or downstream system do when a feature value is missing or unexpectedly stale?

The answers shape which risks matter most and which serving tier is even feasible.


What Part 1 should cover

Identify the categories of production risk that passing unit tests cannot exercise. For each risk:

  • Describe what it looks like in code
  • Explain how it manifests in production (model behavior, pipeline failure, or silent data corruption)
  • Propose a pre-release check or post-release monitor

Focus on: temporal correctness (leakage, late events, window boundaries), data quality (nulls, duplicates, join fan-out, schema drift), training-serving consistency, and operational hazards (skew, memory, idempotency).


What Part 2 should cover

For each freshness tier, explain: where features are stored and how they are computed, what latency and cost profile to expect, what consistency guarantees are possible, and how the system degrades gracefully when the fresh path is slow or unavailable.

Hints

Hint 1

The most damaging bugs in feature pipelines are silent: the code runs, the tests pass, and the model quietly gets worse. Start your review by asking what the unit tests could not possibly have tested — future data, late arrivals, production data volumes, real upstream schemas.

Hint 2

For serving freshness, think in three tiers: precomputed batch values in a low-latency key-value store, streaming aggregates maintained by a job that runs continuously, and on-demand features computed inline at request time. Each tier adds freshness but also adds cost, latency, and operational surface area. Match the tier to what the feature actually needs.

Hint 3

Training-serving skew is a thread that runs through both parts. In Part 1, ask whether the pipeline that generates training labels uses the same code and the same data snapshot as the pipeline that serves features online. In Part 2, ask how you log exactly the feature values that were served so you can reconstruct them for retraining.