How do you implement feature stores for ML model serving?
Feature stores manage the lifecycle of ML features from computation to serving. Problem solved: features computed during model training must be consistently available during inference, avoiding the training-serving skew that degrades model performance. Architecture: feature transformation (compute features from raw data using batch or streaming pipelines), offline store (historical feature values for model training, stored in data warehouse or object storage), online store (low-latency feature serving for real-time inference, stored in Redis, DynamoDB, or BigTable), and feature registry (metadata catalog documenting features, ownership, lineage, and usage). Implementation: Feast (open-source, supports multiple backends, good for getting started), Tecton (managed platform with advanced streaming features), and cloud-native options (Vertex AI Feature Store, SageMaker Feature Store). Feature computation: batch features (daily aggregations, historical patterns) computed via scheduled pipelines (Spark, dbt), streaming features (real-time counts, recent activity) computed via stream processors (Flink, Spark Streaming), and on-demand features (computed at request time based on current context). Feature serving: point-in-time correct joins for training (avoid data leakage by joining features as they existed at the time of each training example), low-latency online serving for inference (target under 10ms for feature retrieval), and batch feature retrieval for batch predictions. Feature management: version features (allow multiple versions to coexist), monitor feature freshness and quality, implement feature access controls, and track feature usage across models. Benefits: feature reuse across models (compute once, use in many models), consistency between training and serving, reduced data engineering overhead, and simplified model deployment (models reference features by name rather than implementing data pipelines).