Inspiration

In today’s digital era, misinformation spreads faster than truth. Fake news has led to misinformation, panic, and loss of trust in online platforms. I wanted to build an AI-powered solution that helps users quickly verify the authenticity of news before believing or sharing it.


What I Learned

  • Fine-tuning NLP models like BERT/DistilBERT for text classification.
  • Building a real dataset pipeline using public fake news datasets (e.g., LIAR, FakeNewsNet).
  • Implementing explainable AI by highlighting suspicious keywords.
  • Deploying machine learning models as APIs and integrating them with a clean, modern frontend.

How I Built the Project

  1. Data Collection & Preprocessing
  • Collected datasets containing real and fake news headlines.
  • Performed tokenization, stopword removal, and text vectorization using BERT embeddings.
  1. Model Training
  • Fine-tuned DistilBERT for binary classification: Real vs Fake.
  • Achieved over 90% F1-score using PyTorch and HuggingFace Transformers.
  1. Backend
  • Developed a Flask API exposing a /predict endpoint that returns classification results and confidence scores.
  1. Frontend
  • Built a responsive web UI using HTML, TailwindCSS, and JavaScript.
  • Implemented real-time predictions with AJAX requests to the Flask backend.
  1. Deployment
  • Hosted the model using Hugging Face Spaces (Gradio) for interactive demos.
  • Deployed frontend on Vercel.

Challenges I Faced

  • Data Imbalance: Many datasets had more real news than fake news. I used data augmentation and resampling techniques to balance them.
  • Subtle Language Patterns: Fake news often looks authentic. I overcame this by fine-tuning contextual embeddings.
  • Model Size & Latency: BERT is large; I optimized using DistilBERT for faster inference.
  • Explainability: Building a heatmap of important words required custom visualization tools.

Future Plans

  • Adding support for multi-language fake news detection.
  • Building a Chrome extension for real-time article verification.
  • Incorporating fact-checking APIs for cross-referencing news.
  • Enhancing explainability with keyword and sentence-level insights.

Built With

Share this project:

Updates