Built to order

Fake News Detection using BERT

This project fine-tunes bert-base-uncased on the LIAR benchmark — 12,836 PolitiFact statements with six-grade truthfulness labels — to classify news claims as fake or real. A demo app scores any pasted statement with a verdict, confidence bar and token-influence highlighting that shows which words pushed the decision. The training notebook logs accuracy, F1 and the confusion matrix on the official test split, so every metric in the report comes from the student's own build. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Data Science.

Fake News Detection using BERT - project prototype demo screenshot
More project photos (2)

The problem

Fabricated news now travels faster than any fact-checking desk can respond, yet most readers have no tool that gives a fast, explainable first read on a suspicious claim. Manual verification does not scale, and simple keyword filters are trivially gamed. Transformer language models changed this equation: BERT's pre-trained contextual representations let a classifier learn subtle linguistic cues of deception — hedging, sensationalism, unverifiable superlatives — from a few thousand labeled examples. This project turns that capability into a complete student build: bert-base-uncased fine-tuned on the LIAR benchmark of real PolitiFact statements, wrapped in a demo that scores any pasted claim and highlights the exact words that drove the verdict. Because the verdict is inspectable, the report and viva can discuss why a statement was flagged — and where the model is known to fail, such as satire and breaking-news topics.

How it works

  1. LIAR statements are WordPiece-tokenized (max 128 tokens); the six truthfulness grades are kept for training and collapsed to a binary fake/real verdict at inference.
  2. Speaker metadata (party, job, credit history counts) is encoded and concatenated with the BERT CLS embedding in a hybrid classification head.
  3. bert-base-uncased is fine-tuned for about 5 epochs with AdamW; every epoch logs accuracy, precision, recall, F1 and the confusion matrix.
  4. At inference, the demo app tokenizes the pasted statement, runs it through the fine-tuned model and renders the verdict with a confidence bar.
  5. Gradient-based token influence scores color each word by how strongly it pushed the decision toward fake or real.
  6. Batch mode reads a CSV of statements and writes per-statement verdicts and confidences to a report file.

Tech stack:

  • Python 3.10, PyTorch, Hugging Face transformers (bert-base-uncased)
  • scikit-learn (metrics, confusion matrix), NumPy, pandas
  • Matplotlib (training curves, label distribution)
  • Single-file HTML/CSS/JS demo app (analyzer, dataset explorer, training views)
  • LIAR benchmark dataset (Wang, ACL 2017)
  • Trained weights exported from the included fine-tuning run
Parameter Value
Model bert-base-uncased + dropout/linear head (110M parameters)
Dataset LIAR: 12,836 PolitiFact statements; 10,269 train / 1,284 valid / 1,283 test
Labels 6 truthfulness grades (true → pants-on-fire), collapsed to binary at inference
Input Short English statements, max 128 WordPiece tokens
Output Fake/real verdict, confidence score, token-influence highlights
Training ~5 epochs, AdamW, linear warmup; design target binary F1 ≈ 0.70–0.75
Evaluation Accuracy, precision, recall, F1, confusion matrix — computed by the notebook on your build
Inference CPU-friendly; a single statement scores in well under a second

Project features

  • [Statement analyzer] Paste any claim and get a fake/real verdict with a confidence bar; token-influence highlighting colors the words that most pushed the decision.
  • [BERT fine-tuning pipeline] bert-base-uncased with a dropout + linear classification head, fine-tuned with AdamW and a linear warmup schedule; all hyperparameters exposed in the notebook.
  • [Hybrid text + metadata head] Speaker metadata from LIAR (party, job title, credit history) feeds an auxiliary input concatenated with the CLS embedding, following the paper's hybrid finding.
  • [Dataset explorer view] Browse the LIAR label distribution (six truthfulness grades, train/valid/test splits) inside the demo app.
  • [Training-curve view] Per-epoch F1 and train/validation loss plots that the notebook reproduces during the build.
  • [Batch scoring mode] Score a CSV of statements into a verdict report for larger-scale analysis.
  • [Full evaluation logging] Accuracy, precision, recall, F1 and the confusion matrix computed on the official LIAR test split — never pre-claimed.

What is included

  • Complete source code (preprocessing, fine-tuning, hybrid head, inference, demo app)
  • Jupyter training and evaluation notebook (buyer-run procedure: fine-tune, evaluate, inspect errors)
  • Project report PDF (background, LIAR analysis, methodology, evaluation, error analysis)
  • PPT presentation for final review
  • Viva Q&A preparation document (transformers, attention, fine-tuning, LIAR, evaluation metrics)
  • Setup guide (environment, dataset download, training, running the demo)

Limitations & prerequisites

  • The model classifies short political statements in English — the LIAR domain. Satire, breaking-news topics, non-English text and multimedia claims are outside its training distribution and it handles them poorly.
  • A verdict is a statistical prediction, not a fact-check: low-confidence outputs must be read as model uncertainty and always passed to human review.
  • Emotionally charged but true statements can be misclassified; the confusion matrix in the report documents the error patterns openly.
  • Fine-tuning BERT needs a GPU (or long CPU patience) — the notebook documents expected runtimes and a smaller-sample quick-run mode.
  • Speaker metadata helps only when present; pure-text mode drops the auxiliary input and scores slightly lower.

Frequently Asked Questions

Which dataset is used?

The LIAR benchmark (Wang, ACL 2017): 12,836 real-world PolitiFact statements with six-grade truthfulness labels, split 10,269/1,284/1,283 for train/valid/test. The six grades are collapsed to a binary fake/real verdict at inference.

Which model is used?

bert-base-uncased (110M parameters) with a dropout + linear classification head, fine-tuned with AdamW. A hybrid variant concatenates speaker metadata with the CLS embedding, following the paper's finding that metadata helps.

Is the accuracy guaranteed?

No. The design target is binary F1 ≈ 0.70–0.75 on the LIAR test split, but final performance is measured by the training notebook during your build — the report documents your own numbers, not a pre-claimed figure.

Can it detect satire or breaking news?

Not reliably — both are outside the LIAR training distribution, and the report states this as an explicit limitation. It is a first-pass triage tool for human review, not an automated fact-checker.

What are the main limitations?

English political statements only; confidence is model uncertainty, not truth; emotionally charged true statements can misclassify; fine-tuning needs a GPU for reasonable runtimes.

Is this project suitable for a final-year project?

Yes — for Computer Science, AI/ML and Data Science programs. It demonstrates transformers, transfer learning, fine-tuning discipline, NLP evaluation and honest error analysis, all strong viva material. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Data Science.

Components & software requirements
  • Python 3.10, PyTorch, Hugging Face transformers (bert-base-uncased)
  • scikit-learn (metrics, confusion matrix), NumPy, pandas
  • Matplotlib (training curves, label distribution)
  • Single-file HTML/CSS/JS demo app (analyzer, dataset explorer, training views)
  • LIAR benchmark dataset (Wang, ACL 2017)
  • Trained weights exported from the included fine-tuning run
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Blueprint-style technical illustration of multiple decision trees voting together into one final predictionStudents with basic Python and pandas skills who want a reliable first classifier for ML coursework and tabular data projects.

Random Forests Explained: Why Decision Trees Vote Better Together

Decision trees are readable but overfit; random forests fix this by training hundreds of varied trees on bootstrapped data with random feature subsets, then letting them vote. This guide explains Gini impurity, bagging, out-of-bag validation and the four hyperparameters that matter, with a complete scikit-learn workflow, honest feature-importance practices, and the mistakes students keep making.

Read guide
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Get a quotation