Using Wasserstein Distance to Detect Live Model Feature Drift
Summary
The article describes a live drift monitor for an ONNX trading model running in MetaTrader 5. It compares a frozen reference sample with a rolling live sample for each input feature, using the one-dimensional Wasserstein-1 distance: sort equal-sized samples, match observations by rank, and average their absolute differences. The distance captures changes in distribution shape that mean and standard deviation checks can miss, while remaining finite when live values fall outside the reference sample’s range.
To compare features on different scales, the method divides each distance by that feature’s reference interquartile range, then monitors both a weighted composite and the largest per-feature score. The article also outlines integration with an eight-feature builder, a manifest for thresholds and actions, an ONNX directional model, and ATR-based position sizing. Its evidence includes synthetic validation, where it reports higher detection of a bimodal shift than mean and standard deviation monitoring, plus Strategy Tester results described as modest harm reduction rather than added alpha. The approach is univariate and feature-space focused; it does not detect multivariate relationships or target drift, and the reported tests do not establish general live-market performance.
Key ideas
- Wasserstein-1 compares equal-sized one-dimensional samples by matching their sorted values and averaging the absolute differences.
- The distance can detect distribution shape changes that leave a feature’s mean and standard deviation nearly unchanged.
- Scaling each feature’s distance by its reference interquartile range makes scores more comparable across features.
- Monitoring both a weighted composite and the maximum feature score can expose a single severe drift.
- The described detector monitors model inputs and does not address multivariate dependence or target drift.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.