Effectiveness of Transformer-Based Models for Detecting Depression-Related Language in Social Media: A Comparative Analysis.

Depression is one of the most common mental health conditions worldwide, yet many affected people remain undiagnosed and untreated. Social media posts provide observable language patterns associated with depression, creating an opportunity for scalable screening, but most automated approaches classify single posts in isolation and ignore the user's posting history. The purpose of this study was therefore to examine the effectiveness of a context-aware transformer-based model for detecting depression-related language in social media posts. Specifically, the study evaluated a weight-shared RoBERTa dual encoder that jointly processes the current tweet and up to five prior posts by the same user, compared it with classical classifiers using term frequency–inverse document frequency (TF-IDF) features, and analysed its errors and prediction confidence. The study was anchored on transformer self-attention and transfer learning theory and supported by Beck's cognitive theory of depression and the bias–variance trade-off. A quantitative comparative experimental design based on secondary data was adopted. The publicly available Twitter Depression Dataset was cleaned through language, length and duplicate filters, yielding 7,370 tweets from 12 accounts posted between October 2012 and August 2021, and was partitioned at the user level. On the validation set, the RoBERTa model achieved an F1-score of 0.9286, above the best classical validation F1-score of 0.9080. On a held-out test set of 1,098 tweets from two accounts, it achieved an accuracy of 0.9891, precision of 0.9528, recall of 0.9352, F1-score of 0.9439 and ROC-AUC of 0.9991, compared with an F1-score of 0.8123 for logistic regression. The model misclassified 12 tweets (5 false positives and 7 false negatives) and was markedly less certain on its errors than on its correct predictions. The study concludes that context-aware transformer representations detect dataset-defined depression-related language more effectively than classical bag-of-words approaches. However, because the labels are automatically assigned and the test set contains only two accounts, the results do not establish clinical diagnoses or generalization to new users. The study recommends that such models be used only as screening aids with human review of low-confidence predictions, and that future work use clinician-verified labels, more diverse users and statistical significance testing.

Authors

Publication Details

Journal
International Journal of Social Science and Humanities Research (IJSSHR)
Published
2026-11-22
DOI
https://doi.org/10.61108/ijsshr.v4i3.357
Primary Topic
Mental Health via Writing
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
article

Effectiveness of Transformer-Based Models for Detecting Depression-Related Language in Social Media: A Comparative Analysis.

J.K. Muriithi, Muo Charles
International Journal of Social Science and Humanities Research (IJSSHR)
Mental Health via Writing
article

Effectiveness of Transformer-Based Models for Detecting Depression-Related Language in Social Media: A Comparative Analysis.

J.K. Muriithi, Muo Charles
article en

Abstract

Depression is one of the most common mental health conditions worldwide, yet many affected people remain undiagnosed and untreated. Social media posts provide observable language patterns associated with depression, creating an opportunity for scalable screening, but most automated approaches classify single posts in isolation and ignore the user's posting history. The purpose of this study was therefore to examine the effectiveness of a context-aware transformer-based model for detecting depression-related language in social media posts. Specifically, the study evaluated a weight-shared RoBERTa dual encoder that jointly processes the current tweet and up to five prior posts by the same user, compared it with classical classifiers using term frequency–inverse document frequency (TF-IDF) features, and analysed its errors and prediction confidence. The study was anchored on transformer self-attention and transfer learning theory and supported by Beck's cognitive theory of depression and the bias–variance trade-off. A quantitative comparative experimental design based on secondary data was adopted. The publicly available Twitter Depression Dataset was cleaned through language, length and duplicate filters, yielding 7,370 tweets from 12 accounts posted between October 2012 and August 2021, and was partitioned at the user level. On the validation set, the RoBERTa model achieved an F1-score of 0.9286, above the best classical validation F1-score of 0.9080. On a held-out test set of 1,098 tweets from two accounts, it achieved an accuracy of 0.9891, precision of 0.9528, recall of 0.9352, F1-score of 0.9439 and ROC-AUC of 0.9991, compared with an F1-score of 0.8123 for logistic regression. The model misclassified 12 tweets (5 false positives and 7 false negatives) and was markedly less certain on its errors than on its correct predictions. The study concludes that context-aware transformer representations detect dataset-defined depression-related language more effectively than classical bag-of-words approaches. However, because the labels are automatically assigned and the test set contains only two accounts, the results do not establish clinical diagnoses or generalization to new users. The study recommends that such models be used only as screening aids with human review of low-confidence predictions, and that future work use clinician-verified labels, more diverse users and statistical significance testing.

International Journal of Social Science and Humanities Research (IJSSHR)Vol. 4(3)
Mental Health via Writing
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon