fin-bert-tr-router / README.md
Toxotes's picture
feat: Turkish Financial BERT Router (3-class MoE)
3bbe91a verified
metadata
language:
  - tr
license: apache-2.0
tags:
  - bert
  - turkish
  - finance
  - text-classification
  - router
  - query-classification
library_name: transformers
base_model: Toxotes/fin-bert-tr

fin-bert-tr-router

Türkçe Finansal BERT Router — Kullanıcı sorgularını 3 sınıfa ayıran sınıflandırma modeli. MOSAIC RAG sisteminde MoE (Mixture of Experts) yönlendiricisi olarak kullanılır.

Sınıflar

ID Sınıf Açıklama Yönlendirme
0 CHITCHAT Selamlama, sohbet, kimlik soruları RAG olmadan Qwen2.5-1.5B
1 SIMPLE Tek adımlı olgusal finans sorguları Qwen2.5-1.5B + RAG
2 COMPLEX Çok adımlı analiz, mevzuat yorumu Turkish-Gemma-9B + RAG

Performans

  • Doğrulama Accuracy: 0.8038
  • Doğrulama Macro F1: 0.8556

Temel Model

Toxotes/fin-bert-tr üzerinde ince-ayar yapılmıştır.

Kullanım

from transformers import BertForSequenceClassification, PreTrainedTokenizerFast
import torch

tokenizer = PreTrainedTokenizerFast.from_pretrained("Toxotes/fin-bert-tr-router")
model = BertForSequenceClassification.from_pretrained("Toxotes/fin-bert-tr-router")
model.eval()

queries = [
    "Merhaba!",                                           # → CHITCHAT (0)
    "TCMB faiz oranı nedir?",                             # → SIMPLE   (1)
    "Reel sektör sermaye yeterliliği analizi nasıl yapılır?",  # → COMPLEX  (2)
]
LABELS = ["chitchat", "simple", "complex"]

for q in queries:
    inputs = tokenizer(q, return_tensors="pt", truncation=True, max_length=128)
    with torch.no_grad():
        logits = model(**inputs).logits
    label = LABELS[logits.argmax().item()]
    print(f"{q[:40]:40}{label}")

Eğitim Tarihi

2026-03-12

Proje

MOSAIC — Federated Financial RAG System GitHub