GitHunt
KO

kokolerk/DivIL

[TMLR2025] DivIL: Unveiling and Addressing Over-Invariance for Out-of- Distribution Generalization

DivIL: Unveiling and Addressing Over-Invariance for Out-of- Distribution Generalization

Paper Github License License

๐Ÿš€๐Ÿš€๐Ÿš€ Official implementation of DivIL: Unveiling and Addressing Over-Invariance for Out-of- Distribution Generalization

๐Ÿ’ก Highlights

  • We discover and theoretically define the over-invariance phenomenon, i.e., the loss of important details in invariance when alleviating the spurious features, which exists in almost all of the previous IL methods.
  • We propose Diverse Invariant Learning (DivIL), combining both invariant constraints and unsupervised contrastive learning with randomly masking mechanism to promote richer and more diverse invariance.
  • Experiments conducted on 12 benchmarks, 4 different invariant learning methods across 3 modali-ties (graphs, vision, and natural language) demonstrate that DivIL effectively enhances the out-of-distribution generalization performance, verifying the over-invariance insight.

๐Ÿ› ๏ธ Usage

We organize our code in the following strucute. The detailed guidance is included in the README.md of each subdirectory(Graph, ColoredMNIST and GPT2_nli).

DivIL/
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ Graph/
โ”‚   โ”œโ”€โ”€ README.md
โ”‚   โ””โ”€โ”€ datasets/
โ”‚   โ””โ”€โ”€ dataset_gen/
โ”‚   โ””โ”€โ”€ models/
โ”‚   โ””โ”€โ”€ main-batch_aug.py
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ ColoredMNIST/
โ”‚   โ”œโ”€โ”€ README.md
โ”‚   โ”œโ”€โ”€ train_coloredmnist.py
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ GPT2_nli/
โ”‚   โ”œโ”€โ”€ README.md
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ synthetic_data_experiment/
โ””โ”€โ”€ ...

โœ’๏ธ Citation

This repo benefits from CIGA and DomainBed. Thanks for their wonderful works.

If you find our work helpful for your research, please consider giving a star โญ and citation ๐Ÿ“

@article{wang2025divil,
    title={Div{IL}: Unveiling and Addressing Over-Invariance for Out-of- Distribution Generalization},
    author={Jiaqi WANG and Yuhang Zhou and Zhixiong Zhang and Qiguang Chen and Yongqiang Chen and James Cheng},
    journal={Transactions on Machine Learning Research},
    issn={2835-8856},
    year={2025},
    url={https://openreview.net/forum?id=2Zan4ATYsh},
    note={}
}

Languages

Python92.0%TeX8.0%

Contributors

MIT License
Created February 19, 2025
Updated October 13, 2025