Instructions to use ai-triyaj/gemma4-26B-A4B-triage-turkish with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use ai-triyaj/gemma4-26B-A4B-triage-turkish with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("ai-triyaj/gemma4-26B-A4B-triage-turkish") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use ai-triyaj/gemma4-26B-A4B-triage-turkish with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "ai-triyaj/gemma4-26B-A4B-triage-turkish"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "ai-triyaj/gemma4-26B-A4B-triage-turkish" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use ai-triyaj/gemma4-26B-A4B-triage-turkish with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "ai-triyaj/gemma4-26B-A4B-triage-turkish"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default ai-triyaj/gemma4-26B-A4B-triage-turkish
Run Hermes
hermes
- OpenClaw new
How to use ai-triyaj/gemma4-26B-A4B-triage-turkish with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "ai-triyaj/gemma4-26B-A4B-triage-turkish"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "ai-triyaj/gemma4-26B-A4B-triage-turkish" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- MLX LM
How to use ai-triyaj/gemma4-26B-A4B-triage-turkish with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "ai-triyaj/gemma4-26B-A4B-triage-turkish"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "ai-triyaj/gemma4-26B-A4B-triage-turkish" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ai-triyaj/gemma4-26B-A4B-triage-turkish", "messages": [ {"role": "user", "content": "Hello"} ] }'
Gemma 4 26B A4B — Turkish Emergency Triage
Türkiye acil servislerine özel, Türkçe triyaj kararı veren konuşmacı dil modeli.
Küresel triyaj sistemleri (CTAS, ESI) genel nüfus ve geniş klinik senaryolar için tasarlanmış olup uygulamada uzun değerlendirme süreçleri gerektirmektedir. Bu model, Türkiye acil servis pratiğine uygun olarak; hızlı, odaklı ve spesifik sorularla hastayı yönlendiren, gereksiz adımları elemek yerine doğrudan karar noktasına ulaşan bir triyaj akışı için tasarlandı. Hasta ile Türkçe doğal dil diyalogu kurarak semptomları toplar ve RED / YELLOW / GREEN triyaj kararı üretir.
Base model:
mlx-community/gemma-4-26B-A4B-it-OptiQ-4bit
Fine-tuning: LoRA (mlx-lm + mlx-optiq), 2000 iterasyon
Format: 4-bit quantized safetensors (fused, adapter ayrı gerekmez)
Benchmark
Fine-tuned modelimiz 648 vakalık test setinde tüm baseline modelleri geride bıraktı.
Öne çıkan fark: diğer modeller RED'e aşırı yönelirken, fine-tuned model üç sınıf arasında en dengeli dağılımı gösterdi.
Görev
Hastanın şikayetini Türkçe konuşma diliyle alır, yapılandırılmış sorularla klinik bilgiyi toplar ve triyaj kararını verir:
| Karar | Anlam |
|---|---|
| 🔴 RED | Acil, hemen müdahale gerektirir |
| 🟡 YELLOW | Yarı acil, kısa sürede bakılmalı |
| 🟢 GREEN | Acil değil, bekleyebilir |
Model Mimarisi
- Gemma 4 26B A4B (Mixture-of-Experts): 26B toplam parametre, token başına 4B aktif
- 4-bit OptiQ quantization: hassasiyet-odaklı mixed-precision (attention katmanları 8-bit, MLP 4-bit)
- LoRA fine-tuning: yalnızca adapter ağırlıkları eğitildi, ardından base model ile birleştirildi
Eğitim Verisi
Eğitim verisi, bir acil tıp doktoru ile iş birliği yapılarak oluşturuldu.
Doktorumuz, 117 farklı şikayet kategorisi (göğüs ağrısı, nefes darlığı, karın ağrısı vb.) için CTAS/ESI protokollerine dayalı ve Türkiye'deki sisteme uygun karar ağaçları (path) tasarladı. Her path; hangi soruların sorulacağını, hangi cevabın hangi triyaj kararına yol açacağını ve doğrudan RED kararı gerektiren tetikleyici semptomları tanımlar.
Bu pathler temel alınarak Gemini ile 6.475 sentetik Türkçe diyalog üretildi:
- 441 karar yolu (path) — 117 şikayet kategorisi
- Hasta profili çeşitliliği: temiz / hafif messy / ağır messy / çelişkili
- Muğlak cevap senaryoları (%20): hasta önce belirsiz cevap verir, asistan netleştirir
- 8 farklı senaryo stili: yüz yüze triyaj, 112 araması, ambulansla geliş vb.
- Risk faktörleri: diyabet, kalp hastası, hamilelik, hipertansiyon vb.
| Split | Kayıt |
|---|---|
| Train | 5.180 |
| Val | 646 |
| Test | 648 |
| Toplam | 6.474 |
Fine-tuning
Eğitim, Apple Silicon üzerinde MacBook M4 Pro 24GB kullanılarak tamamen yerel olarak mlx-lm ve mlx-optiq kütüphaneleri ile gerçekleştirildi.
Framework : mlx-lm 0.31.3 + mlx-optiq
Yöntem : LoRA (r=8, alpha=16)
İterasyon : 2000
Batch size : 4
Max seq len: 1024
Optimizer : AdamW
Donanım : Apple Silicon (MacBook M4 Pro 24GB)
Val loss: 9.9 → 0.761 (2000 iterasyon)
Değerlendirme
Test seti: 648 örnek, tüm modeller aynı diyaloglar üzerinde, data leakage olmadan değerlendirildi.
Genel Accuracy
| Model | Accuracy | Doğru/Toplam |
|---|---|---|
| Gemma 4 26B Fine-tuned (bizim) | 75.0% | 486/648 |
| Gemini Flash 3.1 Lite | 73.5% | 476/648 |
| GPT-5.4 | 71.3% | 462/648 |
| GPT-4.1 | 70.2% | 455/648 |
| GPT-4.1 mini | 60.8% | 394/648 |
| Gemma 4 26B Base (fine-tune öncesi) | 56.8% | 25/50 |
Per-Class Recall (Fine-tuned Model)
| Sınıf | Recall | n | RED | YELLOW | GREEN |
|---|---|---|---|---|---|
| RED | 76.0% | 317 | 241 | 72 | 4 |
| YELLOW | 79.2% | 197 | 15 | 156 | 26 |
| GREEN | 66.4% | 134 | 0 | 45 | 89 |
Not: RED→YELLOW karışması (%22.7) en kritik hata tipidir. Gerçek klinik kullanımda insan gözetimi zorunludur.
Kullanım
MLX ile (önerilen)
pip install mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("ai-triyaj/gemma4-26B-A4B-triage-turkish")
SYSTEM = """Sen bir acil servis triyaj asistanısın. Hastayla Türkçe konuşarak şikayetini anlıyorsun.
Her turda tek soru soruyorsun. Yeterli bilgiyi topladıktan sonra son mesajında nötr kapanış yap ve triyaj kararını söyle.
Son mesaj formatı: "Bilgiler için teşekkürler, sizi ilgili birime yönlendiriyorum. Karar: RED/YELLOW/GREEN"
Triyaj kararı: RED (kırmızı) = acil, YELLOW (sarı) = yarı acil, GREEN (yeşil) = acil değil."""
messages = [
{"role": "system", "content": SYSTEM},
{"role": "user", "content": "Göğsümde ağrı var"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, max_tokens=200)
print(response)
Terminal Chat
python -m mlx_lm.chat \
--model ai-triyaj/gemma4-26B-A4B-triage-turkish \
--system "Sen bir acil servis triyaj asistanısın. Hastayla Türkçe konuşarak şikayetini anlıyorsun. Her turda tek soru soruyorsun. Yeterli bilgiyi topladıktan sonra son mesajında nötr kapanış yap ve triyaj kararını söyle. Son mesaj formatı: 'Bilgiler için teşekkürler, sizi ilgili birime yönlendiriyorum. Karar: RED/YELLOW/GREEN' Triyaj kararı: RED (kırmızı) = acil, YELLOW (sarı) = yarı acil, GREEN (yeşil) = acil değil."
Sınırlamalar ve Uyarılar
- Bu model araştırma amaçlıdır, klinik karar desteği için insan gözetimi zorunludur
- Eğitim verisi sentetik olup gerçek hasta popülasyonunu tam temsil etmeyebilir
- RED→YELLOW karışması (%22.7) hayati risk taşıyan vakalarda yanlış önceliklendirmeye yol açabilir
- Model yalnızca Türkçe için optimize edilmiştir
Teşekkür
Bu projenin klinik temeli, Dr. Altuğ Hasanbaşoğlu'nun uzmanlığı ve katkılarıyla oluşturuldu. Türkiye acil servis pratiğine uygun triyaj karar ağaçlarının tasarımı, klinik kriterlerin belirlenmesi ve doğrulanması süreçlerindeki değerli katkıları için kendisine içtenlikle teşekkür ederiz.
Lisans
Bu model Google'ın Gemma Lisansı kapsamındadır.
Gemma 4 26B A4B — Turkish Emergency Triage (English)
A conversational language model designed for Turkish emergency department triage, making RED / YELLOW / GREEN triage decisions through natural dialogue with patients in Turkish.
Base model:
mlx-community/gemma-4-26B-A4B-it-OptiQ-4bit
Fine-tuning: LoRA (mlx-lm + mlx-optiq), 2000 iterations
Format: 4-bit quantized safetensors (fused, no separate adapter needed)
Overview
Global triage systems such as CTAS and ESI are designed for broad patient populations and wide clinical scenarios, often requiring lengthy assessment workflows. This model was built specifically for Turkish emergency department practice — guiding patients through fast, focused, and symptom-specific questions that cut straight to the decision point without unnecessary steps. It engages patients in natural Turkish dialogue, collects clinical information, and outputs a triage decision.
| Decision | Meaning |
|---|---|
| 🔴 RED | Critical — requires immediate intervention |
| 🟡 YELLOW | Semi-urgent — should be seen shortly |
| 🟢 GREEN | Non-urgent — can wait |
Model Architecture
- Gemma 4 26B A4B (Mixture-of-Experts): 26B total parameters, 4B active per token
- 4-bit OptiQ quantization: sensitivity-aware mixed-precision (attention layers at 8-bit, MLP at 4-bit)
- LoRA fine-tuning: only adapter weights were trained, then merged into the base model (fused)
Training Data
The training data was developed in collaboration with an emergency medicine physician.
Our physician designed decision trees (paths) for 117 complaint categories (chest pain, shortness of breath, abdominal pain, etc.), grounded in CTAS/ESI protocols and adapted to Turkish emergency practice. Each path defines which questions to ask, which answers lead to which triage decision, and which symptoms immediately trigger a RED classification.
Based on these paths, 6,475 synthetic Turkish dialogues were generated using Gemini:
- 441 decision paths across 117 complaint categories
- Patient profile diversity: clean / mildly messy / severely messy / contradictory
- Ambiguous response scenarios (20%): patient gives vague answer, assistant clarifies
- 8 scenario styles: face-to-face triage, emergency call, ambulance arrival, etc.
- Risk factors: diabetes, cardiac history, pregnancy, hypertension, etc.
| Split | Records |
|---|---|
| Train | 5,180 |
| Val | 646 |
| Test | 648 |
| Total | 6,474 |
Fine-tuning
Training was performed entirely locally on Apple Silicon using mlx-lm and mlx-optiq:
Framework : mlx-lm 0.31.3 + mlx-optiq
Method : LoRA (r=8, alpha=16)
Iterations : 2000
Batch size : 4
Max seq len: 1024
Optimizer : AdamW
Hardware : Apple Silicon (MacBook M4 Pro 24GB)
Val loss: 9.9 → 0.761 (2000 iterations)
Evaluation
Test set: 648 samples, all models evaluated on the same dialogues with no data leakage.
Overall Accuracy
| Model | Accuracy | Correct/Total |
|---|---|---|
| Gemma 4 26B Fine-tuned (ours) | 75.0% | 486/648 |
| Gemini Flash 3.1 Lite | 73.5% | 476/648 |
| GPT-5.4 | 71.3% | 462/648 |
| GPT-4.1 | 70.2% | 455/648 |
| GPT-4.1 mini | 60.8% | 394/648 |
| Gemma 4 26B Base (before fine-tuning) | 56.8% | 25/50 |
Per-Class Recall (Fine-tuned Model)
| Class | Recall | n | RED | YELLOW | GREEN |
|---|---|---|---|---|---|
| RED | 76.0% | 317 | 241 | 72 | 4 |
| YELLOW | 79.2% | 197 | 15 | 156 | 26 |
| GREEN | 66.4% | 134 | 0 | 45 | 89 |
Note: RED→YELLOW confusion (22.7%) is the most critical error type. Human oversight is mandatory for any real clinical use.
Usage
With MLX (recommended)
pip install mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("ai-triyaj/gemma4-26B-A4B-triage-turkish")
SYSTEM = """You are an emergency department triage assistant. Speak with the patient in Turkish to understand their complaint.
Ask one question per turn. Once you have gathered enough information, close with a neutral statement and give the triage decision.
Final message format: "Bilgiler için teşekkürler, sizi ilgili birime yönlendiriyorum. Karar: RED/YELLOW/GREEN"
Triage decision: RED = critical, YELLOW = semi-urgent, GREEN = non-urgent."""
messages = [
{"role": "system", "content": SYSTEM},
{"role": "user", "content": "Göğsümde ağrı var"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, max_tokens=200)
print(response)
Terminal Chat
python -m mlx_lm.chat \
--model ai-triyaj/gemma4-26B-A4B-triage-turkish \
--system "Sen bir acil servis triyaj asistanısın. Hastayla Türkçe konuşarak şikayetini anlıyorsun. Her turda tek soru soruyorsun. Yeterli bilgiyi topladıktan sonra son mesajında nötr kapanış yap ve triyaj kararını söyle. Son mesaj formatı: 'Bilgiler için teşekkürler, sizi ilgili birime yönlendiriyorum. Karar: RED/YELLOW/GREEN' Triyaj kararı: RED (kırmızı) = acil, YELLOW (sarı) = yarı acil, GREEN (yeşil) = acil değil."
LM Studio
- LM Studio → Search
- Search for
ai-triyaj/gemma4-26B-A4B-triage-turkish - Download and launch
System Requirements
| Hardware | Status |
|---|---|
| Apple Silicon M2 Pro (16GB) | ✅ Works |
| Apple Silicon M3/M4 (16GB+) | ✅ Recommended |
| CUDA GPU (8GB+) | Works via PyTorch safetensors |
Limitations & Warnings
- This model is intended for research purposes only — human oversight is mandatory for clinical decision support
- Training data is synthetic and may not fully represent real patient populations
- RED→YELLOW confusion (22.7%) may lead to incorrect prioritization in life-threatening cases
- The model is optimized for Turkish only
Acknowledgements
The clinical foundation of this project was built with the expertise and contributions of Dr. Altuğ Hasanbaşoğlu. We sincerely thank him for designing the triage decision trees adapted to Turkish emergency practice, defining the clinical criteria, and validating the decision logic throughout the project.
License
This model is subject to Google's Gemma License.
- Downloads last month
- 24
4-bit
Model tree for ai-triyaj/gemma4-26B-A4B-triage-turkish
Base model
google/gemma-4-26B-A4B
