Model fine-tuning and interface
Fake News Detection with BERT
A BERT classifier fine-tuned on the LIAR dataset, served through Streamlit so every prediction arrives with a confidence score instead of a bare verdict.
- Labelled political statements in the training corpus
- 10,000+
- Reported confidence on test samples
- 88%
- Fine-tuned classifier rather than a prompt around a model
- BERT
The problem
A fake-news classifier that outputs only "true" or "false" is not usable, because the cases worth caring about are the ones where the model is unsure. Political statements are short, context-dependent and sometimes deliberately ambiguous; a confident binary label on a sentence like that hides more than it explains.
Approach
- Fine-tune BERT with Hugging Face Transformers and PyTorch on the LIAR dataset — over 10,000 labelled political statements — instead of prompting a general-purpose model, so the classifier learns the label distribution rather than the style of a prompt.
- Preprocess and tokenise the statements, then train through the
TrainerAPI with a fixed split so runs are comparable. - Return a confidence score with every prediction, so the uncertainty travels with the output instead of being flattened into a verdict.
- A Streamlit interface so the model can be exercised on new text without a notebook, and deployed as a link rather than a screenshot.
Results
| Part | What it does |
|---|---|
| Model | BERT fine-tuned on LIAR statements |
| Output | Predicted label plus confidence score |
| Interface | Streamlit app for live text input |
| Deployment | Public Streamlit app |
The 88% figure is confidence on test samples, not accuracy, and it is reported that way deliberately. A confidence score and a correctness score are different claims, and collapsing them is how a classifier ends up looking better than it is.
What I took from it
Confidence is the feature. A label on an ambiguous political statement is a distribution, and showing the score turns an overconfident guess into an honest one. That habit — report the uncertainty with the result — carried directly into the larger projects on this site, where every headline number now arrives with a confidence interval, a kappa or a significance test attached.
Limits. The dataset's labels are themselves contested, the model is trained on political statements from a fixed period, and there is no claim of real-world generalisation. Rotating a model across Arabic, Hindi and English coverage and measuring drift would be the next study.