/ Модель

Характеристики

Контекст
512 токенов
Параметры
212 млн
Лицензия
MIT
Архитектура
bert · dense
Базовая модель
bert-base-turkish-128k-cased
Библиотека
transformers
Опубликована
2 авг 2026

berturk-128k-turkish-news-classification

Классификация текстаТекст → label4 профессии

Дообученная модель BERTurk для отнесения турецких новостей к одной из девяти тематических категорий.

16скачиваний за 30 дней0лайковвеса обновлены2 авг 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

BERTurk-128k Turkish News Classification — модель классификации новостей, разработанная thealper2 на основе dbmdz/bert-base-turkish-128k-cased. Это дообученный энкодерный Transformer BERTurk с архитектурой BertForSequenceClassification и 211,6 млн параметров; он присваивает турецкому новостному тексту одну из девяти взаимоисключающих тематических категорий. Контекст модели составляет до 512 токенов.

Модель предназначена для автоматической тематической разметки новостных материалов и распределения их по категориям, в том числе для потоковой обработки и построения классификаторов на базе Transformers. По описанию автора, на тестовой выборке из 40 063 документов она достигла точности 95,95%, weighted-F1 0,9602 и macro-F1 0,9357. Обучение проводилось на наборе TRNEWS-2025 с учётом дисбаланса классов.

Модель поддерживает турецкий язык и распространяется под лицензией MIT. Она ограничена классификацией новостей на девять заданных категорий и может терять информацию в текстах длиннее 512 токенов; результаты для других жанров и языков не заявлены. Условия использования датасета TRNEWS-2025 следует учитывать отдельно от лицензии модели.

Сценарии применения

  • автоматическая категоризация турецких новостных статей
  • распределение новостей по тематическим разделам сайта
  • тематическая разметка новостного архива
  • классификация новостного потока для редакционной аналитики

Ограничения

Модель предсказывает только одну из девяти категорий и обрезает вход длиннее 512 токенов. Качество на других языках и текстах вне новостного домена не заявлено; условия использования TRNEWS-2025 могут отличаться от лицензии MIT модели.

Для каких профессий подходит4

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

BERTurk-128k Turkish News Classification (9-class)

Fine-tuned dbmdz/bert-base-turkish-128k-cased (BERTurk, 128k cased vocabulary) for single-label, multiclass topic classification of Turkish news text into 9 categories.

The model was trained on the TRNEWS-2025 dataset (a large, real-world, and highly imbalanced Turkish news corpus) with class-balanced cross-entropy loss. On a held-out, stratified test split of 40,063 documents it reaches 95.95% accuracy, 0.9602 weighted-F1, and 0.9357 macro-F1.

  • Developed by: thealper2
  • Model type: BertForSequenceClassification (encoder-only Transformer)
  • Language: Turkish (tr)
  • Finetuned from: dbmdz/bert-base-turkish-128k-cased
  • License: MIT (inherited from the BERTurk base model; see Licensing for dataset terms)
  • Task: Multiclass text classification (topic / news-category)

Labels

The classifier outputs one of 9 mutually exclusive news categories. Labels are stored in the model config (id2label / label2id) in their original Turkish surface forms; English glosses are provided below for convenience.

IDLabel (Turkish)English gloss
0Bilim-TeknolojiScience–Technology
1Finans-EkonomiFinance–Economy
2Kültür-SanatCulture–Arts
3MagazinMagazine / Tabloid
4SağlıkHealth
5SiyasetPolitics
6SporSports
7TurizmTourism
8ÇevreEnvironment

Because id2label is baked into the config, pipeline(...) and model.config.id2label return the human-readable Turkish label directly — no external mapping file is required at inference time.


Quick start

With pipeline

from transformers import pipeline

clf = pipeline(
    "text-classification",
    model="thealper2/berturk-128k-turkish-news-classification",
    truncation=True,
    max_length=512,
)

clf("Milli takım, hazırlık maçında sahadan galibiyetle ayrıldı.")
# [{'label': 'Spor', 'score': 0.99...}]

# Full probability distribution over all 9 classes:
clf("Borsa İstanbul günü yükselişle kapattı, faiz beklentileri fiyatlandı.",
    top_k=None)

With AutoModel (manual, batched)

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

model_id = "thealper2/berturk-128k-turkish-news-classification"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id).eval()

texts = [
    "Yeni sürücüsüz araç teknolojisi trafik güvenliğini artırmayı hedefliyor.",
    "Antalya'da turizm sezonu erken açıldı, oteller yüksek doluluğa ulaştı.",
]

enc = tokenizer(texts, padding=True, truncation=True,
                max_length=512, return_tensors="pt")

with torch.no_grad():
    logits = model(**enc).logits
    probs = logits.softmax(dim=-1)

pred_ids = probs.argmax(dim=-1).tolist()
for text, pid, p in zip(texts, pred_ids, probs):
    print(f"{model.config.id2label[pid]:16s} ({p[pid]:.3f})  <- {text[:50]}")

Tip: the model was trained on article bodies (Haber Gövdesi) rather than headlines, so it performs best on full paragraphs/articles. Very short headlines may be classified less reliably. Always pass truncation=True, max_length=512.


Intended uses & limitations

Intended uses

  • Automatic topic tagging / routing of Turkish news articles.
  • Editorial content organization, feed categorization, and dataset labeling assistance.
  • A strong Turkish-language baseline / backbone for downstream topic classification.

Out-of-scope / limitations

  • Domain shift: trained on news text. Performance will degrade on other genres (tweets, product reviews, legal/medical documents, conversational text).
  • Single-label only: the head is a softmax classifier — it forces exactly one category even for articles that legitimately span multiple topics (e.g. sports-economy). It cannot emit multiple labels.
  • Label imbalance: the corpus is dominated by Magazin (~39% of the data). Even though class-balanced loss was used, the tail classes (Çevre, Turizm, Bilim-Teknoloji, Kültür-Sanat) show lower precision and are more prone to confusion (see the confusion analysis).
  • No factuality/sentiment signal: the model predicts topic, not veracity, sentiment, or stance.
  • Potential bias: the model reflects the editorial and demographic biases of the source Turkish news outlets in TRNEWS-2025.

Training data

Preprocessing

Applied before tokenization (dataset-agnostic cleaning pipeline):

  • HTML unescaping + tag stripping.
  • URL stripping (http(s)://…, www.…).
  • Whitespace normalization.
  • Casing preserved (lowercase: false) — the base model is cased; no Turkish İ/ı folding.
  • Exact-duplicate removal on the cleaned text.
  • Empty/too-short rows removed (min_chars: 1).

Splits

Stratified train/validation/test split (seed=42), 90% / 5% / 5%:

SplitDocumentsShare
Train≈ 721,13490%
Validation≈ 40,0635%
Test40,0635%
Total≈ 801,260100%

Class distribution (full corpus, approximate)

The dataset is heavily imbalanced (≈20:1 between the largest and smallest class), which motivated class-weighted training.

Label≈ Count≈ Share
Magazin315,76039.4%
Siyaset147,24018.4%
Spor131,42016.4%
Sağlık47,8406.0%
Kültür-Sanat46,6205.8%
Finans-Ekonomi36,6804.6%
Bilim-Teknoloji30,4803.8%
Turizm29,6403.7%
Çevre15,5801.9%

(Counts are inferred from the stratified test-split support × 20; they are accurate to within rounding.)


Training procedure

Fine-tuned end-to-end with the HuggingFace Trainer (a custom WeightedTrainer subclass applying per-class weights to the cross-entropy loss).

Class-balanced loss

Cross-entropy is weighted with the scikit-learn "balanced" scheme, computed on the training split:

weight_c = N_train / (num_classes * count_c)

This yields weights ranging from ≈ 0.28 for the majority class (Magazin) to ≈ 5.7 for the minority class (Çevre), pulling macro-F1 up substantially relative to unweighted training.

Hyperparameters

HyperparameterValue
Base modeldbmdz/bert-base-turkish-128k-cased
Max sequence length512
OptimizerAdamW (Transformers default)
Learning rate2e-5
LR schedulerlinear decay with warmup
Warmup ratio0.06
Weight decay0.01
Max grad norm1.0
Per-device batch size16
Gradient accumulation2
Effective batch size32
Epochs (planned)3
LossClass-weighted cross-entropy (balanced)
Early stoppingpatience = 2 evals, metric = f1_macro
Precisionbf16 mixed precision + TF32 matmul
Attention impl.SDPA (PyTorch scaled-dot-product-attention)
Dynamic paddingDataCollatorWithPadding, pad_to_multiple_of=8
Length groupinggroup_by_length=True
Eval / save intervalevery 500 steps
Best-model selectionhighest validation f1_macro
Seed42

Compute

  • Hardware: single NVIDIA RTX 5060 Ti (Blackwell, sm_120, 8 GB VRAM).
  • Frameworks: PyTorch (CUDA 12.8 wheel) · Transformers 4.57.6.
  • 8 GB VRAM was made feasible through bf16, SDPA attention, dynamic padding, and length grouping (fixed 512-token padding was avoided).

Convergence & early stopping

Because the training set is large (~721k examples), the model converged within a fraction of the first epoch. Validation f1_macro peaked at step 3000 and did not improve over the next two evaluations, so EarlyStoppingCallback halted training at step 4000 and restored the best (step-3000) checkpoint. Selected validation metrics:

StepEpochVal lossVal accuracyVal macro-F1
5000.021.64390.73150.5362
10000.040.46850.90690.8390
15000.070.27290.91200.8767
20000.090.19890.94710.9173
25000.110.22540.95540.9244
30000.130.16190.95880.9341 ← best
35000.160.16140.95710.9297
40000.180.17760.95550.9290

Note: the low epoch count is expected, not a bug — a single epoch over ~721k documents is a large number of optimization steps. Training longer offered no macro-F1 gain and risked overfitting the majority class.


Evaluation

All metrics below are on the held-out test split (40,063 documents), which was never seen during training or model selection.

Overall

MetricValue
Accuracy0.9595
F1 (weighted)0.9602
F1 (macro)0.9357
Precision (macro)0.9221
Recall (macro)0.9513
Loss0.1647

Per-class report

LabelPrecisionRecallF1Support
Bilim-Teknoloji0.83670.92780.87991,524
Finans-Ekonomi0.98820.95860.97321,834
Kültür-Sanat0.82320.94250.87882,331
Magazin0.99130.96220.976515,788
Sağlık0.93790.97280.95512,392
Siyaset0.98640.93910.96227,362
Spor0.97200.99250.98226,571
Turizm0.88150.94400.91171,482
Çevre0.88210.92170.9014779
Macro avg0.92210.95130.935740,063
Weighted avg0.96210.95950.960240,063

Confusion analysis

Rows = true label, columns = predicted label (order matches the label table above).

Bil-TekFin-EkoKül-SanMagazinSağlıkSiyasetSporTurizmÇevre
Bilim-Teknoloji1414246113121170
Finans-Ekonomi271758202211203
Kültür-Sanat340219764714393
Magazin442279151914434149405
Sağlık4106523270643
Siyaset98811925436914158060
Spor14152160652220
Turizm6511618132139922
Çevre12341311126718

Key takeaways:

  • High-support, well-separated classes (Magazin, Spor, Siyaset, Finans-Ekonomi) exceed 0.96 F1.
  • The main error mode is precision loss on the minority classes Kültür-Sanat (0.82) and Bilim-Teknoloji (0.84): a slice of Magazin articles leaks into Kültür-Sanat (279 cases), and several Siyaset articles are pulled into Bilim-Teknoloji. These are semantically adjacent topics in Turkish news.
  • Class weighting keeps recall high across every class (min. recall 0.92), which is often the desired trade-off for tail categories.

Reproducing evaluation

The exact metrics, full classification_report, and confusion matrix are shipped in test_report.json alongside these weights.


Model architecture

PropertyValue
ArchitectureBertForSequenceClassification
Hidden size768
Layers12
Attention heads12
Intermediate size3072
Max position embeddings512
Vocabulary size128,000 (128k cased WordPiece)
Parameters~184M
TokenizerFast WordPiece (BERTurk 128k cased)
Precision (weights)float32 (model.safetensors)

Licensing

  • Model weights: released under the MIT License, inherited from the base model dbmdz/bert-base-turkish-128k-cased.
  • Training data (TRNEWS-2025): distributed via IEEE DataPort and requires a subscription to access. This repository ships only the fine-tuned weights and evaluation artifacts — no raw dataset text is included or redistributed. If you use the data itself, you must comply with IEEE DataPort's terms and cite the dataset (below).

Citation

If you use this model, please cite both the underlying dataset and the base model.

Dataset (TRNEWS-2025):

@data{vasv-dj22-25,
  doi       = {10.21227/vasv-dj22},
  url       = {https://dx.doi.org/10.21227/vasv-dj22},
  author    = {Sengul Bayrak},
  publisher = {IEEE Dataport},
  title     = {TRNEWS-2025: A Multiclass Turkish News Text Dataset},
  year      = {2025}
}

Base model (BERTurk):

@software{stefan_schweter_2020_3770924,
  author    = {Stefan Schweter},
  title     = {BERTurk - BERT models for Turkish},
  month     = apr,
  year      = 2020,
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.3770924},
  url       = {https://doi.org/10.5281/zenodo.3770924}
}

This fine-tuned model:

@misc{berturk_128k_turkish_news_classification,
  author    = {thealper2},
  title     = {BERTurk-128k Turkish News Classification (9-class)},
  year      = {2025},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/thealper2/berturk-128k-turkish-news-classification}}
}

Acknowledgements

  • Sengul Bayrak (Istanbul Sabahattin Zaim University) for the TRNEWS-2025 dataset.
  • Stefan Schweter / dbmdz for the BERTurk base models.
  • The Hugging Face transformers, datasets, and accelerate teams.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · text-classification

Можно запустить

Подбираем GPU…

Класс архитектуры
BertForSequenceClassification
Ревизия весов
ad31dcc

0 моделей