A deep learning model that automatically classifies news articles as "Real" or "Fake" with 97.5% accuracy, designed to help online platforms combat the spread of misinformation at scale.
Content moderation teams at news aggregators and social media platforms are overwhelmed by the high volume of articles published daily. This makes it incredibly difficult to:
- Manually identify misinformation in a timely manner.
- Reliably and consistently apply content policies.
- Prevent harmful "fake news" from spreading virally before it can be flagged.
Hypothesis: By leveraging a state-of-the-art Transformer model (BERT), we can build an automated classification tool that acts as a "first line of defense," enabling human moderation teams to focus their efforts on the most high-risk content with greater speed and accuracy.
This project frames fake news detection as a binary text classification problem. The model architecture fine-tunes a pre-trained BERT model on a labeled dataset of real and fake news articles.
-
High-Accuracy Classification Engine: Ingests the full text of a news article and outputs a probability score indicating the likelihood of it being fake.
-
Long-Form Content Analysis: To handle real-world articles that often exceed the token limits of standard models, the system intelligently segments long texts into overlapping chunks. This ensures the entire context is analyzed before a final, aggregated prediction is made.
- Model Framework: TensorFlow 2.0
- Core NLP Model: BERT ( leveraging the
bert-for-tf2library) - Data Manipulation: Pandas, Scikit-learn
- Visualization: Matplotlib, Seaborn, WordCloud
The model's performance was evaluated against a hold-out test set using Accuracy, Precision, Recall, F1-Score, and Area Under Curve (AUC).
The final, aggregated predictions on the original test articles achieved:
- Test Accuracy: 97.5%
- AUC Score: 0.99
This high level of performance demonstrates the model's capability to reliably distinguish between real and fake news, significantly reducing the need for manual review and enabling platforms to scale their content integrity efforts.
- Fine-tuning a large pre-trained model like BERT is a highly effective strategy for domain-specific text classification.
- The text-chunking method for long documents is a critical and successful preprocessing step for handling real-world data with Transformer models.
- V2 (Deployment): Package the model into a containerized REST API (using Docker and Flask/FastAPI) for easy integration into production content management systems.
- V3 (Feature Expansion): Enhance the model to perform multi-class classification, identifying not just "Fake" but also categories like "Satire," "Opinion," or "Clickbait" for more granular moderation.
Ensure you have the necessary libraries installed. You can create a requirements.txt file and install them via pip.
pip install -r requirements.txt
