Sub topic 1
Why feature stores exist: reuse and training-serving skew
This chapter explains the problem a feature store solves and introduces the Feast parts that handle it.
Prerequisites
You should be comfortable with:
- Python basics, including pandas DataFrames.
- The basic machine learning workflow: training data, features, labels, and model inference.
- Command-line use.
- The difference between batch data and real-time serving.
The problem: reuse and training-serving skew
A feature is an input value for a model, such as a driver's average trips per day. Teams often compute the same feature in several places: a notebook for training, a batch job for reports, and a service for live predictions. Each copy can drift. When training and serving compute a feature differently, the model sees different values in production than it learned from. This is training-serving skew. It often degrades predictions without raising an error.
A feature store defines each feature once and serves it to both training and inference.
How Feast is organized
Feast is an open-source feature store with three main parts:
- Registry: a catalog of entities, sources, and feature definitions, written by
feast apply. - Offline store: historical feature data, used to build training sets.
- Online store: a low-latency key-value store holding the latest feature values for inference.
Offline features
Offline features are historical values kept in files or warehouses. You read them in large batches to build training sets. Reads take seconds to minutes, and the data can reach terabytes.
Online features
Online features are the latest value for each entity, kept in a fast store such as SQLite for local tests or Redis in production. A lookup takes milliseconds, so a model can score a live request.
| Aspect | Offline store | Online store |
|---|---|---|
| Purpose | Build training sets | Serve predictions |
| Data | Full history | Latest value per entity |
| Access | Large batch reads | Single-key lookups |
| Typical latency | Seconds to minutes | Milliseconds |
Entities and join keys
An entity is the object a feature describes, such as a driver. A join key is the column that identifies that entity in your data. Feast matches feature rows to your rows using this key.
A minimal repository config looks like this:
project: driver_project
registry: data/registry.db
provider: local
online_store:
type: sqlite
path: data/online_store.db
offline_store:
type: fileExercise
A model is trained on hourly averages but receives minute-level values in production. What is this problem called, and which Feast practice reduces it?
Show answer
This is training-serving skew. Defining each feature once in a Feast feature view and using that same definition for training and serving reduces it.