Skip to content
ML Academy

Feature engineering and preprocessing · insight-0131

Ship the fitted preprocessing with the model so training and serving transform rows identically

Evidence type
documented fact
Difficulty
medium
Roles
ML engineer, Data scientist
Industries
cross-industry

Summary: situation, action, reason, boundary

  1. Situation

    Preprocessing lives in a notebook while serving engineers reimplement it in another service or language.

  2. Action

    Serialize one fitted pipeline containing preprocessing and model, version it with its data, and add a parity test that compares offline and online feature values for sampled rows.

  3. Reason

    Any transformation fitted on training data must be applied unchanged to test and production data, or the model sees a different feature space.

  4. Boundary

    Batch and online serving, especially when teams or languages differ between training and inference.

Symptom or risk

Small differences in scaling, encoding order or missing handling shift inputs; predictions degrade with no error raised.

Exceptions

Features computed in a shared feature store with one definition for both paths already give parity; still test it.

Trade-offs

Bundling preprocessing ties serving to the training stack; a cross-language format needs its own parity checks.

Pitfalls

Column order changes between training and serving that silently swap features of the same type.

Lessons and concepts

Claims and their sources