NAS-OoD: Neural Architecture Search for Out-of-Distribution Generalization

Haoyue Bai, Fengwei Zhou, Lanqing Hong, Nanyang Ye, S.-h. Gary Chan, Zhenguo Li

Introduction

Deep learning models frequently struggle with Out-of-Distribution (OoD) data, where test environments differ significantly from training distributions (e.g., a model trained on "cows in green pastures" failing to recognize a "cow on a snowy mountain"). While many algorithms attempt to mitigate this by regularizing the training process, they typically treat the model architecture (e.g., ResNet-18) as a fixed constant.

NAS-OoD is the first framework to challenge this assumption by applying Neural Architecture Search (NAS) specifically to improve OoD robustness. The authors argue that standard architectures often overfit training distributions by learning spurious correlations; by searching for architectures designed to ignore these shifts, we can achieve superior generalization.

Methodology: The Minimax Framework

The core of NAS-OoD is a minimax optimization framework that jointly optimizes a data generator and an architecture search space. This approach ensures that the discovered architecture is robust against the most challenging distribution shifts.

The NAS-OoD minimax framework: a conditional generator creates challenging synthetic data while the architecture search optimizes for robustness.
  1. Differentiable NAS: Utilizing a continuous relaxation of the search space (similar to DARTS), architecture parameters ($\alpha$) are optimized via gradient descent.
  2. Adversarial Generation: A conditional generator ($\theta_G$) is trained to synthesize images that maximize the model's loss, effectively finding the "weak spots" of the current architecture.
  3. The Minimax Game: The generator attempts to create difficult OoD data, while the architecture search seeks a structure that minimizes loss on this synthetic data. Stability is maintained through cycle consistency and classification losses to ensure synthetic images remain semantically meaningful.

Experimental Setup and Datasets

The framework was evaluated across three diverse benchmarks:

  • NICO: Images of animals and vehicles in varying contexts (e.g., "dog on grass" vs. "dog in water").
  • PACS: A domain generalization staple featuring Photo, Art, Cartoon, and Sketch styles.
  • OoD-FP (Fingerprint): A real-world industrial dataset involving hardware-specific distribution shifts across different mobile sensor brands.

Key Insights and Results

NAS-OoD consistently outperformed baseline algorithms like Invariant Risk Minimization (IRM) and DecAug. On the NICO dataset, it achieved an average accuracy of 85.16%, surpassing the previous state-of-the-art. In the industrial fingerprint task, it reduced error rates by over 70% compared to the nearest competitor.

Comparison of Test Accuracy vs. Number of Parameters. NAS-OoD achieves higher accuracy with significantly fewer parameters than standard ERM baselines.

Architecture and Efficiency

  • Parameter Efficiency: As shown in the figure above, NAS-OoD discovered architectures with approximately 3 million parameters that outperformed ResNet-18 (~11 million parameters). This suggests that standard backbones may contain "bloat" that hinders generalization.
  • Structural Preferences: The search process favored dilated convolutions and dense skip connections. Dilated kernels provide larger receptive fields, allowing the model to focus on global structures rather than local textures (like background color) that vary between domains.

Conclusion

NAS-OoD demonstrates that architecture is a critical, yet often overlooked, component of out-of-distribution robustness. By simulating distribution shifts during the search process, the framework identifies efficient, high-performing structures that generalize far better than standard human-designed backbones. Future work may involve using more advanced generative models, such as Diffusion models, to simulate even more complex real-world shifts.

Summary updated

BibTeX
@inproceedings{bai2021nas,
  author = {Haoyue Bai and Fengwei Zhou and Lanqing Hong and Nanyang Ye and S.-H. Gary Chan and Zhenguo Li},
  title = {{NAS-OoD: Neural Architecture Search for Out-of-Distribution Generalization}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  doi = {10.1109/iccv48922.2021.00821},
}
Figure