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
- 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.
- Speaker metadata (party, job, credit history counts) is encoded and concatenated with the BERT CLS embedding in a hybrid classification head.
- bert-base-uncased is fine-tuned for about 5 epochs with AdamW; every epoch logs accuracy, precision, recall, F1 and the confusion matrix.
- At inference, the demo app tokenizes the pasted statement, runs it through the fine-tuned model and renders the verdict with a confidence bar.
- Gradient-based token influence scores color each word by how strongly it pushed the decision toward fake or real.
- 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.