1. Introduction
Machine learning models are routinely deployed under conditions that differ from those in which they were trained. A clinical risk-scoring model calibrated on data from one hospital may degrade silently when transferred to another institution whose patient demographics, coding practices, or admission criteria differ [
1,
2]. A fraud-detection system trained on historical transactions may lose discriminative power as spending patterns evolve. A predictive-maintenance model accurate under one set of operating conditions may produce unreliable alerts at a new facility. These failures share a common cause: the joint distribution of inputs and labels differs between the training (source) domain and the deployment (target) domain, a phenomenon known as
dataset shift [
3] (used interchangeably with
distribution shift throughout this paper).
Dataset shift takes several canonical forms.
Covariate shift arises when the marginal input distribution changes,
, while the conditional
remains stable.
Label shift (prior probability shift) occurs when
changes across domains.
Concept shift — the most damaging variant — occurs when
itself changes, invalidating learned decision boundaries [
4]. In practice, these types rarely occur in isolation: real deployments exhibit
mixed shift in which covariate, label, and concept components co-occur at varying intensities and time scales [?]. Despite two decades of research, no end-to-end framework handles mixed shift in a principled, automated way — a gap with serious practical consequences.
Existing work can be divided into three streams, each with important limitations.
Statistical detection and benchmarking. Maia Polo et al. [
5] proposed DetectShift, which unifies hypothesis tests for five shift classes —
,
,
,
, and
— providing the most comprehensive diagnostic toolkit to date. Roschewitz et al. [
6] showed that shift types can be identified automatically from self-supervised representations, enabling label-free deployment monitoring. Benchmark platforms such as WILDS [
1] and TableShift [
7] provide standardised evaluation across diverse real-world shifts. These contributions substantially advance shift
detection, but none connects the identified shift type to an adaptation strategy: the practitioner who learns that “covariate shift is present” still faces the full adaptation literature unaided.
Causal approaches. The fundamental limitation of purely statistical approaches to dataset shift is that they operate on associations, which are inherently unstable under distribution change. A model trained to minimise empirical risk will exploit any predictive signal in the training data, including spurious correlations — statistical associations between features and labels that hold in the source domain but break under shift [
8,
9]. Causal inference offers a principled remedy: by distinguishing
causal relationships, which reflect stable mechanisms in the data-generating process, from
spurious associations, which arise from shared confounders or selection artefacts, causal methods can identify representations that remain predictive even when the marginal distributions shift [
10,
11]. This distinction is particularly critical under concept shift, where spurious correlations that were predictive in the source domain may reverse sign in the target domain, causing models that rely on them to perform worse than random [
12]. Beyond robustness, causal structure enables
attribution: knowing which causal mechanisms have changed — rather than merely that performance has dropped — allows practitioners to apply targeted adaptations rather than retraining from scratch [
13,
14].
Existing causal frameworks for dataset shift take several forms. Subbaswamy et al. [
14] formalised shift stability through SCMs, identifying stable distributions by removing dependencies on unstable edges in the data-generating graph. Christiansen et al. [
15] derived necessary and sufficient conditions for distribution generalisation via causal invariance. Invariant Risk Minimisation [
16] and its variants learn invariant features from multi-environment data; Stable Learning [
11,
17] achieves similar goals via sample reweighting without explicit environment labels. Zhang et al. [
18] adopted a causal view for multi-source domain adaptation. Despite these advances, existing causal frameworks share three critical limitations. First, they assume either a fully specified causal graph or multiple heterogeneous training environments [
19] — conditions that rarely hold in practice, where a single observational dataset from one time period is the norm. Second, they conflate the Structural Causal Model (SCM) and potential outcomes paradigms, deploying only one at a time and missing the complementary strengths of each [
10]. Third, they provide no graceful degradation path: when causal assumptions cannot be justified, these frameworks either fail silently or require the practitioner to abandon causal tools entirely in favour of statistical baselines.
Adaptation methods and evaluation. Domain generalisation methods — data augmentation, meta-learning, invariant-feature learning, and ensemble approaches — have been surveyed comprehensively by Zhou et al. [
20]. Concept-drift detectors (DDM, ADWIN, FHDDM) handle temporal shift in streaming settings [
21]. Evaluation has largely relied on a scalar in-distribution (ID) versus out-of-distribution (OOD) accuracy gap [
22], which cannot distinguish a drop caused by covariate mismatch (addressable by reweighting) from one caused by concept drift (requiring retraining), nor can it certify the degree of additional shift a model can tolerate before failing.
Together, these gaps — no closed loop from diagnosis to method selection, no principled use of causal knowledge when it is partially or fully unavailable, no joint exploitation of SCM and Potential Outcomes Model (POM) tools, and no evaluation metrics beyond a scalar accuracy gap — motivate the present work.
We propose
CausalShift, a modular, plugin-based framework for end-to-end dataset shift handling. The framework’s statistical core handles detection, adaptation, and evaluation without any causal assumption, and is fully functional as a standalone system. Causal inference components are available as optional plugins that, when activated, provide three concrete benefits that statistical methods alone cannot deliver. First,
causal attribution identifies not only the type of shift but its structural source in the data-generating process — distinguishing, for example, whether a covariate shift is driven by a change in the causal mechanism of a feature or merely by a spurious upstream change — enabling more targeted and durable interventions [
14]. Second,
causal invariance guarantees: by identifying features whose conditional distributions are stable across environments, the framework can certify that adaptation is robust to future shifts of the same structural class, rather than merely correcting the currently observed distributional mismatch [
15,
23]. Third,
causal evaluation: when causal structure is available, robustness can be assessed not only as a point estimate on a fixed target dataset but as a bound over a family of distributions, and as a formal transportability guarantee, providing stronger and more informative assurances than scalar accuracy gaps [
11].
The framework operates through three architectural layers. A
universal statistical core (Layer 1) is always active, providing valid shift detection, type identification, adaptation guidance, and a baseline evaluation suite without any causal assumption.
Causal plugin modules (Layer 2) are activated selectively by a four-level
causal knowledge grading system (Stage 0) that assesses available causal evidence — from a fully specified SCM down to a single observational dataset — activating only the plugins that are epistemically and computationally justified.
Non-causal fallback methods (Layer 3), including conformal prediction and test-time adaptation, provide coverage-guaranteed alternatives when causal assumptions cannot be supported. The central mechanism is
attribution-driven method routing (Stage 3): the identified shift type, causal source, and knowledge level jointly determine the adaptation strategy, grounded in the minimax optimality result of Subbaswamy et al. [
14]. When causal plugins are inactive — owing to high dimensionality, nonlinearity, or unobserved confounders — the framework degrades gracefully to a competitive statistical baseline, directly addressing the graph-misspecification concern that limits all existing causal shift frameworks.
The main contributions of this paper are as follows.
Causal-statistical plugin architecture with knowledge grading. We propose a modular, three-layer architecture in which causal inference components are optional plugins activated by a four-level causal knowledge grading system (Stage 0). This is the first dataset shift framework to provide a principled degradation path from full SCM-based causal analysis (Level A) down to a purely statistical pipeline (Level D), ensuring the framework remains fully functional regardless of available causal knowledge. This directly addresses the all-or-nothing limitation of existing causal frameworks [
14,
15].
Spurious-association-aware causal attribution. We introduce a three-path attribution module (Stage 2) that identifies not only the type of shift (covariate, label, or concept) but its structural source, explicitly distinguishing causal mechanisms from spurious associations in the data-generating process [
8,
9]. When causal plugins are active, the module integrates SCM-based attribution (Subbaswamy Theorem 1, NILE estimator [
15]) with potential outcomes decomposition via DRCFS [
23], yielding a quantitative separation of the covariate shift contribution
from the concept shift contribution
— a decomposition absent from all prior frameworks. When causal plugins are inactive, the module falls back to statistical invariance tests and sample reweighting [
17,
24].
Attribution-driven method routing. We introduce a principled routing mechanism (Stage 3) that maps identified shift type, causal knowledge level, and computational budget to an adaptation strategy. Routing is grounded in the minimax optimality of counterfactual stable distributions [
14] and incorporates a conformal prediction fallback [
22] for mixed or uncertain shift. To our knowledge, this is the first framework to close the loop between shift attribution and adaptation method selection, replacing ad hoc practitioner judgement with a theoretically motivated decision procedure.
Tiered evaluation suite that scales with causal knowledge. We replace the scalar OOD accuracy gap with a tiered evaluation suite whose depth scales with available causal knowledge. At the statistical core level (always available),
-robustness bounds certify how much additional shift a model can tolerate before failing, without requiring any causal assumption. When the attribution plugin is active (Levels B/C), the distribution-induced shift decomposition of error (DISDE) separates the performance gap into
and
, enabling targeted intervention. When a full SCM is available (Level A), TATE transportability tests formally verify whether source-domain effects transfer to the target population [
22]. The suite remains informative at every knowledge level, including when all causal plugins are deactivated.
Data quality audit as a first-class pipeline stage. A pre-detection audit module (Stage 0.5) screens for Berkson bias [
25], selection bias, collider bias, and annotation inconsistency before any shift analysis is performed. All existing frameworks implicitly assume data trustworthiness; ours is the first to treat data bias as an explicit pipeline stage that conditions the validity of all downstream analyses.
Section 2 presents the plugin architecture and Stages 0–0.5.
Section 3 details causal attribution and method routing (Stages 1–3).
Section 4 covers shift-robust modelling, counterfactual augmentation, causal evaluation, and deployment monitoring (Stages 4–7).
Section 5 reports proof-of-concept experiments on four benchmark datasets.
Section 6 discusses limitations and concludes. Code is available at
https://github.com/Song1823/CausalShift.