On the Out-of-distribution Generalization of Probabilistic Image Modelling

Mingtian Zhang, Andi Zhang, Steven McDonagh

Introduction

Probabilistic image modeling aims to capture the underlying density of a dataset for tasks like out-of-distribution (OOD) detection and lossless compression. However, a persistent "likelihood paradox" exists: models often assign higher probabilities to OOD data than to their training data. This paper identifies that low-level local features dominate these likelihoods, leading to poor generalization. By explicitly separating these "universal" local features from "dataset-specific" global structures, the authors achieve state-of-the-art OOD detection and highly efficient compression.

Local Autoregressive Modeling

The authors propose a shift from standard autoregressive models, which allow a pixel to depend on all previous pixels in an image. Instead, they introduce a Local Autoregressive Model that restricts dependencies to a small, fixed "horizon" ($h$).

The local autoregressive model restricts the dependency of a pixel $x_{ij}$ to a small local neighborhood (red), preventing the model from learning global semantic structures.

By defining a "full" model ($p_f$) that sees the entire context and a "local" model ($p_l$) that only sees nearby pixels, the authors isolate the "non-local" component using the ratio $\frac{p_f(x)}{p_l(x)}$. This score effectively cancels out universal local textures (like edges and noise) and focuses on the semantic global structure needed to distinguish datasets.

Key Results and OOD Detection

The ratio-based non-local score proves to be a superior OOD detector. By ignoring common local features that distract standard likelihood calculations, the model can distinguish between datasets with high precision.

Histograms showing the separation of likelihood distributions for in-distribution (blue) and out-of-distribution (red) datasets across grayscale and color benchmarks.

Empirical results show that this method achieved an AUROC of 1.000 on FashionMNIST vs. MNIST/KMNIST, outperforming complex ensembles. Furthermore, the local modeling approach led to the creation of NeLLoC (Neural Local Lossless Compressor). NeLLoC is significantly more practical than previous neural compressors, with a model size of only 2.75 MB (compared to 156 MB for HiLLoC) and the ability to process images of arbitrary size without retraining.

Conclusion

By identifying that local features dominate likelihoods, this work resolves the likelihood paradox and provides a practical framework for robust OOD detection and universal image compression. While the local model cannot generate semantically coherent images, its efficiency and generalization capabilities mark a significant step forward in probabilistic modeling. Future work will explore extending this local vs. non-local decomposition to other modalities like audio and text.

Summary updated

BibTeX
@inproceedings{zhang2021out,
  author = {Mingtian Zhang and Andi Zhang and Steven McDonagh},
  title = {{On the Out-of-distribution Generalization of Probabilistic Image Modelling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=fMbF3bbyAY},
}
Figure