Downloads · 30 days
30
3% of all-time downloads
ThomasTschinkel/fake-news-detector
fake-news-detector is a text classification model from ThomasTschinkel. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
A high-accuracy binary classifier that identifies news articles as REAL or FAKE, built on fine-tuned RoBERTa-Large with a custom dual-pooling classification head.
Downloads · 30 days
30
3% of all-time downloads
All-time downloads
1.1K
Public
Parameters
355M
2.8 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors1.4 GB · 100%
From the Hugging Face model README
A high-accuracy binary classifier that identifies news articles as REAL or FAKE, built on fine-tuned RoBERTa-Large with a custom dual-pooling classification head.
| Metric | Score |
|---|---|
| Accuracy | 99.81% |
| F1 (macro) | 99.81% |
| Precision | 99.79% |
| Recall | 99.84% |
| ROC-AUC | 99.95% |
Launch the interactive demo: https://huggingface.co/spaces/ThomasTschinkel/fake-news-detector-demo
Check out the GitHub repo: https://github.com/thomastschinkel/fake-news-detector
from transformers import pipeline
detector = pipeline(
"text-classification",
model="ThomasTschinkel/fake-news-detector",
trust_remote_code=True,
)
results = detector([
"NASA confirms water discovery on Mars.",
"SHOCKING: 5G towers cause mind control!!!",
])
print(results)
Use trust_remote_code=True because this model uses a custom architecture.
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
tokenizer = AutoTokenizer.from_pretrained("ThomasTschinkel/fake-news-detector")
model = AutoModelForSequenceClassification.from_pretrained(
"ThomasTschinkel/fake-news-detector",
trust_remote_code=True,
)
text = "Your news article text here..."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs.logits, dim=1)
print(f"REAL: {probs[0][0]:.2%} | FAKE: {probs[0][1]:.2%}")
Input text
|
v
RoBERTa-Large (24 layers, 1024 hidden dim)
|
+---- [CLS] token (1024-d)
|
+---- Mean pooling (1024-d)
|
+---- Concatenate -> 2048-d
|
v
Linear(2048 -> 512)
LayerNorm + GELU + Dropout(0.3)
|
v
Linear(512 -> 128)
GELU + Dropout(0.2)
|
v
Linear(128 -> 2)
|
v
REAL / FAKE
Why dual pooling? The CLS token captures a global summary, while mean pooling preserves information across all tokens.
@misc{tschinkel2025fakenews,
title = {Fake News Detector: Fine-tuned RoBERTa-Large},
author = {Thomas Tschinkel},
year = {2025},
url = {https://huggingface.co/ThomasTschinkel/fake-news-detector}
}