LoRA-Ensemble: Efficient Uncertainty Modelling for Self-attention Networks

Michelle Halbheer, Dominik J. Mühlematter, Alexander Becker, Dominik Narnhofer, Helge Aasen, Konrad Schindler, Mehmet Ozgur Turkoglu · DOI

Abstract

Modern Transformer-based models often exhibit overconfidence in their predictions, necessitating robust uncertainty quantification. While Explicit Ensembles provide a gold standard for calibration, their computational and memory overhead is prohibitive for large-scale models. This paper introduces LoRA-Ensemble, a parameter-efficient alternative that utilizes Low-Rank Adaptation (LoRA) to generate diverse ensemble members around a shared, frozen backbone. LoRA-Ensemble matches or exceeds the accuracy and calibration of traditional ensembles while requiring approximately 14x fewer parameters and 9x less inference memory.

Introduction

The reliability of deep learning systems, particularly in safety-critical domains, depends on accurate uncertainty quantification. Transformers, despite their state-of-the-art performance, are prone to making incorrect predictions with high confidence. The most effective remedy—training an ensemble of independent models—is increasingly impractical as model sizes reach billions of parameters. Existing efficient ensembling methods often fail to translate well to Transformer architectures because they were designed for CNNs or rely on layers like BatchNorm. LoRA-Ensemble addresses this gap by leveraging low-rank updates to capture epistemic uncertainty without the need for multiple full-model copies.

Methodology: Low-Rank Ensembling

LoRA-Ensemble builds upon the Low-Rank Adaptation (LoRA) framework. The core idea is to freeze the pre-trained weights of a Transformer backbone and inject a small number of trainable parameters in the form of low-rank matrices.

Specifically, for each ensemble member $i$, independent sets of trainable low-rank matrices $A_i$ and $B_i$ are added to the query, key, value, and output projection layers. The forward pass for a member $i$ is defined as: $$h_i = W_0 x + B_i A_i x$$ where $W_0$ represents the frozen pre-trained weights. By initializing these low-rank matrices randomly, each member learns a distinct functional mapping, effectively exploring different regions of the loss landscape while sharing the heavy computational load of the backbone.

Experimental Setup

The effectiveness of LoRA-Ensemble was evaluated across multiple modalities to prove its generality:

  • Computer Vision: Image classification on CIFAR-10/100, medical imaging (HAM10000), and fine-grained classification (iNaturalist 2017).
  • Audio Processing: Environmental sound classification using the Audio Spectrogram Transformer (AST) on the ESC-50 dataset.
  • Natural Language Processing: Sentiment analysis on SST-2 using BERT.
  • Robustness: Evaluation on corrupted datasets (CIFAR-10-C/100-C) and Out-of-Distribution (OOD) detection using SVHN.

Key Insights: Diversity and Spectral Dynamics

A critical finding of this work is that LoRA-Ensemble members exhibit higher predictive diversity than those in an Explicit Ensemble. This diversity is a key driver for improved calibration.

Analysis of ensemble diversity through pairwise disagreement rates, Jensen-Shannon divergence, and t-SNE visualization of member predictions.

Further analysis into the "Intruder Dimensions" revealed that LoRA-Ensemble introduces new high-ranking singular vectors that are nearly orthogonal to the original weights. This suggests that the low-rank updates allow the ensemble to explore the parameter space more effectively than full-model fine-tuning, which tends to stay closer to the original spectral structure. Additionally, the choice of rank ($r$) is crucial; a "sweet spot" exists where the unique learning dynamics of LoRA are maximized for calibration. If the rank is too high, these unique dynamics are lost.

Results and Performance

LoRA-Ensemble consistently outperforms or matches Explicit Ensembles across various metrics:

  • Accuracy & Calibration: On CIFAR-100, it achieved 82.5% accuracy (vs. 79.8% for Explicit Ensembles) and reduced the Expected Calibration Error (ECE) from 0.100 to 0.035.
  • Resource Efficiency: A 16-member LoRA-Ensemble uses 14x fewer parameters and 9x less inference memory than its explicit counterpart.
  • Inference Speed: It offers a 5x speedup in inference time at batch size 1 by avoiding the overhead of running multiple full models sequentially.
  • OOD Detection: The method established new state-of-the-art performance for OOD detection, surpassing specialized baselines like Split-Ensemble.

Conclusion and Future Work

LoRA-Ensemble provides a scalable and efficient solution for uncertainty quantification in Transformers. By decoupling the majority of the model's knowledge (frozen backbone) from the ensemble's diversity (low-rank adapters), it achieves high-fidelity uncertainty estimates at a fraction of the cost. Future research will explore the scaling behavior of this method in extremely large models (100B+ parameters) and its applicability to alternative architectures like Mixture-of-Experts (MoE).

Summary updated

BibTeX
@inproceedings{halbheer2024lora,
  author = {Michelle Halbheer and Dominik J. Mühlematter and Alexander Becker and Dominik Narnhofer and Helge Aasen and Konrad Schindler and Mehmet Ozgur Turkoglu},
  title = {{LoRA-Ensemble: Efficient Uncertainty Modelling for Self-attention Networks}},
  booktitle = {Open},
  year = {2024},
}
Figure