ML System Design

Training–Serving Skew

When a model performs great during offline training but fails in live production due to mismatched data or logic.

🟡 intermediate5 min readproductionmust-know
Training Serving Skew happens when the data or environment during live inference does not match what was used during model training. Common causes include calculating features differently in real time versus offline batch jobs, data leakage during training, or feature values changing between training and serving. Engineers prevent skew by using unified feature stores, shared feature transformation code, and point in time data logging.

What is Training Serving Skew?

Training Serving Skew is a common problem in production machine learning. It happens when a model gets high accuracy during offline training but performs poorly when deployed to serve real users live.

This performance drop happens because the conditions during live prediction do not match the conditions during offline training.

Common Causes of Skew

1. Different Feature Code

In many legacy systems, data engineers write offline feature pipelines using SQL or Python scripts, while software engineers rewrite that same logic in Java or C++ for low latency web servers. Subtle logic differences between the two languages create mismatched feature values.

2. Time Lag and Stale Data

During offline training, features are created using static historical databases. In live serving, real time feature stores might suffer network delays or update lags, supplying stale values to the model.

3. Data Leakage

Data leakage happens when information from the future enters the training dataset. For example, if a model predicts whether a customer will buy a product, but the training features include actions taken after the purchase, the model learns an artificial shortcut that will not exist at inference time.

How to Prevent Training Serving Skew

Offline Training Data ──► [ UNIFIED FEATURE STORE ] ──► Online Real-time Serving
                               (Shared Logic)
  1. Use a Shared Feature Store: Tools like Feast or Tecton allow teams to define feature transformations once. The exact same code computes features for offline training datasets and online real time serving endpoints.
  2. Log Live Serving Features: Record the exact feature vectors sent to the model during live production calls. Use these logged production feature vectors as training data for future model retrains.
  3. Automated Drift Checks: Continuously monitor statistical distributions of incoming production features and compare them against historical training feature distributions.

Say this out loud

Training Serving Skew happens when live production data or logic does not match offline training data. It is often caused by writing feature transformations twice in different languages or by data leakage during training. Teams prevent skew by using a unified feature store to share code between training and serving, and by logging production feature inputs directly for future retraining.

Followups to expect

  1. How do you detect skew quickly after deployment? Compare the distribution of live model outputs and features against training baseline distributions using statistical distance metrics like Population Stability Index.
  2. What is shadow deployment? Running a new model in parallel with the live production model without returning its predictions to users, allowing teams to verify real world behavior and detect skew safely.

Check yourself

Question 1 of 3

What is the primary cause of Training Serving Skew in production machine learning systems?

More in ML System Design

See all →
A Framework for Any ML Design Round5 minFraming a Business Problem as ML5 minOnline vs Offline Evaluation5 min