🧠 MentalBERT Quick Vibe v2
Calibrated, safety-aware mental health text classifier with abstention.
Post-hoc upgrade toitsLu/mentalbert-v5-source-aware— encoder weights are unchanged.
Model Description
Quick Vibe v2 wraps the cooperative source-aware MentalBERT encoder with three post-hoc layers:
- Per-class temperature scaling — fit on validation NLL via LBFGS; reduces overconfidence and improves calibration (ECE).
- Asymmetric Dep/Sui safety margin — when Depression and Suicidal are the top two predictions with a margin < threshold, the prediction is flipped to Suicidal (the safer clinical alarm).
- Calibrated abstention — when top-1 calibrated confidence < threshold, the model returns
ABSTAINrather than a low-confidence guess.
Architecture
SourceAwareMentalBERT (frozen):
bert: mental/mental-bert-base-uncased
cls_head: nn.Linear(768, 8) ← loaded from itsLu/mentalbert-v5-source-aware
Post-hoc stack (this repo):
Per-class temperature T ∈ ℝ⁸ ← calibration.pt
Asymmetric safety margin ← decision_thresholds.json
Abstention threshold ← decision_thresholds.json
Dataset
Trained and calibrated on mohamedasem318/mental-health-dataset-extended-v5
(stratified 70/10/20 split, random_state=42).
Performance
| Run | Coverage | Acc (covered) | F1 Macro | Sui→Dep | Dep→Sui | Total Bleed |
|---|---|---|---|---|---|---|
| v1 (deployed) | 100.0% | 83.23% | 0.8381 | 544 | 715 | 1,259 |
| v2 (this) | 89.8% | 87.48% | 0.8763 | 354 | 553 | 907 |
Intended Use
Intended for mental health screening as a second-tier triage component
(Vibecheck deployment). Not a diagnostic instrument.
All outputs require human clinical review before action.
Out of Scope
- NOT a diagnostic instrument. This model cannot diagnose mental health conditions.
- NOT a replacement for clinical judgement. All ABSTAIN and Suicidal predictions must be reviewed by a qualified professional.
- NOT validated for production without a prospective clinical study.
⚠️ Clinical Safety Disclaimer
This model is a research prototype. Predictions, including Suicidal classifications,
are probabilistic and will contain errors. Do not use as the sole basis for
clinical decisions. Always involve a qualified mental health professional.
Usage
from huggingface_hub import hf_hub_download
import runpy, sys
# Download inference.py and run it in your environment
path = hf_hub_download(repo_id='itsLu/mentalbert-v5-quick-vibe-v2', filename='inference.py')
# Or: import directly once the file is on your path
# from inference import predict
# result = predict("I feel hopeless and empty.")
# print(result)
# {
# 'label': 'Depression',
# 'confidence': 0.72,
# 'all_probs': {...},
# # 'abstained': False, 'safety_flipped': False
# }
Files
| File | Description |
|---|---|
calibration.pt |
Per-class temperature tensors |
decision_thresholds.json |
abstain_thresh, dep_sui_margin, metrics |
inference.py |
Self-contained load + predict script |
Citation
@misc{mentalbert-quickvibe-v2,
author = {Mohamed Asem},
title = {MentalBERT Quick Vibe v2: Calibrated Safety-Aware Mental Health Classifier},
year = {2025},
url = {https://huggingface.co/itsLu/mentalbert-v5-quick-vibe-v2}
}
Model tree for itsLu/mentalbert-v5-quick-vibe-v2
Base model
itsLu/mentalbert-v5-source-aware