Factify is an AI-powered fact verification platform that analyzes user-submitted claims by retrieving evidence from trusted news sources, ranking the most relevant information using semantic similarity, and verifying the claim through Natural Language Inference (NLI).
Unlike traditional fake news classifiers that rely solely on supervised text classification, Factify follows a retrieval-augmented verification pipeline, making every prediction explainable through supporting evidence.
- Overview
- Motivation
- Features
- AI Verification Pipeline
- System Architecture
- Technology Stack
- Project Structure
- Installation
- Usage
- Future Improvements
- License
The rapid spread of misinformation across digital platforms has made automatic claim verification increasingly important.
Traditional fake news detection models classify an article directly as real or fake, often without providing any explanation behind their predictions.
Factify approaches this problem differently.
Instead of relying only on a classification model, it:
- retrieves evidence from trusted sources,
- measures semantic similarity between the claim and retrieved information,
- reasons over the evidence using Natural Language Inference,
- combines multiple credibility signals,
- produces an evidence-backed final verdict.
This makes the verification process more transparent and easier to interpret.
- π AI-powered claim verification
- π Retrieves evidence from Google News
- π§ Semantic search using Sentence-BERT embeddings
- π Cosine similarity based evidence ranking
- π― Cross-Encoder re-ranking for improved relevance
- π€ Natural Language Inference (NLI) reasoning
- β Source credibility scoring
- π Topic-aware trust boosting
- βοΈ Weighted ensemble for final verdict generation
- π Displays supporting evidence with confidence scores
- π€ User authentication and profile management
- π° Latest news feed integration
Factify follows a multi-stage Retrieval-Augmented Verification (RAV) pipeline.
User Claim
β
βΌ
Retrieve External Evidence
β
βΌ
Clean & Preprocess Articles
β
βΌ
Generate SBERT Embeddings
β
βΌ
Semantic Similarity Ranking
β
βΌ
Cross Encoder Re-ranking
β
βΌ
Natural Language Inference
β
βΌ
Source Credibility Scoring
β
βΌ
Weighted Ensemble
β
βΌ
Final Verdict
flowchart TD
A[User Claim]
A --> B[Google News API]
B --> C[Article Retrieval]
C --> D[Text Cleaning]
D --> E[Sentence-BERT Embeddings]
E --> F[Cosine Similarity Ranking]
F --> G[Cross Encoder Re-ranking]
G --> H[Natural Language Inference]
H --> I[Source Trust Scoring]
I --> J[Weighted Decision Engine]
J --> K[Final Verdict + Supporting Evidence]
The user submits a claim through the web interface.
Example:
"WHO has officially declared chocolate as a cure for diabetes."
Relevant articles are retrieved using Google News APIs and trusted news sources.
Examples include:
- Reuters
- BBC
- AP News
- WHO
- Al Jazeera
- Wikipedia
Retrieved articles are cleaned before analysis.
This includes:
- removing HTML artifacts
- whitespace normalization
- chunking articles
- preprocessing text
Factify converts both the claim and evidence into dense vector representations using Sentence-BERT.
Model used:
all-MiniLM-L6-v2
The embeddings are compared using cosine similarity to identify the most relevant evidence.
The top retrieved articles are passed through a Cross Encoder model.
Unlike SBERT, the Cross Encoder evaluates the claim and evidence together, producing a more accurate relevance score.
This improves evidence quality before reasoning.
The selected evidence is analyzed using an NLI model to determine whether it:
- β Supports the claim
- β Contradicts the claim
- βͺ Provides insufficient evidence
Rather than simply predicting "Fake" or "Real", the model reasons over retrieved evidence.
Factify considers source reliability during verification.
Examples:
| Source | Trust Score |
|---|---|
| WHO | 1.00 |
| Reuters | 0.96 |
| BBC | 0.95 |
| AltNews | 0.98 |
Topic-specific trust boosts further improve evidence weighting.
The final decision combines multiple signals:
- Semantic Similarity
- Cross Encoder Score
- NLI Confidence
- Source Trust
- Topic Relevance
These scores are combined using a weighted ensemble to generate the final confidence score and verdict.
- Django
- Python
- HTML
- CSS
- JavaScript
- Hugging Face Transformers
- SentenceTransformers
- Scikit-learn
- Sentence-BERT (all-MiniLM-L6-v2)
- Cosine Similarity
- Natural Language Inference
- Google News API
- BeautifulSoup
- Requests
- SQLite
Factify/
β
βββ Factify/ # Django configuration
β
βββ news/
β βββ ml_model/ # ML models & vectorizers
β βββ static/
β βββ templates/
β βββ utils.py
β βββ models.py
β βββ views.py
β βββ urls.py
β
βββ requirements.txt
βββ manage.py
βββ README.md
git clone https://github.com/yourusername/Factify.git](https://github.com/Kevhand/Factify-Fact-Checking
cd Factifypython -m venv venvActivate it:
Windows
venv\Scripts\activateLinux / macOS
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root.
DJANGO_SECRET_KEY=your_django_secret_key
GOOGLE_NEWS_API_KEY=your_google_news_api_key
GOOGLE_SEARCH_API_KEY=your_google_custom_search_api_key
GENERAL_CX=your_general_search_engine_id
TECH_CX=your_tech_search_engine_id
MEDICAL_CX=your_medical_search_engine_id
FINANCE_CX=your_finance_search_engine_id
POLITICS_CX=your_politics_search_engine_id| Variable | Description |
|---|---|
DJANGO_SECRET_KEY |
Secret key for Django |
GOOGLE_NEWS_API_KEY |
Google News API access |
GOOGLE_SEARCH_API_KEY |
Google Custom Search API key |
GENERAL_CX |
Search Engine ID for general queries |
TECH_CX |
Search Engine ID for technology-related claims |
MEDICAL_CX |
Search Engine ID for medical claims |
FINANCE_CX |
Search Engine ID for finance-related claims |
POLITICS_CX |
Search Engine ID for political claims |
python manage.py migratepython manage.py runserverVisit:
http://127.0.0.1:8000/
- Register or log in.
- Enter a claim to verify.
- Factify retrieves evidence from trusted sources.
- Relevant evidence is ranked using semantic similarity.
- NLI determines whether the evidence supports or contradicts the claim.
- The final verdict, confidence score, and supporting evidence are displayed to the user.
- Multi-language fact verification
- Knowledge graph integration
- Explainable AI visualizations
- Fine-tuned domain-specific NLI models
- Live social media claim verification
- Vector database integration (FAISS)
- RAG-based evidence summarization
- LLM-generated natural language explanations
- User feedback loop for continuous improvement
This project is licensed under the MIT License.
Developed by Yash Singh
If you found this project interesting, consider giving it a β on GitHub.