Meta Learning Low Rank Covariance Factors for Energy Based Deterministic Uncertainty

Jeffrey Ryan Willette, Hae Beom Lee, Juho Lee, Sung Ju Hwang

Introduction

Deep Neural Networks (DNNs) are notoriously overconfident, often assigning high probabilities to "none-of-the-above" or out-of-distribution (OOD) examples. This paper introduces ProtoMahalanobis, a meta-learning framework designed to provide reliable uncertainty estimates even when a model has only seen a few examples of a task. By using an attentive set encoder to predict task-specific, low-rank covariance matrices and an energy-based inference procedure, the authors significantly reduce the overconfidence typical of deep networks when encountering OOD data.

The Problem: Overconfidence in Deep Networks

The overconfidence of DNNs is exacerbated by two main issues:

  1. Feature Collapse: Network layers can map vast regions of the input space (including OOD data) into tiny "singularities" in the feature space, making it impossible to distinguish between known and unknown data.
  2. Softmax Shift Invariance: The standard softmax function only evaluates the relative differences between logits. If an input is far from all training classes (high "energy"), but the logits still have a slight relative difference, the model will output a high-confidence prediction.

Existing solutions like SNGP or DDU use the Mahalanobis distance—which accounts for the "shape" or covariance of data clusters—to detect outliers. However, these rely on empirical covariance estimation, which fails in few-shot learning. If you only have five images of a new class, you cannot reliably calculate a high-dimensional covariance matrix; the estimate will be noisy and singular.

The ProtoMahalanobis Solution

To address these challenges, the authors propose a three-pronged approach:

  • Meta-Learning Covariance Factors: Instead of calculating covariance from scratch for every new task, ProtoMahalanobis uses a Set Transformer (an attentive encoder) to look at the support set and predict the covariance. To maintain efficiency, the covariance is modeled as a combination of a diagonal matrix and a low-rank factor. This allows the model to share "meta-knowledge" about how features generally vary across different tasks.
  • Energy-Based Inference: To fix the softmax overconfidence issue, the authors use "scaled energy" to parameterize a logit-normal distribution. If an input has high energy (meaning it is far from all class prototypes), the model increases the variance of its internal predictions. Averaging these noisy predictions results in a more uniform (uncertain) final output, reflecting the model's genuine lack of knowledge.
Energy surface visualization for 2D Gaussian clusters
  • Bi-Lipschitz Regularization: Spectral normalization and residual connections are applied to the feature extractor. This ensures that distances in the input space are preserved in the feature space, directly combating feature collapse.

Experimental Validation & Results

The model was evaluated on several benchmarks, focusing on both accuracy and calibration under distribution shift. Datasets included toy datasets (Half-moons, concentric circles, and 2D Gaussians) for visualizing uncertainty surfaces, as well as complex few-shot image classification benchmarks like Omniglot/Omniglot-C and MiniImageNet/MiniImageNet-C.

Uncertainty surface and decision boundaries on the Half-moons toy dataset

Key Findings: * Superior Calibration: In OOD detection and corrupted data scenarios, ProtoMahalanobis consistently achieved a lower Expected Calibration Error (ECE) than baselines like Protonet, MAML, and few-shot adaptations of SNGP and DDU. On Omniglot OOD tasks, it reduced ECE from ~60% (baselines) to ~33-40%. * Better Feature "Shapes": Visualizations of the precision matrix eigenvalues showed that ProtoMahalanobis learns diverse, class-specific ellipsoids. In contrast, empirical methods often default to near-spherical distributions due to a lack of data. * Robustness to Corruption: As the intensity of image corruption increased, the ECE of standard models skyrocketed, while ProtoMahalanobis remained significantly more stable. * Efficiency via Matrix Lemmas: By using the Sherman-Morrison formula and the matrix determinant lemma, the authors performed necessary matrix inversions and log-determinant calculations in $O(d^2)$ or $O(dr^2)$ time rather than $O(d^3)$, making it feasible to use during every step of meta-training.

Limitations and Future Work

While highly effective, the approach has limitations. In the extreme "1-shot" case, it is impossible to center the features by class, leading to less diverse eigenvalue distributions and slightly degraded performance. Additionally, using a Set Transformer to predict covariance factors adds computational overhead compared to a simple Prototypical Network. Finally, the experiments primarily utilized low-rank factors (Rank 1 or Diagonal); exploring how higher-rank factors perform on much higher-dimensional feature spaces remains an open question for future research.

Summary updated

BibTeX
@inproceedings{willette2022meta,
  author = {Jeffrey Ryan Willette and Hae Beom Lee and Juho Lee and Sung Ju Hwang},
  title = {{Meta Learning Low Rank Covariance Factors for Energy Based Deterministic Uncertainty}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=Yo6MRCuwrt},
}
Figure