Concept · ~8 min read

Feature Engineering

Feature engineering is the process of transforming raw data into the inputs that make ML models work — and a feature store is the system that ensures those inputs are computed consistently between training and serving.

Why this appears in interviews

Feature engineering is where most practical ML skill lives. Feature stores solve one of the most common production failures: training-serving skew.

The mental model — raw ingredients vs. cooked dish

Raw data: customer_id, last_purchase_date, account_created. Feature engineering produces: days_since_last_purchase: 15, account_age_days: 669, purchase_frequency_30d: 4.2. Feature quality determines the ceiling of model performance.

Categories of features

Raw features: Direct columns from your database. Easy to create, often low signal.

Aggregated features: Statistics over a time window. High signal, require careful computation to avoid leakage.

Ratio features: "Transaction amount / customer average." Captures relative behavior.

Interaction features: "Is this a weekend AND the customer's home city?" Captures joint patterns.

features: Dense vector representations of categorical variables.

The training-serving skew problem

Features computed during training differ from features computed during serving. Example: During training, you compute "avg transaction amount over past 30 days." In production, your pipeline has a 2-hour delay — "past 30 days" means "28 days and 22 hours." Tiny differences accumulate and the model underperforms expectations.

What a feature store solves

  • Computes features in one place — consistent logic everywhere
  • Stores precomputed features for fast retrieval at serving time
  • Serves the same features in the same way during training and serving
  • Versions features so you can reproduce past training runs

Offline store: Feature values stored historically for training. Data warehouse. Accessed by batch jobs.

Online store: Feature values for low-latency real-time retrieval. Typically Redis. Sub-10ms latency.

Common interview mistakes

Mistake 1: Not thinking about data leakage. If a feature includes information from the future at training time, the model will appear to work beautifully and fail in production.

Mistake 2: Skipping feature stores in system design answers. Any ML system with historical training and real-time serving should address training-serving consistency.

Mistake 3: Underestimating feature engineering time. 60-80% of project time is spent on data and features.

Key vocabulary

  • Feature store — A system that stores and serves ML features consistently between training and serving.
  • Training-serving skew — When features computed during training differ from features computed during serving.
  • Data leakage — When future information accidentally influences model training, causing artificially high evaluation metrics.
← Previous
Next · ProblemFeature Store Architecture for Real-Time Fraud Detection