Being Bayesian about Categorical Probability

Taejong Joo, Uijung Chung, Min-Gwan Seo

Introduction

In modern deep learning, the softmax function is the undisputed king of classification. However, it suffers from two major flaws: it tends to produce overconfident predictions even for incorrect or out-of-distribution (OOD) data, and it provides a point estimate rather than a distribution, making it hard for a model to represent uncertainty (i.e., to say, "I don't know").

While Bayesian Neural Networks (BNNs) solve these issues by placing distributions over model weights, they are notoriously difficult to scale, require significant architectural changes, and are computationally taxing. This paper introduces the Belief Matching (BM) framework, a "plug-and-play" alternative to the standard softmax cross-entropy loss that achieves the benefits of Bayesian inference without the computational overhead of BNNs.

The Belief Matching Framework

Instead of placing Bayesian priors over neural network weights, the authors treat the categorical probability itself as a random variable following a Dirichlet distribution.

Comparison of Softmax and Belief Matching

Here is how the Belief Matching framework operates:

  • Categorical Probability as a Random Variable: Instead of outputting a fixed vector of probabilities, the network outputs the parameters ($\alpha$) of a Dirichlet distribution. The Dirichlet is the conjugate prior to the categorical distribution, making the underlying math elegant and efficient.
  • Targeting the Posterior: During training, rather than forcing the model to match a one-hot label, the model tries to match a target posterior distribution. This posterior is formed by combining a prior belief (acting as "pseudo-counts" to smooth labels) with the observed ground-truth label using Bayes' rule.
  • Distribution Matching Loss: The loss function is derived by maximizing the Evidence Lower Bound (ELBO), which minimizes the KL divergence between the model’s predicted Dirichlet and the target posterior.
  • The $\lambda$ Trick: To prevent gradient explosions caused by the steep curves of Dirichlet distributions, the authors introduce a scaling factor ($\lambda$) on the KL term, stabilizing training for deep architectures like ResNet.

Key Insights: Beyond Simple Classification

The BM framework offers several theoretical and practical advantages over standard softmax:

  • Adaptive Smoothing: Unlike standard "label smoothing" (which adds a fixed amount of noise to labels), BM’s prior acts as an adaptive regularizer. The relative strength of the prior versus the data is controlled naturally by the number of observations.
  • Rich Output Information: Because the model outputs a distribution over the simplex (the space of all possible probability distributions), it captures more than just the "mean" prediction. It captures how concentrated or spread out its "belief" is, providing a built-in measure of uncertainty.
  • Implicit Manifold Regularization: The authors found that BM forces the internal representations (activations) of the network to form much tighter, more distinct clusters compared to softmax. This suggests the model learns a more robust "manifold" for the data.
Effect of KL divergence on feature clustering

Experimental Validation and Results

The researchers validated their approach across several standard computer vision benchmarks, including CIFAR-10/100, ImageNet, SVHN (for OOD detection), and Food-101/Stanford Cars (for transfer learning).

Key results include:

  • Better Accuracy: On ImageNet, BM improved the Top-1 accuracy of ResNext-101 from a 20.72% error rate (softmax) to 20.23%.
  • Superior Calibration: On CIFAR-100, the Expected Calibration Error (ECE)—a measure of how much you can trust a model's confidence—dropped from 13.48% for softmax to a much healthier 4.25% for BM.
  • OOD Detection: When shown unfamiliar SVHN images, a BM model trained on CIFAR-100 showed a distinct, high-entropy peak (indicating "I don't know"), whereas the softmax model remained dangerously confident.
  • Semi-Supervised Boost: BM improved performance in semi-supervised setups (like VAT), showing that its more delicate measure of prediction consistency is more effective than simple point-matching.

Limitations and Future Work

While highly effective, the Belief Matching framework has a few limitations. Dirichlet-based models can be more sensitive to hyperparameters and initialization than standard softmax, although the $\lambda$ trick mitigates this. Additionally, the prior parameter $\beta$ is currently a fixed hyperparameter; future work could explore input-dependent priors or hierarchical Bayesian treatments. Finally, exploring more expressive distributions like the Logistic Normal could help the model capture complex semantic correlations between different classes (e.g., recognizing that a "cat" is more similar to a "dog" than a "car").

Summary updated

BibTeX
@inproceedings{joo2020being,
  author = {Taejong Joo and Uijung Chung and Min-Gwan Seo},
  title = {{Being Bayesian about Categorical Probability}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
  url = {https://openreview.net/forum?id=_tcT6aW9m_p},
}
Figure