Why Statistical Quality Matters for ML
Schema validation and null checks catch structural problems. But for machine learning systems, data can be structurally perfect — correct types, no nulls, valid ranges — and still be silently wrong in a way that destroys model performance. The culprit is drift: the statistical properties of your data changing over time.
There are two fundamentally different types of drift, and confusing them leads to the wrong remediation.
1. Data Drift (Covariate Shift)
"The inputs changed, but the rules haven't."
The relationship between inputs (features) and the target (label) is the same as when you trained the model. But the distribution of inputs has shifted away from what the model was trained on.
- Example: You trained a credit risk model on data from 2019–2022, when interest rates were near zero. In 2023, rates spike. Customers who would have been "low risk" in 2022 are now "high risk" because their debt-service costs doubled. The input features (income, debt amount) look similar, but the model has never seen this interest-rate environment.
- Another Example: A Face ID model trained on young adults deployed in a retirement community. The inputs (faces) are structurally valid images, but the distribution (age, skin texture, lighting conditions) is far outside the training distribution.
- Detection: Compare the statistical distribution of live inputs against the training distribution. Tools like Evidently AI compute metrics like Population Stability Index (PSI), KL Divergence, and Wasserstein Distance to quantify how much the distribution has shifted.
2. Concept Drift
"The world changed, so the rules changed."
The inputs look identical to training data, but the relationship between inputs and the correct output has fundamentally changed.
- Example: A house price prediction model. In 2019, a 3-bedroom house in Austin cost $300k. In 2024, the identical house costs $600k. The input features (bedrooms, square footage, location) haven't changed. The concept of what those features are worth has changed due to macroeconomic forces.
- Example: A content moderation model trained before a major geopolitical event. After the event, language that was previously neutral becomes associated with harmful content. The words (inputs) are the same; their meaning (concept) has shifted.
- Detection: Harder than data drift because you need ground truth labels to detect it — and labels are often delayed. You compare model predictions against actual outcomes over time. A model that was 95% accurate last quarter but is now 70% accurate on the same input distribution is experiencing concept drift.
Drift Detection in Practice
PSI (Population Stability Index) thresholds used in practice:
- PSI < 0.1: No significant shift. Model is stable.
- 0.1 ≤ PSI < 0.2: Moderate shift. Investigate.
- PSI ≥ 0.2: Major shift. Retrain or investigate urgently.
The critical architectural implication: detecting concept drift requires a feedback loop — a system that captures ground truth labels from production and compares them to predictions. This is often called a model monitoring pipeline and is a separate engineering concern from the training pipeline.
A common interview question: "Your model's accuracy dropped from 94% to 71% over three months. How do you diagnose whether it's data drift or concept drift?" The answer: first check input feature distributions against the training baseline (PSI, KL divergence). If distributions are stable but accuracy dropped, it's concept drift — the world changed. If distributions shifted significantly, it's data drift — your inputs are out of distribution. In practice, both can occur simultaneously, requiring you to retrain on recent data that reflects both the new input distribution and the new concept.