5.3.5MLOps & Deployment

Feature stores

2,008 words9 min readdifficulty · medium3 backlinks

WHY do feature stores exist?

WHAT a feature store gives you:

  • Single definition of each feature (write once, reuse everywhere).
  • Offline store (cheap, high-throughput) for building training sets.
  • Online store (low-latency key-value) for serving at inference.
  • Point-in-time correctness to prevent data leakage.
  • Discoverability (a searchable catalog of features).

The two stores — WHAT and WHY

Figure — Feature stores

Point-in-time correctness (the deep part)


Consistency guarantee (WHY skew disappears)


Anatomy / vocabulary


Common mistakes (Steel-man them)


Recall Feynman: explain to a 12-year-old

Imagine you're baking cookies. The recipe card says "add the amount of sugar you measured this morning." A feature store is like a shared recipe box for the whole kitchen: everybody uses the exact same recipe cards, so cookies taste the same whether you bake a huge batch (training) or just one cookie for a customer right now (serving). And there's a rule: when you check "how much sugar did we have?", you only look at the note from before you started, never sneak a peek at a note written after — otherwise you'd be cheating with information you didn't really have yet.


Flashcards

What core problem does a feature store solve?
Training–serving skew and feature duplication by giving one consistent definition served to both training and inference.
Define training–serving skew.
A mismatch between feature values used in training vs. those computed at inference, usually from different code paths or timing.
Offline vs online store — purpose of each?
Offline = high-throughput historical store for building training sets; Online = low-latency key-value store of latest values for real-time serving.
State the point-in-time join rule.
For a label at time tet_e, take the feature observation with the largest tit_i such that titet_i \le t_e (never from the future).
Why not use the latest feature value when building a training set?
It leaks future information into a past label → inflated offline metrics, failure in production.
What is materialization in a feature store?
The job that copies computed feature values from the offline store into the online store for fast serving.
What does TTL do to a feature?
Expires it: if the freshest observation is older than τ\tau relative to the event, the feature is treated as null/default.
What is an "entity" in feature-store terms?
The object a feature describes (e.g., user, product), identified by a join key.
Condition for zero skew (formula)?
foff(x)=fon(x) xf_{\text{off}}(x)=f_{\text{on}}(x)\ \forall x; enforced by a single registered feature definition.
Is a feature store just a database?
No — it's an abstraction over offline+online stores plus a registry, materialization engine and serving API.

Connections

  • Data leakage — point-in-time joins are the defence.
  • Training-serving skew — the core failure mode.
  • Model deployment — serving path uses the online store.
  • Batch vs streaming pipelines — how features get materialized.
  • Redis / DynamoDB — typical online stores.
  • Data versioning — features need reproducibility too.
  • Feature engineering — where the definitions come from.

Concept Map

solves

solves

degrades

provides

syncs to

syncs to

high throughput builds

low latency serves

joined via

prevents

picks value where

adds

Feature Store

Duplication of features

Training-serving skew

Deployed model

Single feature definition

Offline store

Online store

Training datasets

Inference prediction

Point-in-time join

Data leakage

t_i <= t_e

Searchable catalog

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, feature store ka basic idea simple hai: aapke ML model ke liye jo bhi "features" (jaise user ka last-30-days average spend) chahiye, unhe ek jagah ek hi baar define karo, aur wahi definition training aur production dono me use karo. Problem yeh hoti hai ki data scientist alag code likhta hai training ke liye (batch, Spark) aur engineer alag code likhta hai live serving ke liye. Dono thoda alag nikal jaate hain — isse hota hai training–serving skew, matlab model ko training me ek number dikha, production me doosra. Model chup-chap kharab ho jaata hai aur pata bhi nahi chalta.

Feature store me do parts hote hain. Offline store (Parquet/BigQuery) me poori history rehti hai — yahan se hum training dataset banate hain, throughput zyada chahiye, speed matter nahi karti. Online store (Redis/DynamoDB) me sirf latest value rehti hai — yahan se live prediction ke time milliseconds me lookup hota hai. Dono ko ek hi definition se sync (materialize) karte hain, isliye value same rehti hai — skew gaya.

Sabse important cheez hai point-in-time correctness. Training set banate waqt, kisi past event ke saath feature attach karte time, sirf woh value lo jo us event se pehle available thi (titet_i \le t_e). Agar tumne future ki value laga di, toh yeh data leakage ho gaya — offline accuracy 99% dikhegi, production me faddu. TTL bhi lagao taaki purani stale value model ko jhooth na bole.

Yaad rakho: feature store koi naya database nahi hai — yeh ek layer hai jo definition, consistency, aur fast serving deta hai. Exam aur real job dono me yeh MLOps ka core concept hai.

Go deeper — visual, from zero

Test yourself — MLOps & Deployment

Connections