cihatyldz/sifahane-bert-turkish-medical
🏥 Şifahane — Turkish Medical Text Classification (BERT)
A fine-tuned Turkish BERT model for classifying patient complaints into 12 medical departments with high accuracy.
This model is part of the Şifahane project, a dual-model medical triage demo comparing a fine-tuned BERT classifier against a zero-shot LLM.
Model Overview
Intended Use
Primary use case: Classifying Turkish patient complaints into the appropriate medical department for triage routing.
Input: Free-text patient complaint in Turkish. Output: Predicted department label with confidence scores.
Example
Input: "Göğsümde şiddetli ağrı var, sol koluma yayılıyor, terleme eşlik ediyor."
Output: Kardiyoloji (98.7%)Supported Classes (12 Departments)
Quick Start
With Transformers Pipeline
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="cihatyldz/sifahane-bert-turkish-medical",
top_k=3,
)
result = classifier("Midemde şiddetli yanma var, 2 haftadır devam ediyor.")
print(result)
# [[{'label': 'Gastroenteroloji', 'score': 0.98}, ...]]Manual Inference
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import torch.nn.functional as F
model_name = "cihatyldz/sifahane-bert-turkish-medical"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
model.eval()
text = "Başımın sol tarafında zonklayıcı ağrı var, ışığa hassaslaştım."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
with torch.no_grad():
outputs = model(**inputs)
probs = F.softmax(outputs.logits, dim=-1)[0]
pred_id = probs.argmax().item()
label = model.config.id2label[pred_id]
confidence = probs[pred_id].item()
print(f"Department: {label} ({confidence:.1%})")
# Department: Nöroloji (97.2%)Training Details
Dataset
- Source: `cihatyldz/sifahane-turkish-medical-complaints`
- Size: ~6,000 synthetic Turkish patient complaints
- Generation Method: Template-based synthesis with randomized clinical parameters (duration, intensity, symptoms, body location)
- Coverage: 12 departments × 36 conditions × 3 urgency levels
- Split: 80% train / 10% validation / 10% test (stratified)
Training Configuration
Training Infrastructure
- Hardware: NVIDIA Tesla T4 (Google Colab)
- Training time: ~5–10 minutes
- Framework: Hugging Face Transformers + Trainer API
Evaluation Results
Evaluated on the held-out test split (~600 examples):
Note: High scores reflect the synthetic nature of the training data with clear template patterns. Real-world clinical text would yield lower but still useful performance. The model demonstrates strong pattern recognition within its training distribution.
Live Demo
Try the model in action at the Şifahane Space, where it runs side-by-side with a zero-shot LLM (Qwen2.5-7B):
🚀 [Şifahane Demo](https://huggingface.co/spaces/cihatyldz/sifahane-turkish-medical)
The demo compares two approaches:
Project Portfolio
This model is part of a Turkish NLP portfolio demonstrating three different AI architectures across three domains:
Limitations & Ethical Considerations
- Not a medical device: This model is for research and educational purposes only. It should never be used for actual medical diagnosis or triage decisions.
- Synthetic training data: The model was trained on template-generated data, not real clinical records. Performance on real-world patient language may differ.
- Turkish only: The model is designed for Turkish text and will not perform well on other languages.
- Fixed taxonomy: The model only supports the 12 predefined departments. Complaints outside these categories may be misclassified.
- No urgency assessment: This model predicts department only. Urgency classification requires additional logic (see the Şifahane Space for a rule-based urgency module).
Citation
@misc{yildiz2025sifahane,
author = {Cihat Yıldız},
title = {Şifahane: Turkish Medical Text Classification with Fine-tuned BERT},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/cihatyldz/sifahane-bert-turkish-medical}
}Contact
- Developer: Cihat Yıldız
- Hugging Face: @cihatyldz
- Demo: Şifahane Space
