contextual and emotional representations from free-form text, enabling robust simultaneous prediction of PHQ-
9 scores and depression severity. The overall classification accuracy of 99.85% and macro F1 score of 0.9984
across the five severity classes demonstrate that the model generalizes well to unseen data without significant
class bias. Per-class analysis revealed perfect classification (F1 = 1.000) for the moderate, moderately severe,
and severe categories, whereas the minimal and mild classes achieved F1 scores of 0.9960 and 0.9961,
respectively, reflecting the expected ambiguity near the boundary thresholds. The MAE of 1.2495 for the PHQ-
9 regression indicates that, on average, the predicted score deviates by fewer than two points from the clinical
ground truth, which is within the acceptable margin for preliminary screening purposes. Three severity classes
(moderate, moderately severe, and severe) achieved perfect precision, recall, and F1 scores of 1.000, whereas
the minimal and mild classes had near-perfect F1 scores of 0.9960 and 0.9961, respectively. The smooth
convergence of both training and validation losses across 8 epochs, with a small and consistent gap between
them, indicates that the model avoids overfitting despite fine-tuning a large pretrained transformer. The use of
AdamW with weight decay and warmup scheduling contributes to training stability. The disentangled attention
mechanism of DeBERTa-V3 appears particularly well suited for mental health text, where the relationship
between emotionally laden content words and their positional context is critical for accurate severity
assessment. Confusion matrix analysis reveals that the majority of misclassifications occur between adjacent
severity classes (e.g., minimal–mild and moderate–moderate–severe boundaries), which is clinically expected
given the continuous and overlapping nature of the PHQ-9 score distributions near threshold boundaries.
Severe cross-class misclassifications (e.g., Minimally predicted as Severe) are rare, indicating that the model
captures global severity patterns effectively. While the model achieves very high classification accuracy
(99.85%) and F1 score (0.9984), this performance should be interpreted in the context of the dataset
characteristics. The PHQ-TextSet dataset is synthetically constructed, and the PHQ-9 is aligned, resulting in well-
structured and semantically clear samples. Unlike real-world user-generated text, which is often noisy,
ambiguous, and linguistically diverse, the controlled nature of the dataset reduces variability and makes
classification boundaries more distinct. Consequently, the reported performance represents an upper bound
estimate under controlled conditions. Future work will focus on evaluating the model on real-world datasets
(e.g., social media text) to assess its generalizability and robustness.
Several limitations should be acknowledged. The PHQ-TextSet dataset, while purpose-built for PHQ-9 alignment
and constructed by the authors, may not fully capture the linguistic diversity of real-world user populations
across different demographics, languages, and cultural contexts. The system is intended solely as a supportive
screening tool and not as a clinical diagnostic instrument. Ethical considerations are critical in the deployment
of automated mental health screening systems. The proposed model is intended solely as a preliminary
screening tool and not as a substitute for professional diagnosis. Incorrect predictions may lead to false
reassurance or unnecessary concern, highlighting the importance of human oversight. Additionally, the use of
text-based data raises privacy concerns, particularly when deployed in real-world applications involving
personal user inputs. Appropriate data handling, anonymization, and user consent mechanisms must be
implemented. Bias is another potential limitation, as the synthetic dataset may not fully represent diverse
linguistic, cultural, and demographic variations. Future work will focus on incorporating real-world
datasets and conducting fairness evaluations to ensure equitable performance across different
populations. Future work will explore dataset expansion with diverse real-world samples, clinical validation
with mental health professionals, multimodal input integration, and enhanced model interpretability through
attention visualization and explanation methods.
8. Conclusion
In this study, a multi-task DeBERTa-V3-based depression detection system that jointly predicts PHQ-9 scores
and depression severity levels from user-entered free-form text is presented. The proposed architecture
integrates a pretrained transformer encoder with separate regression and classification heads trained jointly
using a combined MSE and cross-entropy loss function. The system was trained and evaluated on the PHQ-
TextSet dataset, an original author-constructed dataset comprising 3,235 annotated text samples across five
PHQ-9 severity classes. The model achieved a classification accuracy of 99.85%, a macro F1 score of 0.9984, and
a mean absolute error of 1.2495 for the PHQ-9 score regression on the validation set. The weighted AUC of 0.96
further demonstrates strong discriminative performance across severity classes. These results confirm that
transformer-based multitask learning can effectively bridge the gap between clinical PHQ-9 assessment
frameworks and everyday natural language expression, offering a scalable and accessible alternative to
structured questionnaire-based screening. The deployment of the trained model as a real-time FastAPI service
highlights the practical viability of the proposed system for integration into digital mental health platforms,
telemedicine systems and educational wellness applications. The confidence score output supports transparent
and responsible clinical usage. Future research directions include expanding the training dataset with diverse
real-world samples, incorporating multimodal inputs, conducting clinical validation studies, and improving