How would you design a feature store for a large ML platform?
Written by the mlprep team · Updated
Design a feature store for a company running dozens of ML models in production. What problems does it solve, what are its core components, and what are the consistency and freshness challenges you'd need to address?
How to drive the interview#
Feature store design interviews are infrastructure interviews with ML-specific correctness constraints. Start by clarifying:
- Are we serving online low-latency models, offline batch models, or both?
- What entity types exist: users, items, merchants, sessions, transactions?
- What freshness do features need: daily, hourly, seconds?
- Do teams need a shared transformation framework or just storage/lookup?
- What are the correctness guarantees: point-in-time joins, lineage, data quality, access control?
Then structure the answer as: problem statement → feature definitions → offline store → online store → materialization → point-in-time correctness → monitoring/governance → operational failure modes.
A feature store is production infrastructure for ML features — a centralized repository that handles feature computation, storage, serving, and governance. The problems it solves are subtle but severe at scale.
The problems without a feature store#
Training-serving skew: The #1 silent killer of ML models in production. You train a model using Python/Pandas to compute feature X, then in serving you re-implement X in Java or SQL. Two implementations of the same feature will inevitably diverge — different null handling, different edge cases, timezone bugs. Your model sees one distribution of X at training time and a different distribution at serve time. Performance degrades and it's nearly impossible to debug because the model and serving code both look correct.
Feature duplication: Without a shared repository, every team computes their own "user's average spend in the last 30 days" — leading to dozens of slightly different implementations scattered across the company, wasting both computation and engineering effort.
Discovery and reuse: In a mature ML organization, there are thousands of features. Without governance, finding the right features for a new model, understanding how they were computed, and knowing whether they have data quality issues is a manual slog.
Core components#
Feature definitions: A central registry where features are defined once, in one language, and can be reused across models. Feast, Tecton, and Hopsworks all do this. The definition includes the transformation logic, the data sources it depends on, and metadata (owner, freshness SLA, tags).
Offline store: Historical features for training — a column-oriented data warehouse like BigQuery, Snowflake, or S3 + Parquet. You need point-in-time correct joins here: when training a model, you need to reconstruct what feature values were at the exact timestamp of each training label, not what they are today. This prevents label leakage and gives a faithful picture of the world at decision time.
Online store: Low-latency feature lookup for serving — Redis, DynamoDB, Cassandra, or Bigtable. When a request comes in, you look up the entity ID (user_id, item_id), fetch their feature vector in under 10ms, and feed it to the model. The online store holds the current state of features, pre-materialized.
Streaming layer: For features that need to be updated in near-real-time (e.g., "number of failed payment attempts in the last 10 minutes"), a streaming pipeline (Kafka + Flink or Spark Streaming) computes and writes features to the online store with seconds of latency.
Feature serving API: A thin service that abstracts over the underlying stores. Models query it like feature_store.get_features(entity_ids, feature_names).
- Feature definitions registry with transformation logic, sources, owner, and freshness SLA
- Offline store warehouse or Parquet; point-in-time correct joins
- Training data feature values as they were at each label's timestamp
- Streaming + batch materialization Kafka + Flink / Spark for near-real-time features
- Online store Redis, DynamoDB, Cassandra, or Bigtable keyed by entity ID
- Feature serving API
get_features(entity_ids, feature_names)in under 10 ms - Model reads features built from the same definitions used for training
Consistency: the hard part#
The offline and online stores are fundamentally different systems with different update patterns. Keeping them consistent requires discipline:
The same transformation code must run in both contexts. Tecton solves this by compiling feature transformations to both Spark (batch) and the streaming/online path from a single Python definition. Feast uses a push-based model where you materialize features from the offline store to the online store on a schedule.
Point-in-time correctness in the offline store means you must implement time-travel queries — "give me the feature value for user X as of timestamp T" — not just the latest value. This requires storing historical snapshots, which multiplies storage costs. Most feature stores implement this with an event log pattern where every feature update is written with a timestamp and you can query "what was the value at T?" efficiently.
Freshness SLAs: Different features have different freshness requirements. Static features like demographic data can be batch-refreshed daily. Dynamic features like "user's session activity in the last 5 minutes" need streaming updates. Your architecture must support both, and model teams need to understand the freshness guarantees of every feature they use.
Governance and data quality#
Features need lineage: which data sources feed them? If a data source goes down, which models are impacted? A well-designed feature store provides monitoring (feature value distribution drift alerts, null rate monitoring) and lineage tracking so you can quickly identify and respond to data quality issues upstream.
Interview red flags#
- Describing a feature store as "just a database" without separating offline (training) and online (serving) stores.
- Never mentioning point-in-time correct joins. Training on today's feature values for historical labels leaks the future into the model.
- Assuming the online and offline stores stay consistent automatically, with no plan for detecting train/serve skew.
- No freshness SLAs or fallback behavior when a streaming feature goes stale or the online store is down.
Go deeper on point-in-time correctness. How exactly would training data be generated without leaking future information?
The training data contract#
Every training row has an entity ID and a prediction timestamp:
user_id = 123
prediction_time = 2026-01-10 09:00:00
label_window = next 7 days
The offline feature retrieval job must return only feature values available at or before prediction_time. It should not return the latest feature value today.
Availability time matters#
Event time is when something happened. Availability time is when the feature pipeline could have known it. If a transaction happened at 8:55 but arrived at 9:05, it was not available for a 9:00 prediction. For leakage prevention, the join should enforce:
feature_available_time <= prediction_time
not merely:
feature_event_time <= prediction_time
Implementation pattern#
Store feature values as an append-only history:
entity_id, feature_name, feature_value, event_time, available_time
For each training row, join to the latest feature row for that entity where available_time <= prediction_time. Warehouses implement this with window functions, as-of joins, or specialized feature store retrieval APIs.
Backfills#
Backfills are dangerous. If you recompute historical features using corrected data that was not available at the time, you can improve training metrics artificially. Store backfill versions and make it explicit whether a training set uses production-available history or retrospectively corrected history.
Senior/staff framing#
Point-in-time correctness is the feature store's most ML-specific value. A key interview signal is whether you distinguish historical truth from historical availability. Models are deployed into availability constraints, not perfect hindsight.
Now design online serving. A fraud model needs 50 features in under 20ms. What happens on the critical path?
Online serving path#
The model service calls a feature serving API with entity IDs:
get_features(
entities = {user_id, merchant_id, card_id},
features = [user_30d_spend, merchant_chargeback_rate, ...]
)
The feature API batches lookups against a low-latency store such as Redis, DynamoDB, Cassandra, Bigtable, or an in-memory service. It returns a feature vector plus metadata: feature timestamp, freshness, default indicators, and missingness flags.
Latency budget#
For a 20ms feature budget:
- request parsing and auth: 1-2ms
- parallel online store reads: 5-10ms
- feature assembly/defaulting: 2-4ms
- network overhead: 2-5ms
Avoid per-feature calls. Fetch by entity and feature group in batch. Co-locate feature serving and model serving when latency is tight.
Freshness#
Not all features need the same freshness. Fraud features like "failed attempts in last 10 minutes" may need streaming updates. Demographic or account-age features can be daily. Each feature should advertise freshness SLA and last-updated time.
Failure modes#
The online path needs explicit behavior for missing or stale features:
- use trained default values plus missing indicators
- fall back to older feature values within a freshness bound
- use a simpler fallback model
- fail closed for high-risk decisions like fraud
- fail open for low-risk personalization if user experience matters more
The choice depends on product risk. A feature store design that does not discuss degraded behavior is incomplete.
How do you govern a feature store so dozens of teams can reuse features without creating hidden data quality problems?
Feature registry#
Each feature needs metadata:
- owner and oncall
- description and intended use
- entity key
- source datasets
- transformation code version
- freshness SLA
- expected value range
- null semantics
- PII/sensitivity classification
- downstream models using it
This turns features into owned production assets instead of anonymous columns.
Data quality#
Monitor at both offline and online layers:
- null rate
- distribution drift
- min/max/range violations
- freshness lag
- cardinality changes
- schema changes
- train-serving parity
Alerts should route to feature owners and list impacted models. Otherwise a broken upstream feature silently degrades multiple models.
Access control#
Feature stores often contain sensitive data. Enforce access at feature group level. Prevent teams from using restricted features in models where they are not allowed, especially for regulated domains like credit, employment, health, and ads targeting.
Deprecation#
Features need lifecycle management. If a team wants to change a feature definition, create a new version rather than silently changing semantics. Track downstream usage and provide migration windows.
Senior/staff framing#
A feature store is not just Redis plus parquet. It is a correctness and governance platform. The hard part is making feature reuse safe: teams should know whether a feature is fresh, legal, stable, point-in-time correct, and owned.
The key takeaway unlocks after you reveal an expert answer.
Key Takeaway
A feature store design should cover shared feature definitions, offline historical retrieval, online low-latency serving, streaming materialization, point-in-time correctness, freshness SLAs, data quality monitoring, lineage, access control, and degraded behavior. The core ML-specific challenge is preserving the prediction-time information boundary while making feature reuse safe across many teams.
Follow-up Questions to Test Yourself
Interviewers often pivot here once you cover the core concept.
- How would you handle a feature that's computed from another feature (derived features)? What are the dependency management challenges?
- Walk me through how you'd implement point-in-time correct joins in BigQuery for model training data creation.
- How would you design the alerting system for a feature store to catch data quality issues before they silently degrade model performance?
How confident do you feel explaining this?
Track your understanding or flag it to revisit before your next loop.
Related Questions
What is train-serve skew and how do you prevent it?
How would you design a recommendation system for Reddit?
How would you design Amazon's product search ranking system?
How would you design YouTube's harmful content detection system?