Fake News Detector (DistilBERT)
A DistilBERT model fine-tuned to tell whether a news article's writing style looks real or fake.
Labels
Training data
- ISOT Fake and Real News dataset (15,000 articles used)
- WELFake dataset (10,000 articles used, labels flipped so that 0 = fake, 1 = real)
- Text was cleaned first: lowercased, links removed, and agency tags, dates, month and day names, and city names removed to reduce shortcut clues.
Training setup
- Base model: distilbert-base-uncased
- 2 epochs, batch size 16, learning rate 2e-5, max length 256 tokens
- Trained on a free Kaggle GPU
Results
| Test |
Accuracy |
F1 |
| Held-out WELFake (trained on ISOT + WELFake) |
96.57% |
0.964 |
| WELFake, when trained on ISOT only |
86.00% |
0.842 |
The 86% figure is the better sign of how it handles a source it never trained on.
Limits
- It reads writing style, not facts. A false story written like a news-agency report can be marked real.
- Accuracy drops sharply on sources that look different from the training data.
- Only about the first 200 words of an article are read.
- Not for real fact-checking or moderation decisions.
How to use
from transformers import pipeline
clf = pipeline("text-classification", model="Sumra81/fake-news-distilbert")
print(clf("Paste a cleaned article here"))