An online recommender shows good offline metrics but poor live performance. Investigation finds the training pipeline computes a session-length feature by aggregating events in a batch Python job, while the serving service computes the same feature with separate, hand-written logic that rounds differently and uses a different time window. What is the most robust way to eliminate this discrepancy across training and serving?
- AAdd an endpoint monitoring job that compares live feature distributions to training and retrains whenever the gap grows beyond a threshold.
- BIncrease training data volume and retrain more frequently so the model becomes robust to the small differences between the two feature computations.
- CShare one feature transformation definition between training and serving, for example via a feature store or a shared preprocessing component, so both paths compute the feature identically. Correct
- DDocument the serving feature logic carefully and add unit tests so future engineers keep the two implementations numerically aligned by hand.
Why A is wrong: Monitoring detects skew after it happens and triggers retraining, but it leaves the two divergent code paths in place so the rounding and window mismatch keeps reappearing.
Why B is wrong: More data and frequent retraining cannot correct a systematic feature definition mismatch, because training and serving still produce different values for the same input.
Why C is correct: Reusing a single transformation definition for both training and serving guarantees the feature is computed identically in both paths, removing the rounding and time-window skew at its source.
Why D is wrong: Documentation and tests reduce drift somewhat, but maintaining two parallel implementations by hand is fragile and still permits the very mismatch that caused the problem.