datarekha
MLOps Medium Asked at UberAsked at LinkedInAsked at AirbnbAsked at TwitterAsked at StripeAsked at DoorDash

What is a feature store and why is it critical for production ML systems?

The short answer

A feature store is a shared data platform that computes, stores, and serves ML features consistently for both training and serving. It eliminates training-serving skew by ensuring the same transformation code runs in both contexts, and it reduces duplicated work by letting teams share and discover features across models.

How to think about it

The problem without a feature store: a data scientist writes a Pandas transformation to compute a feature for training. An engineer re-implements the same logic in Java for the serving path. Six months later the two implementations drift — a silent bug that is nearly impossible to detect without ground-truth labels with short feedback loops.

What a feature store provides:

  • Single transformation definition — one Python function (or SQL) defines the feature. The store computes it for the offline training dataset and serves the same value online at inference time.
  • Online store (low-latency) — a key-value database (Redis, DynamoDB, Cassandra) pre-materialized for sub-millisecond point lookups at serving time.
  • Offline store (high-throughput) — a columnar store (S3 + Parquet, BigQuery, Snowflake) for training dataset generation via time-travel joins.
  • Feature discovery and reuse — teams browse a catalogue and reuse features rather than recomputing from raw data each time.
  • Point-in-time correctness — training data is joined with features as they existed at the label timestamp, preventing target leakage.
# Feast example — define a feature view
from feast import FeatureView, Field, Entity, FileSource
from feast.types import Float32

user_stats = FeatureView(
    name="user_stats",
    entities=[Entity(name="user_id", join_keys=["user_id"])],
    schema=[
        Field(name="purchase_count_7d", dtype=Float32),
        Field(name="avg_order_value_30d", dtype=Float32),
    ],
    source=FileSource(path="s3://features/user_stats.parquet", timestamp_field="event_ts"),
    ttl=timedelta(days=1),
)
# Training: retrieve historical features with point-in-time joins
training_df = store.get_historical_features(
    entity_df=label_df[["user_id", "event_timestamp"]],
    features=["user_stats:purchase_count_7d", "user_stats:avg_order_value_30d"],
).to_df()

# Serving: retrieve online features in microseconds
features = store.get_online_features(
    features=["user_stats:purchase_count_7d"],
    entity_rows=[{"user_id": "u123"}],
).to_dict()

Keep practising

All MLOps questions

Explore further

Skip to content