FacTora -- Fake News Detector (DistilBERT)

A fine-tuned DistilBERT model for binary fake news classification (REAL vs FAKE), trained on the LIAR dataset.

Usage

from transformers import DistilBertTokenizerFast, DistilBertForSequenceClassification
import torch

model = DistilBertForSequenceClassification.from_pretrained("pranavlamkhade/factora-fake-news-detector")
tokenizer = DistilBertTokenizerFast.from_pretrained("pranavlamkhade/factora-fake-news-detector")
model.eval()

text = "NASA confirms the discovery of water on Mars"
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=512)

with torch.no_grad():
    outputs = model(**inputs)

probs = torch.nn.functional.softmax(outputs.logits, dim=1)
prediction = torch.argmax(probs, dim=1).item()
confidence = float(probs.max()) * 100

label = "REAL" if prediction == 1 else "FAKE"
print(f"Prediction: {label} ({confidence:.1f}%)")

Model Details

Property Value
Base Model distilbert-base-uncased
Task Binary Text Classification
Labels 0: FAKE, 1: REAL
Training Data LIAR Dataset (6-class to binary)
Epochs 3
Batch Size 16
Max Sequence Length 512

Label Mapping

The original LIAR 6-class labels were mapped to binary:

Original Label Binary Label
false, pants-fire, barely-true FAKE (0)
half-true, mostly-true, true REAL (1)

Part of FacTora

This model powers FacTora -- a full-stack fake news detection platform with:

  • AI-powered news analysis
  • Source credibility scoring
  • Browser extension for real-time fact-checking
  • Detailed confidence reports

License

MIT License

Downloads last month
91
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train pranavlamkhade/factora-fake-news-detector