Intriguing properties of generative classifiers

Priyank Jaini, Kevin Clark, Robert Geirhos

TL;DR

By repurposing text-to-image generative models as zero-shot classifiers, researchers have discovered that these models exhibit remarkably human-like visual perception. Unlike standard discriminative models that rely on texture "shortcuts," generative classifiers prioritize global shape, match human error patterns with state-of-the-art consistency, and even demonstrate an understanding of visual illusions.

What Problem Does This Paper Address?

For years, the dominant paradigm in computer vision has been discriminative inference—models trained to map an image directly to a label ($p(y|x)$). While fast and effective, these models are notoriously brittle. They often rely on "shortcut learning," such as identifying a cow by the green grass in the background or a cat by its fur texture rather than its silhouette.

In contrast, human vision is incredibly robust to distortions and changes in context. A long-standing hypothesis in neuroscience suggests that the human brain might perform "analysis-by-synthesis," using a generative model of the world to recognize objects. Until recently, generative models weren't powerful enough to test this at scale. This paper investigates whether modern generative models (like Imagen and Stable Diffusion) can bridge the gap between machine and human perception.

Methods

The authors turn text-to-image models into zero-shot classifiers by evaluating how well a model can "explain" a given image using different class prompts.

For diffusion models (like Imagen and Stable Diffusion), they use a technique called the diffusion variational lower bound. Essentially, they take a test image, add noise to it, and then ask the model to reconstruct the original image conditioned on a prompt like "A bad photo of a <class>". The class that results in the smallest reconstruction error (minimal $L_2$ distance) is chosen as the prediction.

Figure 2: Classification with a diffusion generative classifier. Given a test image, such as a dog with clock texture (1), a text-to-image generative classifier adds random noise (2) and then reconstructs the image conditioned on the prompt “A bad photo of a <class>” for each class (3). The reconstructed image closest to the test image in L2 distance is taken as the classification decision (4); this estimates the diffusion variational lower bound (Clark & Jaini, 2023). For visualization purposes, icons corresponding to the prompt class are superimposed on the reconstructed images.

For autoregressive models (like Parti), they calculate the exact conditional likelihood of the image given the class prompt. They compared these generative classifiers against 52 standard discriminative models (including ResNets, Vision Transformers, and CLIP) and human psychophysical data.

Datasets

The study utilizes the model-vs-human toolbox, which consists of 17 challenging out-of-distribution (OOD) datasets. These include:

  • Non-parametric manipulations: Sketches, silhouettes, edge-filtered images, and "cue-conflict" images (e.g., a cat shape with elephant skin texture).
  • Parametric distortions: Images affected by low-pass filtering (blur), uniform noise, contrast changes, and rotations.
  • Human Data: The benchmark includes data from 90 human observers across over 85,000 trials, providing a gold standard for "human-like" behavior.

Key Insights and Ideas

  • The Shape Bias Breakthrough: Standard models are "texture-biased," but generative models are "shape-biased." Imagen achieved a record-breaking 99% shape bias, effectively matching or exceeding human performance.
  • Denoising as a Structural Filter: The authors hypothesize that the iterative denoising process in diffusion models naturally ignores high-frequency details (texture) and focuses on low-frequency global structures (shape).
  • Human-Aligned Errors: Generative models don't just get the same things right as humans; they get the same things wrong. They show significantly higher "error consistency" with humans than traditional discriminative models.
  • Understanding Illusions: Generative models can resolve bistable illusions (like the famous rabbit-duck image) and exhibit pareidolia (seeing faces in rocks) in a way that aligns with human prompts, suggesting a deeper grasp of ambiguous visual semantics.

Key Results

  • OOD Accuracy: Imagen and Stable Diffusion achieve near human-level robustness across the 17 OOD datasets, significantly outperforming most standard discriminative models.
Figure 3: Out-of-distribution accuracy across 17 challenging datasets (Geirhos et al., 2021). De- tailed results for all parametric datasets are plotted in Figure 5; Table 3 lists accuracies.
  • Shape Bias: While a standard ResNet-50 has a shape bias of only 21%, Imagen hits 99%, Stable Diffusion 93%, and Parti 92%.
  • Simple Fix for Old Models: The authors found that simply adding diffusion-style noise as a data augmentation during the training of a standard ResNet-50 increased its shape bias from 21% to 78%, suggesting the training objective itself is a primary driver of this behavior.
Figure 1: Zero-shot generative classifiers achieve a human-level shape bias: 99% for Imagen, 93% for Stable Diffusion, 92% for Parti and 92–99% for individual human observers (96% on average). Most discriminative models are texture biased instead.

Limitations and Future Work

  • Computational Cost: Generative classification is currently very slow. Because it requires a reconstruction pass for every possible class, it is not yet practical for real-time applications.
  • The Rotation Gap: Despite their robustness, generative models still struggle with rotated images, a task where humans remain far superior.
  • Confounding Factors: The models tested vary in architecture, size, and training data. Future work is needed to isolate exactly which component—the generative objective, the scale of data, or the language supervision—is most responsible for these "intriguing properties."
  • Biological Plausibility: While these models mimic human behavior, the authors note that the human brain likely uses a different, more efficient implementation of generative inference than the iterative denoising used in diffusion models.

Summary updated

BibTeX
@inproceedings{jaini2024intriguing,
  author = {Priyank Jaini and Kevin Clark and Robert Geirhos},
  title = {{Intriguing properties of generative classifiers}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=rmg0qMKYRQ},
}
Figure