balidea safeguard · crisis_help_detector · v2

Multilingual (ES/GL) safeguard classifier for clinical chatbot traffic — a full fine-tune of FacebookAI/xlm-roberta-base (no LoRA). Part of the v2 rebuild on a provenance-aware train/val/test methodology; supersedes the deprecated v1.

⚠️ Validation caveat. This model was trained with gold-in-train: ~413 rows of the production .ods acceptance set are in the training split, so the standard acceptance gate against the full .ods is not a clean check and was skipped for this upload. It is validated only on the held-out 20% gold-test slice below. The .ods is a curated 886-prompt set, not live production traffic — treat these numbers as a proxy and confirm on real traffic before relying on the model.

Model details

Field Value
Base model FacebookAI/xlm-roberta-base
Task / policy crisis_help_detector / crisis-help-production-v2 (production-v2)
Languages es, gl
Labels 0 = negative/pass, 1 = positive/flag
Decision threshold 0.9900
Temperature (Guo et al. 2017) 1.4116
Calibration slice val (recall=0.9970059880239521, fp=0.0010298661174047373)
Dataset slug v2-crisis_help_detector-seed20260526

Held-out gold-test (production .ods slice unseen in training)

n = 137 (95 positive, 42 negative).

Operating point recall FP ROC-AUC acceptance
shipped (threshold=0.990, val-calibrated) 1.0 0.0 1.0 ✅
gold-recalibrated (threshold=0.99) 1.0 0.0 — ✅

ROC-AUC is threshold-free (model quality); recall/FP depend on the operating point. Confidence intervals and per-language slices are in the project's reports/v2/crisis_help_detector_lr_check_goldtrain.json.

Training

Known-good XLM-R recipe with early stopping (no epoch grid, no LoRA, no focal loss):

  • epochs ceiling: 4 (early stopping, patience 2, metric eval_loss)
  • learning rate: 1e-05
  • weight decay: 0.01, warmup ratio: 0.06
  • batch size: 16, max length: 256, seed: 20260526

Train split sources (n=8165, labels={'0': 5924, '1': 2241}):

source rows
chitchat 1880
prod_medical_queries 1812
prod_crisis_positives 1648
snomed_clinical 1451
balidea_malign 660
ods 413
translated_aimh-crisis 204
author_seeds 97

Usage

from safeguard.inference import SafeguardClassifier  # applies temperature + threshold

clf = SafeguardClassifier("crisis_help_detector-v2")  # or a local path / this repo id
print(clf.predict_detailed(["texto a clasificar"]))

Raw transformers (remember to apply temperature 1.412 and threshold 0.990):

from transformers import AutoModelForSequenceClassification, AutoTokenizer
model = AutoModelForSequenceClassification.from_pretrained("REPO_ID")
tokenizer = AutoTokenizer.from_pretrained("REPO_ID")
Downloads last month
7
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support