Feature stores
A feature store defines each feature once and serves it two ways: an offline store for point-in-time-correct training sets and an online store for millisecond lookups at inference, so training and serving agree.
Analogy: One kitchen, one recipe per sauce: the archive keeps a dated jar of every past batch for testing, the counter keeps today's jar within reach for service, and both were filled from the same pot.
How it works
- A registry holds versioned feature definitions (entity, source, transformation, owner, TTL), searchable so teams reuse them.
- Batch or streaming materialization jobs compute each feature once and write both the offline and online stores.
- A point-in-time join gives each training row the latest feature value as of its timestamp, never a later one.
- Joining today's values onto old labels leaks the future: offline AUC soars, then production falls flat.
- Worth it when many models share real-time entity features; one batch model needs only a warehouse table.
Check yourself
Answer to mark it learned; your answers aren't scored.
Your company adopted a feature store. The offline store is filled by the platform's Spark job, but the app team fills the online store from its own Go service 'for speed'. The offline/online metric gap is still there. Most likely cause?
Go deeper
Full explanation
A feature store is a central system that defines, computes, stores and serves ML features, so every model uses the same logic in training and in production.
It has four parts:
- Registry: feature definitions (entity, source, transformation, owner, TTL), versioned like code and searchable for reuse.
- Offline store: full history in a warehouse or lake (BigQuery, Snowflake, Parquet/Delta) for building training sets.
- Online store: only the latest value per entity, in a key-value store (Redis, DynamoDB, Bigtable) for millisecond reads at inference.
- Materialization: batch or streaming jobs that compute each feature once and write both stores.
The key operation is the point-in-time join. Each training row is an entity plus a timestamp (user 42 at 14:03) and gets the latest feature value as of that moment, never a later one. Joining today's table onto last year's labels leaks the future: offline AUC soars and production falls flat (Training–serving skew).
Tools: Feast (open source), Tecton (acquired by Databricks in 2025), and the managed stores in Databricks, SageMaker and Google Cloud (Vertex AI, renamed Gemini Enterprise Agent Platform in 2026). Uber's Michelangelo platform popularized the pattern in 2017.
It earns its keep when many models share entity features under real-time serving: fraud, ranking, pricing, Recommendation systems. A single batch model is fine with a well-modeled warehouse table.
Code Feast: one definition, a training join and an online read
from datetime import timedelta
from feast import Entity, FeatureStore, FeatureView, Field, FileSource
from feast.types import Float32, Int64
# Definition (lives in the feature repo; `feast apply` registers it)
driver = Entity(name="driver", join_keys=["driver_id"])
stats = FeatureView(
name="driver_hourly_stats",
entities=[driver],
ttl=timedelta(days=1), # older values count as missing, not as current
schema=[Field(name="conv_rate", dtype=Float32),
Field(name="trips_today", dtype=Int64)],
source=FileSource(path="driver_stats.parquet", timestamp_field="event_timestamp"),
)
FEATURES = ["driver_hourly_stats:conv_rate", "driver_hourly_stats:trips_today"]
store = FeatureStore(repo_path=".")
# Training: point-in-time join. Each label row gets values AS OF its own timestamp.
train_df = store.get_historical_features(
entity_df=labels_df, # columns: driver_id, event_timestamp, label
features=FEATURES,
).to_df()
# Serving: same definitions, read from the online store (after `feast materialize`)
row = store.get_online_features(
features=FEATURES,
entity_rows=[{"driver_id": 1001}],
).to_dict()Real example
A food-delivery ETA model uses restaurant_avg_prep_time_7d. Before the feature store, training computed it in Spark over the final orders table, while serving computed it in Go from a cache refreshed hourly, and training rows silently included orders placed after the prediction time. Offline MAE was 3.1 minutes; production MAE was 5.4. After moving the feature into Feast, training uses point-in-time joins against the offline store and serving reads the same definition from Redis in ~2 ms. The offline/online gap shrinks to 0.2 minutes, and two other teams reuse the feature instead of rewriting it.
Trade-offs +3 · −3
+ You gain
- One definition for training and serving removes a whole class of skew bugs.
- Point-in-time joins make leakage-free training sets the default, not a heroic effort.
- Reuse and discovery across teams: compute a feature once, use it in many models.
− You pay
- Real infrastructure: two stores, materialization jobs, backfills and an on-call rotation.
- Streaming and on-demand features remain hard; most stores shine for batch features.
- Overkill for a few batch models, where a warehouse table plus a shared library does the job.
Use it when
Several models share entity features (user, merchant, item) and at least one serves in real time under a tight latency budget: fraud, ranking, pricing, ads.
Avoid it when
Batch-only scoring, one or two models, or features computed from the request itself. Most LLM apps don't need one: RAG needs an index, not a feature store.
Numbers to know 3
- Rule of thumb: online feature reads should be single-digit ms at p99, since a whole fraud or ranking call often gets ~50–100 ms.
- Point-in-time rule: use the latest value with feature_ts ≤ label_ts, and only if it is within the feature's TTL.
- Uber's Michelangelo (2017) popularized the offline/online feature store split.
Common pitfalls 4
- Plain joins on entity id to build training sets: you leak future values and inflate offline metrics.
- Feeding the online store from a different pipeline than the offline one, which brings back the skew you meant to kill.
- No TTLs: a three-week-old value is served as if it were current.
- Buying a platform before you have two models that share a feature.
Interview questions 2
Answer out loud first, then reveal.
What problem does a feature store actually solve?Show answer
Two problems. Consistency: the same feature logic must produce training data and serving inputs, or you get training-serving skew, so the store owns one definition and materializes it into an offline and an online store. Time: training rows need feature values as they were at prediction time, and the point-in-time join does that by default, which kills a common leakage bug. Reuse across teams is a bonus. The cost is real infrastructure, so I adopt one when several real-time models share entities, not for one batch model.
Explain a point-in-time join. Why is a normal join wrong?Show answer
Each training example is an entity plus the timestamp when the prediction would have happened. A point-in-time join picks, per row, the latest feature value at or before that moment, within a TTL. A normal join on user id grabs the current value, which can include events after the label's timestamp; in fraud, chargebacks that only arrived weeks later. The model learns from information it will never have in production, offline metrics look great, and online performance drops. Feast's get_historical_features or an ASOF JOIN in the warehouse does it correctly.