Text Classification
Transformers
Safetensors
PEFT
English
bert
medical-triage
biomedbert
frozen-encoder
healthcare
symptom-checker
natural-language-processing
academic-project
Eval Results (legacy)
text-embeddings-inference
Instructions to use cristian-untaru/frozen-encoder-biomedbert-medical-triage with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cristian-untaru/frozen-encoder-biomedbert-medical-triage with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="cristian-untaru/frozen-encoder-biomedbert-medical-triage")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("cristian-untaru/frozen-encoder-biomedbert-medical-triage") model = AutoModelForSequenceClassification.from_pretrained("cristian-untaru/frozen-encoder-biomedbert-medical-triage", device_map="auto") - PEFT
How to use cristian-untaru/frozen-encoder-biomedbert-medical-triage with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
File size: 11,812 Bytes
ed1002b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | ---
license: mit
language:
- en
datasets:
- cristian-untaru/symcat-medical-triage-dataset
tags:
- medical-triage
- text-classification
- biomedbert
- peft
- frozen-encoder
- healthcare
- symptom-checker
- natural-language-processing
- academic-project
pipeline_tag: text-classification
library_name: transformers
base_model: microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext
model-index:
- name: frozen-encoder-biomedbert-medical-triage
results:
- task:
type: text-classification
name: Medical pre-triage classification
dataset:
name: SymCAT Medical Triage Dataset
type: cristian-untaru/symcat-medical-triage-dataset
metrics:
- type: accuracy
value: 0.6038
name: Accuracy
- type: f1
value: 0.6107
name: Macro F1
- type: precision
value: 0.6201
name: Macro Precision
- type: recall
value: 0.6058
name: Macro Recall
- type: roc_auc
value: 0.8076
name: Macro AUC OvR
---
# Frozen Encoder BioMedBERT Medical Triage Classifier
## Model Description
This repository contains a frozen-encoder BioMedBERT sequence classification model. The pretrained encoder is kept frozen and only the classification head is trained.
The model receives a short English symptom description and predicts one of the following triage-oriented labels:
- `self_monitor`
- `consult_gp`
- `urgent`
This model was developed as part of the **SortMed** academic project, a medical pre-triage assistant prototype built for a bachelor's thesis by **Cristian Untaru** at the **West University of Timișoara, Faculty of Informatics**.
The model is intended for research and educational use. It is not a diagnostic system and is not a certified medical device.
## Intended Use
This model is intended to be used in an academic medical pre-triage prototype for:
- classifying English symptom descriptions into broad urgency categories;
- comparing transformer-based models for medical text classification;
- evaluating full fine-tuning against parameter-efficient fine-tuning methods;
- supporting experimental NLP research in symptom-based medical pre-triage.
Example input:
```text
I have chest pain, shortness of breath, and I feel dizzy.
```
Example output:
```text
urgent
```
## Out-of-Scope Use
This model must not be used as:
- a replacement for professional medical advice;
- a diagnostic system;
- an emergency decision-making tool;
- a certified clinical triage system;
- a standalone healthcare product;
- a tool for non-English medical text without additional validation.
For severe, worsening, or emergency symptoms, users should contact emergency services or a qualified healthcare professional.
## Labels
The model predicts one of three labels:
| Label | Meaning |
|---|---|
| `self_monitor` | Symptoms appear mild and may be monitored, assuming no worsening or additional warning signs. |
| `consult_gp` | A general practitioner or non-emergency medical professional should be consulted. |
| `urgent` | Symptoms may require urgent medical attention or emergency evaluation. |
The label mapping is included in [`label_map.json`](./label_map.json) and in the model configuration.
Expected mapping:
```python
{
0: "self_monitor",
1: "consult_gp",
2: "urgent",
}
```
## Training Data
The model was trained on the [`cristian-untaru/symcat-medical-triage-dataset`](https://huggingface.co/datasets/cristian-untaru/symcat-medical-triage-dataset), a SymCAT-derived dataset prepared for academic experiments in medical pre-triage classification.
The dataset contains English symptom-based text examples labeled into three triage classes:
- `self_monitor`
- `consult_gp`
- `urgent`
Dataset split used for training:
| Split | Examples |
|---|---:|
| Train | 490 |
| Validation | 105 |
| Test | 106 |
| Total | 701 |
The dataset labels were produced using rule-based triage logic for academic experimentation. They are not clinically validated annotations from medical professionals.
MedQuAD was not used to train this classifier. In the broader SortMed system, MedQuAD is used separately for retrieval of related medical information through the [`cristian-untaru/medquad-retrieval-pretriage`](https://huggingface.co/datasets/cristian-untaru/medquad-retrieval-pretriage) dataset.
## Training Procedure
Base checkpoint:
```text
microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext
```
| Parameter | Value |
|---|---:|
| Fine-tuning method | Frozen Encoder + Trainable Classification Head |
| Maximum sequence length | 128 |
| Epochs | 8 |
| Train batch size | 16 |
| Evaluation batch size | 32 |
| Learning rate | 0.0002 |
| Weight decay | 0.01 |
| Warmup ratio | 0.1 |
| Mixed precision | FP16 |
| Early stopping patience | 3 |
| Best checkpoint metric | f1 |
| Random seed | 42 |
| Trainable modules | pooler, classifier |
Additional training metadata is available in [`training_config.json`](./training_config.json).
## Evaluation Results
The model was evaluated on the held-out test split.
| Metric | Test Score |
|---|---:|
| Accuracy | 0.6038 |
| Macro Precision | 0.6201 |
| Macro Recall / Sensitivity | 0.6058 |
| Macro Specificity | 0.7995 |
| Macro F1 | 0.6107 |
| Macro AUC OvR | 0.8076 |
| Macro IoU / Jaccard | 0.4444 |
| Test Loss | 0.8381 |
### Per-Class Results
Per-class metrics are not currently published as a separate artifact in this repository. The aggregate test metrics above are the available published evaluation results.
These results should be interpreted in the context of the small dataset size and the academic nature of the experiment.
## How to Use
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
repo_id = "cristian-untaru/frozen-encoder-biomedbert-medical-triage"
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
text = "I have chest pain, shortness of breath, and I feel dizzy."
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
padding=True,
max_length=128
)
with torch.no_grad():
outputs = model(**inputs)
probabilities = torch.softmax(outputs.logits, dim=-1)
predicted_class_id = torch.argmax(probabilities, dim=-1).item()
predicted_label = model.config.id2label[predicted_class_id]
confidence = probabilities[0][predicted_class_id].item()
print("Predicted label:", predicted_label)
print("Confidence:", round(confidence, 4))
```
This model loads with the standard Transformers API and does not require `trust_remote_code=True`.
To verify the label mapping:
```python
print(model.config.id2label)
```
Expected output:
```python
{0: "self_monitor", 1: "consult_gp", 2: "urgent"}
```
## Repository Files
| File | Description |
|---|---|
| `config.json` | Model architecture, label mapping, and classification configuration. |
| `model.safetensors` | Model weights in SafeTensors format. |
| `tokenizer.json` | Tokenizer vocabulary and processing pipeline. |
| `tokenizer_config.json` | Tokenizer configuration. |
| `training_config.json` | Human-readable training configuration. |
| `label_map.json` | Mapping between numeric class IDs and triage labels. |
| `README.md` | Model card documentation. |
| `.gitattributes` | Git LFS configuration for large model files. |
## Limitations
This model has several important limitations:
- It was trained on a small academic dataset.
- The labels are rule-based and not clinically validated by medical experts.
- It does not perform medical diagnosis.
- It does not consider patient age, sex, medical history, medication history, vital signs, comorbidities, pregnancy status, allergies, or physical examination findings.
- It may produce incorrect predictions for rare, ambiguous, incomplete, severe, or contradictory symptom descriptions.
- It was trained for English text only.
- It should not be used for emergency triage without medical supervision.
- Its predictions depend on the quality and completeness of the user-provided text.
## Ethical and Safety Considerations
Medical pre-triage systems can influence user decisions in sensitive healthcare situations. This model should therefore be used only with clear disclaimers and with safeguards that encourage users to seek professional medical care when appropriate.
Any real-world deployment would require:
- clinical expert review;
- validation on larger and more representative medical datasets;
- safety testing;
- bias and fairness evaluation;
- monitoring for incorrect or unsafe predictions;
- clear user-facing warnings;
- escalation rules for emergency symptoms.
## Medical Disclaimer
This model is intended only for academic, research, and prototype development purposes. It is not a substitute for professional medical advice, diagnosis, treatment, or emergency care.
If symptoms are severe, sudden, worsening, or potentially life-threatening, users should contact emergency services or a qualified healthcare professional immediately.
## Related Datasets
- [`cristian-untaru/symcat-medical-triage-dataset`](https://huggingface.co/datasets/cristian-untaru/symcat-medical-triage-dataset)
- [`cristian-untaru/medquad-retrieval-pretriage`](https://huggingface.co/datasets/cristian-untaru/medquad-retrieval-pretriage)
## Related Models
### Full Fine-Tuned Models
- [`cristian-untaru/distilbert-medical-triage`](https://huggingface.co/cristian-untaru/distilbert-medical-triage)
- [`cristian-untaru/biobert-medical-triage`](https://huggingface.co/cristian-untaru/biobert-medical-triage)
- [`cristian-untaru/roberta-medical-triage`](https://huggingface.co/cristian-untaru/roberta-medical-triage)
- [`cristian-untaru/biomedbert-medical-triage`](https://huggingface.co/cristian-untaru/biomedbert-medical-triage)
### LoRA Models
- [`cristian-untaru/lora-distilbert-medical-triage`](https://huggingface.co/cristian-untaru/lora-distilbert-medical-triage)
- [`cristian-untaru/lora-biobert-medical-triage`](https://huggingface.co/cristian-untaru/lora-biobert-medical-triage)
- [`cristian-untaru/lora-roberta-medical-triage`](https://huggingface.co/cristian-untaru/lora-roberta-medical-triage)
- [`cristian-untaru/lora-biomedbert-medical-triage`](https://huggingface.co/cristian-untaru/lora-biomedbert-medical-triage)
### Bottleneck MLP Adapter Models
- [`cristian-untaru/bottleneck-mlp-distilbert-medical-triage`](https://huggingface.co/cristian-untaru/bottleneck-mlp-distilbert-medical-triage)
- [`cristian-untaru/bottleneck-mlp-biobert-medical-triage`](https://huggingface.co/cristian-untaru/bottleneck-mlp-biobert-medical-triage)
- [`cristian-untaru/bottleneck-mlp-roberta-medical-triage`](https://huggingface.co/cristian-untaru/bottleneck-mlp-roberta-medical-triage)
- [`cristian-untaru/bottleneck-mlp-biomedbert-medical-triage`](https://huggingface.co/cristian-untaru/bottleneck-mlp-biomedbert-medical-triage)
### Frozen Encoder Models
- [`cristian-untaru/frozen-encoder-distilbert-medical-triage`](https://huggingface.co/cristian-untaru/frozen-encoder-distilbert-medical-triage)
- [`cristian-untaru/frozen-encoder-biobert-medical-triage`](https://huggingface.co/cristian-untaru/frozen-encoder-biobert-medical-triage)
- [`cristian-untaru/frozen-encoder-roberta-medical-triage`](https://huggingface.co/cristian-untaru/frozen-encoder-roberta-medical-triage)
- [`cristian-untaru/frozen-encoder-biomedbert-medical-triage`](https://huggingface.co/cristian-untaru/frozen-encoder-biomedbert-medical-triage)
|