Downloads · 30 days
5
6% of all-time downloads
KOTAYE/xlm-roberta-base-ag-news
xlm-roberta-base-ag-news is a text classification model from KOTAYE. Use it when you need a label for a piece of text. The card lists the license as mit.
Topic classification for English news headlines into four categories: World, Sports, Business, Sci/Tech.
Downloads · 30 days
5
6% of all-time downloads
All-time downloads
78
Public
Parameters
278M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.1 GB · 98%
From the Hugging Face model README
Topic classification for English news headlines into four categories: World, Sports, Business, Sci/Tech.
Built as part of the UnidataLab ML Summer Camp 2026.
Measured on the held-out AG News test split (7,600 examples), touched only once after every design decision was final.
| Model | Accuracy | Macro F1 |
|---|---|---|
| TF-IDF + Logistic Regression (baseline) | 91.72% | 0.9171 |
| xlm-roberta-base (this model) | 94.54% | 0.9453 |
The fine-tuned model removes about a third of the baseline's errors (8.28% to 5.46% error rate).
roberta-base trained under identical settings scored 94.64% on validation
versus 94.14% for this model. xlm-roberta-base was chosen anyway: the
~0.5 point gap is small, and multilingual coverage keeps a single pipeline
usable for non-English text later.
from transformers import pipeline
clf = pipeline("text-classification", model="KOTAYE/xlm-roberta-base-ag-news")
clf("Manchester United signs new striker ahead of the season")
# [{'label': 'Sports', 'score': 0.99}]
| Base model | FacebookAI/xlm-roberta-base |
| Split | 108,000 train / 12,000 validation / 7,600 test (stratified, seed 42) |
| Max sequence length | 128 tokens (covers 99.2% of texts in full) |
| Epochs | 2 |
| Learning rate | 2e-5 (chosen over 1e-5 and 3e-5) |
| Batch size | 32 |
| Precision | fp16 |
| Hardware | single Tesla T4, ~26 minutes |
A third epoch was not used: training loss kept falling while validation loss had flattened, indicating the onset of overfitting.
Business and Sci/Tech are the dominant failure mode. They account for 369 of 703 validation errors, or 52% of everything the model gets wrong. Manual inspection suggests most of these are genuinely ambiguous rather than model failures: "AT&T to Cut About 7,000 Jobs" is defensibly either class.
Per-class F1 on validation: Sports 0.986, World 0.951, Sci/Tech 0.918, Business 0.910.
AG News itself contains label noise. One example found during error analysis: a Tiger Woods story labelled World that the model classified as Sports, where the model was right and the label was wrong. Roughly 94-95% appears to be a practical ceiling for this dataset.
The model is trained on short English news snippets (median 52 tokens) from 2004-era sources. Performance on other domains, lengths, or languages is untested.