Offline online consistency
Quick answer
An offline feature store supports historical retrieval for training and batch scoring; an online store typically provides low-latency current features. Training-serving consistency means matching feature semantics, ordering, freshness and missing-value handling across these paths. Examples use standard-library Python; native Feast and Airflow are not executed. ByteMind execution is unverified.
Order matters
row={"speed":4,"temp":8}print([row[k] for k in ["temp","speed"]])Expected output (locally tested): [8, 4]. Model input order is part of the contract.
How it works
Use the same versioned transformation for batch and serving rather than reimplementing it in two languages without parity checks. A historical request reconstructs features as of its decision time. A current lookup can use a materialized cache, but must enforce entity authorization, freshness and schema version. Materialization copies eligible feature values to an online representation; it does not make a historical snapshot safe to use for every request. Test identical entity/time inputs through independent implementations and compare the output vector, missingness, feature order and lineage. A newer online value may legitimately differ from an earlier historical value, so compare only equal cutoffs. A late event must not overwrite a newer eligible event merely because it arrived later. Batch and stream replay should be idempotent. Monitor cache lag and reject or explicitly abstain when required features are stale. A small application can use a shared function and a versioned table instead of an operational feature-store service.
Reject stale cache
cached={"event":3,"value":9}; now=8; ttl=4print(cached["value"] if 0<=now-cached["event"]<=ttl else None)Expected output (locally tested): None. The latest cached value is too old.
Common mistakes
Comparing dictionaries without checking model input order can miss a vector mismatch. Filling stale data with zero silently changes semantics.
Practice and next steps
Implement two retrieval routes for the same synthetic events and compare both values and missing markers for three timestamps.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Offline online consistency — knowledge check
Apply offline online consistency to small examples and debugging scenarios.
Why share a transformation?
What is an online store optimized for?
Which inputs should a parity test compare?
Does every project need a feature store?
What should an expired required value trigger?