Feature Stores

Share consistent features between training and serving with offline and online stores and point-in-time correct joins.

Advanced · about 5 hours · difficulty 3/5

Learn first: Serving Models with FastAPI and BentoML, SQL for Pulling Training Data

When several models reuse the same features (customer lifetime value, recent purchase counts) and need them both for training on history and for real-time serving, teams build a feature store. It is a coordination tool as much as a database.

What a feature store provides

  • Feature definitions as code, registered once and reused by many models.
  • An offline store (a warehouse or data lake) with full history for training.
  • An online store (a low-latency key-value database such as Redis) with the latest values for serving.
  • Materialization jobs that keep the online store fresh from batch or streaming sources.
  • Point-in-time correct joins so each training row only sees feature values that existed at that moment. This prevents a subtle form of leakage that hand-written joins often introduce.

Tools

Feast is the common open-source option. Managed versions exist in Databricks, SageMaker, Vertex AI and dedicated vendors such as Tecton and Hopsworks.

When you need one

Not on your first project. A feature store pays off when you have many models, real-time features, and repeated training-serving skew bugs. Before that, a well-organized set of SQL views or dbt models plus a shared feature module in Python is usually enough.

Good enough to move on when you can define features in Feast, generate a point-in-time correct training set, and fetch the same features online for a prediction request.

Key concepts

  • Offline vs online stores
  • Point-in-time correct joins
  • Feature definitions and reuse
  • Materialization jobs
  • Feast
  • Streaming features

Mini project

Model a small e-commerce dataset in Feast with two entities and five features, build a point-in-time correct training set, materialize to a local online store, and serve features to your FastAPI model.

Check yourself

What is a point-in-time correct join, and what leakage happens if you simply join the latest feature values onto historical labels?

Free resources