Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Distributionally robust neural networks for group shifts
| Date | Stars |
|---|---|
| 2026-07-31 | 295 |
| 2026-08-06 | 295 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Distributionally Robust Neural Networks for Group Shifts: On the Importance of Regularization for Worst-Case Generalization This code implements the group DRO algorithm from the following paper: > Shiori Sagawa\*, Pang Wei Koh\*, Tatsunori Hashimoto, and Percy Liang > > [Distributionally Robust Neural Networks for Group Shifts: On the Importance of Regularization for Worst-Case Generalization](https://arxiv.org/abs/1911.08731) The experiments use the following datasets: - [CelebA](http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html) - Waterbirds, formed from [Caltech-UCSD Birds 200](http://www.vision.caltech.edu/visipedia/CUB-200.html) + [Places](http://places2.csail.mit.edu/) - [MultiNLI](https://www.nyu.edu/projects/bowman/multinli/) For an executable, Dockerized version of the experiments in these paper, please see our [Codalab worksheet](https://worksheets.codalab.org/worksheets/0x621811fe446b49bb818293bae2ef88c0). ## Abstract Overparameterized neural networks can be highly accurate _on average_ on an i.i.d. test set yet consistently fail on atypical groups of the data (e.g., by learning spurious correlations that hold on average but not in such groups). Distributionally robust optimization (DRO) allows us to learn models that instead minimize the _worst-case_ training loss over a set of pre-defined groups. However, we find that naively applying group DRO to overparameterized neural networks fails: these models can perfectly fit the training data, and any model with vanishing average training loss also already has vanishing worst-case training loss. Instead, their poor worst-case performance arises from poor _generalization_ on some groups. By coupling group DRO models with increased regularization---stronger-than-typical L2 regularization or early stopping---we achieve substantially higher worst-group accuracies, with 10-40 percentage point improvements on a natural language inference task and two image tasks, while maintaining high average accuracies. Our results suggest that regularization is critical for worst-group generalization in the overparameterized regime, even if it is not needed for average generalization. Finally, we introduce and give convergence guarantees for a stochastic optimizer for the group DRO setting, underpinning the empirical study above. ## Prerequisites - python 3.6.8 - matplotlib 3.0.3 - numpy 1.16.2 - pandas 0.24.2 - pillow 5.4.1 - pytorch 1.1.0 - pytorch_transformers 1.2.0 - torchvision 0.5.0a0+19315e3 - tqdm 4.32.2 ## Datasets and code To run our code, you will need to change the `root_dir` variable in `data/data.py`. The main point of entry to the code is `run_expt.py`. Below, we provide sample commands for each dataset. ### CelebA Our code expects the following files/folders in the `[root_dir]/celebA` directory: - `data/list_eval_partition.csv` - `data/list_attr_celeba.csv` - `data/img_align_celeba/` You can download these dataset files from [this Kaggle link](https://www.kaggle.com/jessicali9530/celeba-dataset). The original dataset, due to Liu et al. (2015), can be found [here](http://mmlab.ie.cuhk.edu.hk/projects/CelebA.html). The version of the CelebA dataset that we use in the paper (with the (hair, gender) groups) can also be accessed through the [WILDS package](https://github.com/p-lambda/wilds), which will automatically download the dataset. A sample command to run group DRO on CelebA is: `python run_expt.py -s confounder -d CelebA -t Blond_Hair -c Male --lr 0.0001 --batch_size 128 --weight_decay 0.0001 --model resnet50 --n_epochs 50 --reweight_groups --robust --gamma 0.1 --generalization_adjustment 0` ### Waterbirds The Waterbirds dataset is constructed by cropping out birds from photos in the Caltech-UCSD Birds-200-2011 (CUB) dataset (Wah et al., 2011) and transferring them onto backgrounds from the Places dataset (Zhou et al., 2017). Our code expects the following files/folders in the `[root_dir
Excerpt of 9,813 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:c3b49fcfe7df8486, llm:Repository description: "Distributionally robust neural networks for group shifts" (no topics).