This repository contains the code for experiments in the ICLR 2025 Spotlight paper Severing Spurious Correlations with Data Pruning by Varun Mulchandani and Jung-Eun Kim.
More experiments to come soon!
Please download and unzip the CelebA dataset from Liu et. al. 2015 (Aligned and Cropped Images) and move it to the CelebA/data/ sub-directory.
Sample Commands
# Create train, test and val splits.
bash create_init_dataset.sh
# Train model on unpruned dataset.
python3 generate_downstream.py --exp_name CelebA_sample_exp --dataset CelebA --n_epochs 25 --lr 1e-3 --weight_decay 1e-4 --method ERM --prune False
bash results/CelebA/CelebA_sample_exp/ERM_upweight_0_epochs_25_lr_0.001_weight_decay_0.0001/job.sh
# Save the original metadata with a different name.
bash change_meta.sh
# Prune the dataset. prune_oracle and prune_general take amount to be pruned between 0.1 - 0.97. Type of pruning can be "hardest" or "easiest".
python3 prune_oracle.py 0.5 hardest # Assuming access to spurious information. Reproduces results in Fig. 4.
python3 prune_general.py 0.5 hardest # Assuming access to no information. Reproduces results in Fig. 6.
bash prune_metadata.sh
# Train on pruned dataset. Make sure to move the original training results elsewhere, or they'll get overwritten.
python3 generate_downstream.py --exp_name CelebA_sample_exp --dataset CelebA --n_epochs 25 --lr 1e-3 --weight_decay 1e-4 --method ERM --prune True
bash results/CelebA/CelebA_sample_exp/ERM_upweight_0_epochs_25_lr_0.001_weight_decay_0.0001/job.sh
Sample Commands
# Compute Core Feature Difficulty
python3 ResNet20_main.py
# Store indices for samples with hardest and easiest core features.
python3 split.py
# Compute Spurious Misclassifications with easy spurious feature (S3 in text).
# Introduce synthetic spurious feature into samples with hard core features.
python3 ResNet20_main_spurious_easiest.py hardest
# Introduce synthetic spurious feature into samples with easy core features.
python3 ResNet20_main_spurious_easiest.py easiest
# Compute Spurious Misclassifications with hard spurious feature (S1 in text).
# Introduce synthetic spurious feature into samples with hard core features.
python3 ResNet20_main_spurious_hardest.py hardest
# Introduce synthetic spurious feature into samples with easy core features.
python3 ResNet20_main_spurious_hardest.py easiest
Please consider citing our paper if you find this repository useful in your work.
@inproceedings{
mulchandani2025ICLR,
title={Severing Spurious Correlations with Data Pruning},
author={Varun Mulchandani and Jung-Eun Kim},
booktitle={The Thirteenth International Conference on Learning Representations (ICLR)},
year={2025},
url={https://openreview.net/forum?id=Bk13Qfu8Ru}
}Many of our experiments are built on top of implementations provided by the following papers: