Sequential Covariate Shift Detection Using Classifier Two-Sample Tests
Sooyong Jang, Sangdon Park, Insup Lee, Osbert Bastani
Abstract
A standard assumption in supervised learning is that the training data and test data are from the same distribution. However, this assumption often fails to hold in practice, which can cause the learned model to perform poorly. We consider the problem of detecting covariate shift, where the covariate distribution shifts but the conditional distribution of labels given covariates remains the same. This problem can naturally be solved using a two-sample test-i.e., test whether the current test distribution of covariates equals the training distribution of covariates. Our algorithm builds on classifier tests, which train a discriminator to distinguish train and test covariates, and then use the accuracy of this discriminator as a test statistic. A key challenge is that classifier tests assume given a fixed set of test covariates. In practice, test covariates often arrive sequentially over time-e.g., a self-driving car observes a stream of images while driving. Furthermore, covariate shift can occur multiple times-i.e., shift and then shift back later or gradually shift over time. To address these challenges, our algorithm trains the discriminator online. Additionally, it evaluates test accuracy using each new covariate before taking a gradient step; this strategy avoids constructing a held-out test set, which can improve sample efficiency. We prove that this optimization preserves the correctnessi.e., our algorithm achieves a desired bound on the false positive rate. In our experiments, we show that our algorithm efficiently detects covariate shifts on multiple datasets-ImageNet, IWild-Cam, and Py150.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers7
- Adapting to Continuous Covariate Shift via Online Density Ratio EstimationYu-Jie Zhang, Zhen-Yu Zhang, Peng Zhao, Masashi SugiyamaNeurIPS 2023 · 25 citations
- On the Exploration of Local Significant Differences For Two-Sample TestZhijian Zhou, Jie Ni, Jia-He Yao, Wei GaoNeurIPS 2023 · 6 citations
- Anchor-based Maximum Discrepancy for Relative Similarity TestingZhijian Zhou, Liuhua Peng, Xunye Tian, Feng LiuNeurIPS 2025 · 2 citations
- Are Two Datasets Close Enough With Statistical Significance? A Kernel Distributional Closeness Testing ApproachZhijian Zhou, Liuhua Peng, Xunye Tian, Mingming Gong et al.ICML 2026 · 1 citation
- Explaining Concept Shift with Interpretable Feature AttributionRuiqi Lyu, Alistair Turcan, Bryan WilderICML 2026
Builds on3
- WILDS: A Benchmark of in-the-Wild Distribution ShiftsPang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie et al.ICML 2021 · 1,773 citations
- Learning Deep Kernels for Non-Parametric Two-Sample TestsFeng Liu, Wenkai Xu, Jie Lu, Guangquan Zhang et al.ICML 2020 · 213 citations
- Tracking the risk of a deployed model and detecting harmful distribution shiftsAleksandr Podkopaev, Aaditya RamdasICLR 2022 · 36 citations
Related papers
- Robust Fairness Under Covariate ShiftAshkan Rezaei, Anqi Liu, Omid Memarrast, Brian D. ZiebartAAAI 2021 · 94 citations
- A Learning Based Hypothesis Test for Harmful Covariate ShiftTom Ginsberg, Zhongyuan Liang, Rahul G. KrishnanICLR 2023 · 3 citations
- Feed Two Birds with One Scone: Exploiting Wild Data for Both Out-of-Distribution Generalization and DetectionHaoyue Bai, Gregory Canal, Xuefeng Du, Jeongyeol Kwon et al.ICML 2023 · 67 citations
- Test-Time Training with Self-Supervision for Generalization under Distribution ShiftsYu Sun, Xiaolong Wang, Zhuang Liu, John Miller et al.ICML 2020 · 1,220 citations
- DriftSurf: Stable-State / Reactive-State Learning under Concept DriftAshraf Tahmasbi, Ellango Jothimurugesan, Srikanta Tirthapura, Phillip B. GibbonsICML 2021 · 44 citations
