KhabarCheck - RoBERTa-Large Bias Model

Fine-tuned roberta-large for political bias classification in news articles for KhabarCheck.

Model Details

Base model roberta-large
Task 3-class text classification
Classes 0 = Left ๐Ÿ”ต, 1 = Center โš–๏ธ, 2 = Right ๐Ÿ”ด
Accuracy 85.43%
F1 (weighted) 85.39%
Max tokens 512

Usage

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

model_id = "RayyanAlam123/roberta-large-bias-detector"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()

text = "The president signed a new executive order on climate policy."
inputs = tokenizer(text, return_tensors="pt", max_length=512, truncation=True)
with torch.no_grad():
    logits = model(**inputs).logits
probs = torch.softmax(logits, dim=-1).squeeze()
labels = ["Left", "Center", "Right"]
print(f"Prediction: {labels[probs.argmax()]}  ({probs.max()*100:.1f}% confidence)")

Training Details

Hyperparameter Value
Learning rate 1e-5
LR scheduler cosine
Effective batch size 32 (4 ร— 8 grad accum)
Warmup 8%
Mixed precision bf16
Early stopping patience 3

Dataset

10,020 balanced news articles โ€” 3,340 each for Left, Center, Right.

Live Demo

Hugging Face Space

Downloads last month
19
Safetensors
Model size
0.4B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Spaces using RayyanAlam123/roberta-large-bias-detector 2

Evaluation results