What is a feature store and when do you actually need one?
Written by the mlprep team · Updated
What is a feature store and when does a team actually need one? A lot of teams get by without one for years.
A feature store is infrastructure for managing ML features — it computes, stores, and serves features consistently for both training and production inference.
The problem it solves: training-serving skew#
The most common ML production bug is training-serving skew: the features computed during training are different from the features served at inference time. This happens constantly without a shared system.
A classic example: during training, you compute "user's average purchase value over the last 30 days" from your data warehouse using a batch SQL job. In production, you compute it differently — maybe from a different data source, with slightly different null handling, or with a different time window definition. The model was trained on one distribution of this feature and served a different one. Performance degrades silently.
The two stores#
Feature stores have two components with different requirements:
Offline store: Historical feature values for training. Needs to support point-in-time correct lookups — when you join features to training labels, you should only use feature values that were available before the label timestamp. Without this, you get data leakage: using a feature value that was computed with information from the future, inflating your training metrics. Typically backed by a data warehouse (BigQuery, Snowflake) or a columnar file store (Parquet on S3).
Online store: Low-latency feature serving for real-time inference. A request comes in, you need a user's features in under 10ms. Backed by a key-value store (Redis, DynamoDB, Cassandra). The online store is populated by streaming jobs or batch jobs that push pre-computed features.
Feature reuse#
The second major value: features are defined once and reused across models. Without a feature store, each team recomputes "user age bucket" or "item popularity score" independently, with divergent implementations. A feature store provides a catalog with versioned, documented feature definitions that any model can consume.
When you actually need one#
A feature store is overhead. You don't need it until:
- Multiple teams are building models on the same data and duplicating feature computation
- Training-serving skew is causing production issues and the root cause is feature inconsistency
- You have real-time features that need to be served at low latency and refreshed frequently
- Point-in-time correctness is critical (fraud, risk models where leakage is a real problem)
Small teams with one or two models are usually better off with simple, well-tested feature pipelines and careful code review. The complexity of a feature store only pays off at scale.
You mentioned point-in-time correctness — can you walk through a concrete example of where this goes wrong, and exactly how a feature store enforces it?
The concrete failure case#
Say you're building a churn prediction model. Your label is: "did the user cancel within 30 days of this date?" You join this to features including "number of support tickets opened in the last 7 days."
Naively, you join on user ID and take the latest feature value. But some of those support tickets were opened after the date you're predicting from. The model learns "users who opened support tickets around the time they churned are likely to churn" — which is trivially true and useless. At inference time, when you want to predict churn before it happens, those future tickets don't exist. Your model learned from the future and will fail in production.
This is data leakage through feature timing, and it's one of the hardest bugs to catch because your offline metrics look great.
How a feature store prevents it#
The offline store supports point-in-time correct joins (also called "time travel" or "as-of" joins). When you generate a training dataset, you specify:
features.get_historical_features(
entity_df=labels_with_timestamps, # user_id + event_timestamp
feature_refs=["user_stats:support_tickets_7d"]
)
The feature store returns the value of support_tickets_7d for each user as it was at event_timestamp — not the latest value. Under the hood, it queries the offline store for the most recent feature value before each label's timestamp.
This requires that the offline store logs feature values with their computation timestamp, not just their latest value. Feature stores like Feast, Tecton, and Hopsworks build this in. Building it yourself requires careful schema design in your data warehouse.
The subtlety of "available at prediction time"#
Even point-in-time correctness has nuance. If a feature is computed with a 2-hour lag (batch job runs at midnight, covers data through 10pm), then at 11pm the feature value is 25 hours stale. A correct point-in-time join uses the value from midnight — which is technically the latest available — but you should train with features that have the same effective lag they'll have in production. Otherwise you'll overfit to more recent information than you'll ever have at inference time.
The key takeaway unlocks after you reveal an expert answer.
Key Takeaway
A feature store solves training-serving skew (features computed differently in training vs. production) and enables feature reuse across teams. It has an offline store for training (with point-in-time correct joins to prevent data leakage) and an online store for low-latency serving. Don't build one prematurely — it pays off when you have multiple models sharing features, or when feature inconsistency is causing production issues.
Follow-up Questions to Test Yourself
Interviewers often pivot here once you cover the core concept.
- How would you design the pipeline to keep online and offline stores in sync, and what are the failure modes?
- What's the difference between batch features and streaming features in a feature store, and how would you handle both?
- How do you handle feature backfilling when you add a new feature to a model that's already deployed?
How confident do you feel explaining this?
Track your understanding or flag it to revisit before your next loop.
Related Questions