Loading…
Loading…
BDI-batch is a specialized sentence transformer model fine-tuned using contrastive learning for the precise retrieval of sentences related to depression symptoms defined in the Beck Depression Inventory (BDI). This model builds upon sentence-transformers/all-mpnet-base-v2 and has been optimized to distinguish between closely related depressive symptoms.
Unlike general-purpose sentence embeddings, BDI-batch is specifically designed to capture fine-grained semantic distinctions among the 21 symptoms defined in the BDI clinical questionnaire. The model was trained using a novel in-batch contrastive learning approach that leverages the structure of standardized clinical questionnaires to generate meaningful hard negatives automatically.
sentence-transformers/all-mpnet-base-v2 (384 dimensions)This model is designed for research and analysis purposes in mental health informatics. Primary use cases include:
The model shows substantial improvements over baseline sentence embeddings and state-of-the-art retrieval models on two eRisk challenge datasets:
| Metric | all-mpnet-base-v2 | BDI-batch | Improvement |
|---|---|---|---|
| R@100 | 0.291 | 0.372 | +27.8% |
| NDCG@10 | 0.834 | 0.947 | +13.5% |
| NDCG@1000 | 0.698 | 0.817 | +17.0% |
| Metric | all-mpnet-base-v2 | BDI-batch | Improvement |
|---|---|---|---|
| R@100 | 0.268 | 0.315 | +17.5% |
| NDCG@10 | 0.926 | 0.976 | +5.4% |
| NDCG@1000 | 0.805 | 0.948 | +17.8% |
Top-performing symptoms (largest relative improvements):
The model particularly excels at disambiguating between closely related symptoms such as:
pip install sentence-transformers
from sentence_transformers import util
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('your-username/bdi-batch-all-mpnet-base-v2')
# BDI symptom queries
query = "I feel sad much of the time" # Sadness symptom
# Sentences to rank
sentences = [
"I feel so sad that I can't bear it",
"I feel more irritable than usual",
"I've been crying a lot lately",
"I don't enjoy things like I used to"
]
# Encode
query_embedding = model.encode(query, convert_to_tensor=True)
sentence_embeddings = model.encode(sentences, convert_to_tensor=True)
# Compute similarity scores
similarity_scores = util.pytorch_cos_sim(query_embedding, sentence_embeddings)[0]
# Rank by similarity
ranked_results = sorted(
zip(sentences, similarity_scores),
key=lambda x: x[1],
reverse=True
)
for sentence, score in ranked_results:
print(f"{score:.4f} - {sentence}")
# For processing multiple symptom queries
bdi_symptoms = {
"Sadness": "I feel sad much of the time",
"Crying": "I cry more than I used to",
"Pessimism": "I do not expect things to work out for me",
"Loss of Pleasure": "I don't enjoy things as much as I used to"
}
# Encode corpus
corpus = [
"I'm always sad and can't find joy in anything",
"Everything seems hopeless to me",
"I cry at the smallest things now"
# ... more sentences from social media corpus
]
corpus_embeddings = model.encode(corpus, convert_to_tensor=True)
# Retrieve relevant sentences per symptom
for symptom_name, symptom_query in bdi_symptoms.items():
query_embedding = model.encode(symptom_query, convert_to_tensor=True)
similarity_scores = util.pytorch_cos_sim(query_embedding, corpus_embeddings)[0]
# Get top-k most similar sentences
top_k_results = util.semantic_search(query_embedding, corpus_embeddings, top_k=10)
from sentence_transformers import util
query = "I have been thinking about suicide"
corpus = ["Your corpus of sentences here..."]
# Encode query and corpus
query_embedding = model.encode(query, convert_to_tensor=True)
corpus_embeddings = model.encode(corpus, convert_to_tensor=True)
# Perform semantic search
results = util.semantic_search(query_embedding, corpus_embeddings, top_k=10)
# Print results
for result in results[0]:
print(f"Score: {result['score']:.4f} - {corpus[result['corpus_id']]}")
The model was fine-tuned using a novel in-batch contrastive learning method that leverages the structure of the Beck Depression Inventory:
Hard Negative Generation: Instead of random negatives, the method groups related BDI symptoms and creates contrastive batches containing the most semantically similar symptoms (k=10 symptoms per batch)
Training Signal: For each BDI symptom, two random responses from the questionnaire are sampled to create positive pairs. Other symptoms in the batch serve as hard negatives, forcing the model to learn fine-grained distinctions.
Loss Function: MultipleNegativesRankingLoss encourages pairs from the same symptom to be close while pushing apart different symptoms in the embedding space.
Unlike synthetic hard negatives generated by LLMs, this method leverages clinically validated questionnaires:
Result: The questionnaire-derived pairs significantly outperformed LLM-generated synthetic data (Table 3 in the paper)
The model outperforms several well-established baselines:
| Model | R@100 | NDCG@10 | NDCG@1000 |
|---|---|---|---|
| BM25 | 0.141 | 0.356 | 0.404 |
| BM25 + Cross-Encoder | 0.141 | 0.704 | 0.446 |
| ANCE | 0.274 | 0.802 | 0.664 |
| all-mpnet-base-v2 | 0.291 | 0.834 | 0.698 |
| Contriever | 0.273 | 0.761 | 0.686 |
| BDI-batch (ours) | 0.372 | 0.947 | 0.817 |
The model also outperforms specialized systems from the eRisk 2024 challenge:
Model inference is computationally efficient:
If you use this model, please cite the following paper:
@article{fernandez2026bdi,
title={BDI-batch: Leveraging Standardized Clinical Questionnaires for Contrastive Learning in Psychological Marker Retrieval},
author={Fern{\'a}ndez-Pichel, Marcos and Losada, David E.},
journal={Findings of the 2026 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
year={2026},
organization={Association for Computational Linguistics}
}
This model is licensed under the Apache 2.0 License. The base model (all-mpnet-base-v2) is also distributed under Apache 2.0.
Disclaimer: This model is provided for research purposes only. It should not be used for clinical diagnosis, treatment recommendations, or real-time monitoring of individuals without proper validation, regulatory compliance, and expert oversight. The authors and their institutions are not responsible for misuse of this model or harm resulting from its application.
sentence-transformers/all-mpnet-base-v2