FakeNewsDetectionSystem
AI & Machine Learning Case Study
- Built
- 2022
- Role
- Sole developer
- Stack
- Python · NLP · TensorFlow · API
NLP classification pipeline · 2022
94% test accuracy, 0.93 F1, under 100ms per request
Python · TensorFlow/Keras LSTM · FastAPI
The problem
Project Context.
The proliferation of misinformation online necessitates automated systems capable of flagging potentially false content before it spreads. This project aimed to build a robust Natural Language Processing (NLP) pipeline that could analyze the text of a news article and classify it as "Real" or "Fake" with a high degree of confidence.
The core challenge was not just training a model, but dealing with the nuances of language—sarcasm, context, and evolving terminology—and then packaging that model into a RESTful API that a frontend application could consume seamlessly.
Architecture & Stack
The Solution.
Data Pipeline: I started with a large dataset of labeled news articles. The preprocessing pipeline involved lowercasing, removing stop words, stemming (using NLTK), and tokenization.
Model Selection: I evaluated multiple approaches. Baseline models like Naive Bayes and Logistic Regression with TF-IDF vectorization provided a good starting point. However, to capture the sequence and context of words better, I implemented a deep learning approach using Long Short-Term Memory (LSTM) networks via TensorFlow/Keras.
Deployment: The trained model (weights and tokenizer) was serialized and loaded into a lightweight FastAPI backend. This provided a fast, documented endpoint where clients could POST text and receive a probability score.
Tech Stack
- LanguagePython
- Deep LearningTensorFlow / Keras
- NLP LibrariesNLTK, spaCy
- Data ManipulationPandas, NumPy
- API FrameworkFastAPI
- ArchitectureLSTM Network
Technical hurdles
Challenges & Solutions.
Challenge: Vanishing Gradients
When initially using standard Recurrent Neural Networks (RNNs) for text sequences, the model struggled to retain context from the beginning of long articles due to the vanishing gradient problem.
Solution
Switched the architecture to LSTM (Long Short-Term Memory) cells. LSTMs contain internal gating mechanisms (forget, input, output gates) that explicitly decide what information to retain over long sequences, vastly improving accuracy on longer texts.
Challenge: Overfitting
The deep neural network quickly began to overfit the training data—achieving near 99% accuracy on the training set but performing poorly on the unseen validation set.
Solution
Introduced Spatial Dropout layers after the embedding layer and standard Dropout layers between the dense layers. This regularization technique prevented the network from becoming overly reliant on specific nodes, forcing it to learn more generalized patterns.
Results
The Outcome.
The final LSTM model achieved highly reliable metrics on the test dataset, proving its viability for real-world application. The FastAPI backend provided sub-100ms inference times, making it suitable for real-time text analysis.
94%
Test Accuracy
0.93
F1-Score
<100ms
API Inference Time
Next steps
Want Something Like This.
The service behind it
Data cleaning, baseline models, an LSTM that beat them, regularisation to stop it overfitting, then a documented API endpoint — the whole path from dataset to something a product can call.
AI & machine learning development→How the work runs
Written scope and a fixed quote before anything starts, a running demo every two weeks, and three to five hours of daily overlap with the UK, Europe, the US and Australia.
Who built it
Every project on this site was built by one person, working directly with the client — no account manager in between, and no team you never meet.
Related work
Other Case Studies.
2023 · Flutter
GymTaar — Fitness Platform
Live on App Store & Play Store · 500+ active users
Read case study→2023 · Next.js
BabalCloud
Fully automated VM provisioning · Complex Stripe billing
Read case study→2023 · Django
Bus Management System
Fleet operations digitised · 60% reduction in booking errors
Read case study→