MSc Dissertation · University of Liverpool

The Fake News Detector

Paste a news article, a headline or a tweet (or a link to one) and the models from my dissertation will judge whether it reads like real or fake news.

Try:

Both models run in your browser. The text you check never leaves your device.

How it works

Every input goes through the same cleaning used in training: HTML and links are removed, text is lower-cased, stop words and non-alphabetic tokens are dropped, and the remaining words are lemmatised. Tweet links are read through X’s public embed service first.

There’s no server doing the work: both models were exported from Python and run directly in your browser, the SVM as plain JavaScript and BERT through Transformers.js. That keeps the site free to host and means the text you check stays on your device.

The cleaned text then goes to one of two models, both trained on the Kaggle Fake and Real News dataset (44,898 articles):

Dissertation results

ModelTest F1
TF-IDF + Logistic Regression0.9719
TF-IDF + Linear SVM Check0.9798
BERT (bert-base-uncased) Deep check0.9825
RoBERTa (roberta-base)0.9765

BERT scored highest, but only 0.27 points above the SVM, and RoBERTa came in below it. The transformers needed a GPU and roughly 100 minutes of training each; the SVM trains in about two minutes on a laptop. The dissertation concluded that TF-IDF + linear SVM gives the best balance of accuracy, efficiency and interpretability, which is why it’s the default check here.

The SVM on this site was retrained with calibrated probabilities (same features, same data split) and scores F1 0.9800 on the dissertation’s test set. BERT runs here at its training length of 256 tokens, compressed to 8 bits so it fits in a browser, and scores F1 0.9931 on the same test set (0.9936 before compression). The table above reports the dissertation’s 64-token re-evaluation.

What it can’t do

It judges writing style, not truth. 99% of the “real” articles in the training data come from Reuters, and every “fake” one comes from a different set of websites. The models learned to tell sober wire-service reporting apart from sensational partisan writing, which is a useful signal but not fact-checking. A false claim written in a calm Reuters voice can pass; try the “Fake claim, wire-service style” example above.