A COMPARATIVE STUDY ON TRANSFORMER-BASED MODELS FOR MENTAL ILLNESS CLASSIFICATION IN SOCIAL MEDIA TEXT
Keywords:
Natural Language Processing (NLP), Mental Illness Classification, Transformer Models, BERT, DistilBERT, XLNet, Zero-Shot Learning, Tweet Analysis, Sentiment Analysis, Social Media Mining.Abstract
Mental health issues have been escalating globally, presenting a critical challenge in early diagnosis and timely intervention. Traditional diagnostic methods often rely on direct clinical assessment, which can be inaccessible, stigmatized, or delayed. In this context, social media platforms such as Twitter serve as rich, real-time sources of self-expressed emotional content, offering unprecedented opportunities for scalable mental health surveillance. This study investigates the efficacy of transformer-based Natural Language Processing (NLP) models in classifying mental health conditions from tweets. Specifically, we apply and compare four models—BERT, DistilBERT, XLNet, and a Zero-Shot classification model—on a curated dataset of over 31,000 English tweets. Each tweet is classified into one of six categories: depression, anxiety, ADHD, PTSD, bipolar disorder, or normal.To prepare the data, a comprehensive preprocessing pipeline was employed involving text normalization, lemmatization, and removal of noise and stopwords. Visual analytics such as word clouds, sentiment polarity distribution, and n-gram frequency graphs were used to understand the underlying structure of the dataset. The models were evaluated based on the distribution of predicted labels and qualitative analysis, as the original dataset lacked ground truth annotations.Results show that BERT consistently provides balanced and reliable predictions, while DistilBERT offers computational efficiency with slight trade-offs in output balance. XLNet, although computationally heavier, demonstrates nuanced understanding of tweet semantics. The Zero-Shot classifier shows remarkable flexibility in classification without the need for retraining, albeit at a higher computational cost. This research highlights the strengths and limitations of each model, establishing a foundation for integrating such architectures in real-time mental health monitoring tools. Future directions include fine-tuning on labeled clinical datasets and incorporating user-level metadata to enhance predictive robustness.