Causal Fine-Tuning under Latent Confounded Shift

Jialin Yu, Yuxiang Zhou, Haoxuan Li, Junchi Yu, Mengyue Yang, Yulan He, Nevin L. Zhang, Philip Torr, Ricardo Silva

TL;DR

When fine-tuning large language models, they often exploit spurious shortcuts in the training data that fail completely when deployed in the real world. This paper introduces Causal Fine-Tuning (CFT), a framework that uses structural causal models to disentangle stable semantic features from shift-sensitive artifacts. By applying a front-door causal adjustment at inference time, CFT significantly boosts out-of-distribution robustness without needing expensive multi-domain annotations.

What Problem Does This Paper Address?

Modern AI models are notoriously prone to latching onto "shortcuts"—spurious correlations between inputs and outputs that happen to hold true during training but break down during deployment. The authors formalize this challenge as a latent confounded shift, where hidden variables induce these unreliable correlations.

For example, if a sentiment analysis dataset contains mostly positive reviews from Amazon, a standard fine-tuned model might implicitly learn the rule "Source: Amazon" = Positive. If the distribution flips at test time and Amazon reviews become predominantly negative, the model's performance collapses.

Figure 1. An illustration of a latent confounded shift: the spurious correlation between data source and sentiment label flips at test time.

Traditional domain generalization methods typically assume that stable, invariant features are the only useful signals available. However, they fail to address scenarios where the observed features deeply entangle both the true causal signal and environment-specific spurious correlations.

Methods

To untangle this mess, the authors introduce Causal Fine-Tuning (CFT). Instead of treating the neural network as a black box, they use a Structural Causal Model (SCM) as an inductive bias to guide how representations are learned and manipulated.

The CFT framework operates in three core components:

  1. Supervised Fine-Tuning (SFT): The model undergoes standard fine-tuning to learn high-level representations ($R_1$) from the labeled training data.
  2. Learning Causal Representations ($C$): To isolate invariant features, the framework aligns representations from a frozen, pre-trained model ($R_0$) and the fine-tuned model ($R_1$). An invariance loss maximizes entropy and prevents representation collapse, ensuring $C$ remains stable across different data views.
  3. Learning Local Representations ($\Phi$): Low-level features (specifically from the embedding layer) are extracted using a patch-based Multi-Layer Perceptron (MLP) to capture local, shift-sensitive cues.
Figure 3. Illustration of our CFT methods. During training, we keep a copy of pre-trained foundation model (Frozen Model) for identification purposes, which is removed during inference. Once CFT is done, we get a model of the similar size as the standard fine- tuning but providing functions to decompose input to causal and spurious features. This allows for adaptation to latent confounded shifts at test time.

During inference, the model doesn't just output a standard conditional probability. Instead, it performs a front-door style causal adjustment to estimate the interventional distribution $p(y | \text{do}(x))$. It achieves this via Monte-Carlo marginalization, randomly shuffling the shift-sensitive local features ($\Phi$) within mini-batches to break their spurious connection to the label.

Datasets

The authors evaluated their approach by creating two controlled spurious correlation injection attack benchmarks based on popular sentiment analysis datasets:

  • Amazon Reviews
  • Yelp Reviews

To simulate real-world deployment artifacts, they modified the raw text directly:

  • Benchmark 1 (Stop Words): Appended specific meaningless suffixes (xxxx or yyyy) to common stop words ("the", "and") and strongly correlated them with positive or negative sentiment labels during training.
  • Benchmark 2 (Data Source): Appended platform identifiers (amazon.xxx or yelp.yyy) to sentences to mimic data-source biases.

During testing, they systematically shifted the ratio of these correlations (from 90% down to 10%) to evaluate the models under severe out-of-distribution (OOD) settings.

Key Insights and Ideas

  • Foundation Models as Implicit Environments: A key "aha" moment is that a pre-trained foundation model can act as an implicit second environment. By comparing the frozen model against the fine-tuned model, CFT can isolate stable features using data from only a single domain.
  • The Power of Low-Level Features: Low-level layers (like embeddings) are highly effective at isolating local, environment-specific cues, whereas higher layers increasingly mix in stable semantic information.
  • Causal Structure Beats Pure Regularization: While popular black-box regularization techniques like Stochastic Weight Averaging (SWA) help under mild distribution shifts, they fall short under severe shifts. Explicitly modeling the causal graph and intervening via the do-operator provides a much stronger safety guarantee.

Key Results

The authors compared CFT against standard fine-tuning (SFT), frozen feature classification (SFT0), and strong domain generalization baselines like SWA and WISE.

  • Superior OOD Performance: On the Yelp dataset under the most severe shift (where the training correlation is completely inverted to 10%), CFT achieved a mean F1 score of 58.40, significantly outperforming standard SFT (49.24) and WISE (55.91).
  • Resilience to Severe Noise: When the intensity of the injected spurious noise was scaled up (up to 8x), CFT's structure-aware adjustment consistently maintained its performance edge, while black-box regularizers degraded rapidly.
A box-plot showing CFT outperforming standard fine-tuning and alternative ablations under a 50% OOD shift.

Limitations and Future Work

  • Controlled Evaluation Scope: The evaluation relies on synthetic injection attacks to isolate the latent confounded mechanism. While necessary for rigorous causal evaluation (since confounders are unobserved in real-world data), testing on broader, naturally occurring shifts remains an open step.
  • Representation Alignment Dependency: CFT assumes that the frozen and fine-tuned models provide sufficiently distinct views to separate $C$ and $\Phi$. If the pre-trained model and the training data share identical biases, the method's benefits degrade toward standard fine-tuning.
  • Future Directions: The authors suggest extending this framework to multi-modal settings, where latent confounders might hide in one modality (e.g., text metadata) but corrupt predictions in another (e.g., images).

Summary updated

BibTeX
@inproceedings{yu2026causal,
  author = {Jialin Yu and Yuxiang Zhou and Haoxuan Li and Junchi Yu and Mengyue Yang and Yulan He and Nevin L. Zhang and Philip Torr and Ricardo Silva},
  title = {{Causal Fine-Tuning under Latent Confounded Shift}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=NDPvfDxsz4},
}
Figure