GhostFaith/distilbert-fakenews
DistilBERT Fake News Classifier
A fine-tuned DistilBERT model that classifies news articles as Real or Fake.
Model Details
Model Description
This model is a fine-tuned version of distilbert-base-uncased for binary classification of news articles as Real or Fake. It was fine-tuned on the WELFake dataset after deduplication (removing ~9,337 duplicate rows) to prevent train/test leakage and ensure an honest evaluation.
- Developed by: Amey Dande
- Model type: Text classification (binary)
- Language(s) (NLP): English
- License: MIT
- Finetuned from model:
distilbert-base-uncased
Model Sources
- Repository: https://github.com/AmeyDande/FakeNewsClassisier
Uses
Direct Use
This model can classify English-language news article text or headlines as real or fake, given raw text input. Intended for portfolio, educational, and demonstration purposes, and as a baseline fake-news detection component.
Downstream Use
Could be integrated into a larger content-moderation or fact-checking pipeline as one signal among several, rather than a standalone decision-maker.
Out-of-Scope Use
Not intended for production moderation decisions, legal/policy enforcement, or as the sole basis for judging content authenticity. Not evaluated on non-English text, satire, or news domains/formats outside the WELFake dataset.
Bias, Risks, and Limitations
- Trained on a single dataset (WELFake); may not generalize well to other fake-news domains, sources, or writing styles.
- Deduplication reduced train/test leakage substantially, but residual near-duplicate or topically similar content may still inflate reported metrics slightly.
- May reflect labeling biases or source-selection biases present in the original WELFake dataset.
Recommendations
Users should treat predictions as one signal, not ground truth, and independently verify claims rather than relying solely on this model's output — especially in any real-world or high-stakes deployment.
How to Get Started with the Model
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("GhostFaith/distilbert-fakenews")
model = AutoModelForSequenceClassification.from_pretrained("GhostFaith/distilbert-fakenews")
text = "Your news article text here"
inputs = tokenizer(text, truncation=True, padding=True, max_length=256, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
pred = torch.argmax(logits, dim=-1).item()
print("Fake" if pred == 1 else "Real")Training Details
Training Data
WELFake news dataset (~71,537 rows total). Deduplicated on article text (~9,337 duplicate rows removed) before splitting, to prevent identical or near-identical articles from appearing in both train and test sets. Split 80/10/10 into train/validation/test.
Training Procedure
Fine-tuned using Hugging Face Trainer.
Preprocessing
Text tokenized with the distilbert-base-uncased tokenizer, truncation enabled, padded to a fixed max length.
Training Hyperparameters
- Epochs: 2
- Train batch size: 8 (per device)
- Eval batch size: 16 (per device)
- Warmup steps: 500
- Weight decay: 0.01
- Training regime: fp16 mixed precision
Speeds, Sizes, Times
Trained on a single Colab T4 GPU; full training run (2 epochs, ~57K training examples after split) completed in well under an hour.
Evaluation
Testing Data, Factors & Metrics
Testing Data
Held-out test split (10%) from the deduplicated WELFake dataset — not seen during training or validation.
Metrics
Accuracy and F1 score, plus a full precision/recall/F1 breakdown per class (real vs. fake).
Results
Confusion matrix (rows = actual, columns = predicted, order = [Real, Fake]):
[[3453 28]
[ 27 2712]]Summary
The model performs strongly on held-out, deduplicated test data, with balanced errors across both classes (28 false positives, 27 false negatives out of 6,220 test examples) — no systematic bias toward over- or under-flagging either class.
Environmental Impact
- Hardware Type: NVIDIA T4 GPU (Google Colab)
- Hours used: < 1 hour
- Cloud Provider: Google Colab
- Compute Region: Not tracked
- Carbon Emitted: Not estimated
Technical Specifications
Model Architecture and Objective
DistilBERT (6-layer transformer encoder, distilled from BERT-base) with a sequence classification head (pre-classifier + classifier layers) for binary text classification.
Compute Infrastructure
Hardware
Single NVIDIA T4 GPU (Google Colab free tier).
Software
Python, Hugging Face transformers, datasets, PyTorch.
Model Card Contact
See the GitHub repository for contact information.
