Generative Classifiers Avoid Shortcut Solutions
Alexander C. Li, Ananya Kumar, Deepak Pathak
TL;DR
Discriminative classifiers often latch onto spurious correlations, causing fragility under distribution shift. The authors advocate generative classifiers that model $p_\theta(x|y)$ using diffusion-based (images) or autoregressive (text) models and apply Bayes' rule for prediction, achieving state-of-the-art robustness across five benchmarks without specialized data augmentations. They provide empirical evidence and mechanistic insights, including gradient analyses and Gaussian toy experiments, showing that learning the full input distribution yields more consistent signals and better generalization, especially under shift. The work also characterizes when generative classifiers outperform discriminative ones via generalization phase diagrams and discusses practical considerations like model size and unconditional objectives, indicating meaningful real-world impact for robust classification in domains with spurious correlations.
Abstract
Discriminative approaches to classification often learn shortcuts that hold in-distribution but fail even under minor distribution shift. This failure mode stems from an overreliance on features that are spuriously correlated with the label. We show that generative classifiers, which use class-conditional generative models, can avoid this issue by modeling all features, both core and spurious, instead of mainly spurious ones. These generative classifiers are simple to train, avoiding the need for specialized augmentations, strong regularization, extra hyperparameters, or knowledge of the specific spurious correlations to avoid. We find that diffusion-based and autoregressive generative classifiers achieve state-of-the-art performance on five standard image and text distribution shift benchmarks and reduce the impact of spurious correlations in realistic applications, such as medical or satellite datasets. Finally, we carefully analyze a Gaussian toy setting to understand the inductive biases of generative classifiers, as well as the data properties that determine when generative classifiers outperform discriminative ones.
