KatInterview

Designing a Low-Latency Feature Platform for Ranking Models

System DesignModel answer
MediumModel answerSystem Designfeature-storeml-system-designstreaming

Last updated

Design a platform that serves fresh features to a ranking model in milliseconds and also builds leak-free historical training sets, keeping the two paths consistent.

Your team runs ranking models for an ad or content-recommendation product. Models need many input signals (user history, item statistics, cross signals such as user × advertiser), and those signals come from both streaming events and daily batch jobs. You are asked to design a shared feature platform that the whole organization can use.

The platform must serve two very different consumers:

  • Online inference: when a request arrives, the ranker fetches features for one user and many candidate items within a tight latency budget.
  • Offline training: data scientists build historical training sets where every example sees only the feature values that would have been available at the moment of the original decision.

Walk through your design and cover:

  1. Abstractions and APIs: what concepts and calls does the platform expose to feature authors and model owners?
  2. Data flow: how are features ingested, computed, stored, and served?
  3. Consistency: how do you keep online and offline values aligned and avoid training/serving skew?
  4. Freshness and corrections: how do you handle fast-moving streaming features, late-arriving events, and historical backfills?
  5. Operations: how do you scale it, and how do you monitor data quality and reliability?

State your own assumptions about traffic, latency, entity counts, and freshness targets, and justify the main trade-offs you make.

Hints

Hint 1

Start by stating numbers (requests per second, candidates per request, latency budget, number of entities, event rate). They drive the choice of online store and the sizing.

Hint 2

The biggest risk is training/serving skew. Think about three layers of defense: one feature definition used by both paths, a single computation that writes to both stores, and logging the exact vectors that were served.

Hint 3

For point-in-time correctness, a join on event time alone is not enough. Ask when each value actually became available, and think about append-only history plus an as-of join.

Hint 4

For late events, separate what the online path can fix within a bounded lateness window from what only offline recomputation or label-side handling can fix.