UATTA-EB: Uncertainty-Aware Test-Time Augmented Ensemble of BERTs for Classifying Common Mental Illnesses on Social Media Posts

Pratinav Seth, Mihir AgarwalarXiv 2023

Abstract

Given the current state of the world, millions of people suffering from mental illnesses feel isolated and unable to receive help in person. Psychological studies have shown that our state of mind can manifest itself in the linguistic features we use to communicate. People have increasingly turned to online platforms to express themselves and seek help with their conditions. Deep learning methods have been commonly used to identify and analyze mental health conditions from various sources of information, including social media. Still, they face challenges, including a lack of reliability and overconfidence in predictions resulting in the poor calibration of the models. To solve these issues, We propose UATTA-EB: Uncertainty-Aware Test-Time Augmented Ensembling of BERTs for producing reliable and well-calibrated predictions to classify six possible types of mental illnesses—None, Depression, Anxiety, Bipolar Disorder, ADHD, and PTSD—by analyzing unstructured user data on Reddit.

Introduction

Deep learning models have demonstrated remarkable proficiency in identifying linguistic markers of mental illness within social media text. However, a significant limitation persists: overconfidence. Standard neural networks often exhibit poor calibration, predicting a class like "Depression" with extremely high confidence even when the prediction is incorrect. In clinical screening contexts, such overconfidence is potentially dangerous. For an AI system to be a trustworthy tool for intervention, its confidence score must accurately reflect the probability of being correct. This research introduces UATTA-EB, a framework designed to quantify its own uncertainty and produce more reliable predictions across six diagnostic categories.

Methodology

The proposed UATTA-EB pipeline consists of three primary stages: Test-Time Augmentation, a Diverse Ensemble of Transformers, and Uncertainty-Aware Ensembling.

Test-Time Augmentation (TTA)

To increase robustness, the system does not rely on a single input. Instead, it generates multiple "noisy" versions of each Reddit post using three techniques:

  • Synonym Augmentation: Replacing 30% of words with contextually appropriate synonyms.
  • TF-IDF Word Augmentation: Replacing 5% of words based on their corpus-wide importance.
  • Keyboard Distance Augmentation: Simulating human error by replacing 5% of characters with adjacent keys on a standard keyboard.

Diverse Ensemble

The augmented inputs are processed by four distinct transformer architectures: BERT, RoBERTa, DeBERTa, and ALBERT. This architectural diversity ensures the system captures a wide array of linguistic nuances.

The UATTA-EB architecture overview, showing the flow from input sample through test-time augmentation to the ensemble of transformer models.

Uncertainty-Aware Ensembling

The core innovation lies in how these model outputs are combined. Rather than simple averaging, the system calculates an uncertainty metric for each prediction using a modified Log-Likelihood Functional Uncertainty (LLFU). It then performs a weighted average, granting higher "voting power" to models that demonstrate greater certainty for a specific input.

Experimental Setup

The study utilizes a mental health dataset extracted from Reddit, comprising 16,703 social media posts categorized into Bipolar, ADHD, anxiety, depression, PTSD, and None. The data was split into training (13,727), validation (1,488), and testing (1,488) sets. Researchers combined the title and body of each post, utilizing a maximum sequence length of 512 tokens.

Results and Discussion

The primary goal of UATTA-EB was to improve model calibration without sacrificing predictive power. The results indicate that while accuracy remained high, the reliability metrics improved substantially.

Quantitative results comparing the proposed UATTA-EB against baseline transformer models across accuracy and calibration metrics.
  • Accuracy and F1 Score: The model maintained an F1 score of 0.86, matching the best-performing single baseline (RoBERTa).
  • Expected Calibration Error (ECE): ECE dropped from 0.046 (Baseline BERT) to 0.018, indicating that the model's confidence is much better aligned with its actual accuracy.
  • Maximum Calibration Error (MCE): MCE was reduced from 0.398 (RoBERTa) to 0.122, significantly curtailing "worst-case" overconfidence.
  • Brier Score: The improvement to 0.23 further confirms superior probabilistic performance.

By utilizing TTA, the model treats linguistic noise as a feature; if a minor typo causes a model to change its prediction, the system correctly identifies this as high uncertainty.

Conclusion

UATTA-EB provides a more reliable framework for mental health screening by prioritizing calibration alongside accuracy. While the model relies on self-reported data, its ability to "know what it doesn't know" makes it a significant step toward deploying AI in sensitive clinical contexts. Future work will explore advanced Bayesian methods and test the model's performance on out-of-distribution (OOD) samples to further validate its robustness.

Summary updated

BibTeX
@misc{seth2023uatta,
  author = {Pratinav Seth and Mihir Agarwal},
  title = {{UATTA-EB: Uncertainty-Aware Test-Time Augmented Ensemble of BERTs for Classifying Common Mental Illnesses on Social Media Posts}},
  year = {2023},
  eprint = {2304.04539},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.04539},
}
Figure