Skip to content
← Back to Projects

January 15, 2025 (1y ago)

Reddit Racism Analyzer: AI-Powered Content Moderation

Overview

The Reddit Racism Analyzer is a groundbreaking AI-powered web application that revolutionizes content moderation by detecting and analyzing racist and hateful content across Reddit communities. Built during the LSE Code Camp 2025, this comprehensive tool leverages an ensemble of state-of-the-art machine learning models to provide detailed insights for both individual users and entire communities.

🏆 Overall Winner - LSE Code Camp 2025
Managing Information Systems and Digital Innovation Track

The project emerged from recognizing the critical need for scalable, accurate content moderation tools as online communities grow exponentially. Traditional moderation approaches struggle with context, scale, and consistency—this AI-driven solution addresses these challenges while maintaining ethical considerations and reducing moderator burnout.

Competition Context

LSE Code Camp 2025

  • Event: London School of Economics Code Camp 2025
  • Track: Managing Information Systems and Digital Innovation
  • Duration: three-day development competition
  • Entry: solo, against 10+ teams
  • Achievement: Overall Winner

Problem Statement

Modern online communities face an epidemic of hate speech and racist content that:

  • Overwhelms human moderators with volume and psychological burden
  • Creates inconsistent enforcement across similar content
  • Fails to identify subtle or coded racist language
  • Lacks scalable solutions for growing communities
  • Provides no insights into community health trends

Solution Architecture

Core Innovation: Multi-Model Ensemble Approach

Unlike single-model solutions that often produce false positives or miss nuanced content, our system combines three specialized AI models:

  1. Toxic-BERT: Optimized for general toxicity detection
  2. Hate Speech Model: Specialized for social media hate detection
  3. Twitter-RoBERTa: Expert in short-form content analysis

The ensemble scores each item with three models and combines the results, so no single classifier decides on its own.

Technical Architecture

Backend Infrastructure

  • Flask Framework: Lightweight, scalable web application framework
  • Transformers Library: Hugging Face state-of-the-art NLP models
  • SQLite Database: Intelligent caching system for performance optimization
  • ThreadPoolExecutor: Parallel processing for concurrent analysis
  • Reddit API Integration: Real-time data ingestion with rate limiting

AI Processing Pipeline

  • Content Preprocessing: Text normalization, emoji handling, and context extraction
  • Multi-Model Inference: Parallel processing through ensemble models
  • Confidence Scoring: Weighted averaging with uncertainty quantification
  • Context Analysis: Educational content detection to reduce false positives
  • Temporal Tracking: Pattern analysis across user history timelines

Frontend Experience

  • Responsive Design: Mobile-first interface optimized for moderators
  • Interactive Reports: Dynamic visualizations with drill-down capabilities

Key Features & Capabilities

User Analysis Engine

  • Comprehensive Profiling: Analyzes entire user post/comment history
  • Risk Scoring: 0-1 scale with 6-level classification system
  • Pattern Detection: Identifies escalation trends and behavioral changes
  • Content Flagging: Highlights specific problematic posts with context
  • Temporal Analysis: Tracks racism patterns over time periods

Community Health Assessment

  • Subreddit Analysis: Evaluates entire community health metrics
  • Sample Sizing: Configurable analysis depth (10-200 users)
  • Risk Distribution: Statistical breakdown of user risk levels
  • Cross-Community Patterns: Identifies users active in multiple problematic spaces
  • Moderation Insights: Actionable recommendations for community improvement

Advanced Analytics

  • Network Analysis: Maps relationships between problematic users
  • Trend Identification: Detects emerging hate speech patterns

Technical Challenges & Solutions

1. Context-Aware False Positive Reduction

Challenge: Educational content, historical discussions, and academic research often contain racist language in non-harmful contexts Solution: Added a context step that detects quoted and academic language and down-weights it before the final score

2. Real-time Processing at Scale

Challenge: Analyzing many posts per user while keeping the interface responsive Solution: Parallel processing with ThreadPoolExecutor and SQLite caching

3. Model Ensemble Optimization

Challenge: Balancing accuracy across different types of racist content while maintaining performance Solution: Created weighted ensemble system with confidence scoring and specialized model routing

4. Ethical AI Implementation

Challenge: Ensuring fair, unbiased analysis across different communities and user types Solution: Transparent confidence scoring with recommendations for human review

Innovation Highlights

1. 6-Level Classification System

A rating system from "Anti-Racist" to "CEO of Racism" provides nuanced understanding beyond binary classification:

  • Level 0: Anti-Racist (actively promotes equality)
  • Level 1: Clean (no problematic content detected)
  • Level 2: Questionable (borderline content requiring review)
  • Level 3: Problematic (clear racist tendencies)
  • Level 4: Highly Racist (frequent, explicit racist content)
  • Level 5: CEO of Racism (extreme, persistent racist behavior)

2. Smart Caching & Performance

  • Intelligent Caching: SQLite-based system reduces repeated API calls
  • Incremental Analysis: Only processes new content for returning users
  • Batch Processing: Optimized for analyzing multiple users simultaneously
  • Memory Management: Efficient handling of large text datasets

3. Ethical AI Framework

  • Transparency: Clear confidence scores and reasoning for all classifications
  • Privacy Protection: Only analyzes publicly available content
  • Human Oversight: Recommendations for human review on borderline cases

4. Actionable Insights

  • Moderation Recommendations: Specific actions for community improvement
  • User Intervention Strategies: Tailored approaches for different risk levels
  • Community Health Metrics: Trackable KPIs for long-term improvement
  • Trend Analysis: Early warning systems for emerging problems

Result

Overall Winner of the LSE MISDI Code Camp 2025, entered solo against 10+ teams.

Technical Implementation Details

Machine Learning Pipeline

# Ensemble model architecture
models = {
    'toxic_bert': ToxicBERTModel(),
    'hate_speech': HateSpeechModel(), 
    'twitter_roberta': TwitterRoBERTaModel()
}
 
# Weighted ensemble scoring
def analyze_content(text):
    scores = {}
    for model_name, model in models.items():
        scores[model_name] = model.predict(text)
    
    # Weighted average with confidence intervals
    final_score = calculate_ensemble_score(scores)
    return final_score, confidence_interval

Performance Optimizations

  • Batch Processing: Process multiple texts simultaneously
  • Model Caching: Keep models loaded in memory for faster inference
  • Database Indexing: Optimized queries for user history retrieval
  • Async Processing: Non-blocking analysis for better user experience

Lessons Learned & Development Insights

AI/ML Development

  1. Ensemble Superiority: Multiple specialized models outperform single general-purpose models
  2. Context Matters: Educational content detection crucial for practical deployment
  3. Performance vs. Accuracy: Careful balance needed for real-world usability
  4. Bias Awareness: Continuous monitoring essential for fair AI systems

Product Development Under Pressure

  1. MVP Focus: the three-day constraint forced ruthless prioritization of core features
  2. User Experience: Even technical tools need intuitive interfaces for adoption
  3. Demonstration Strategy: Live demos more impactful than technical presentations
  4. Team Coordination: Clear role definition critical in high-pressure environments

Ethical Considerations

  1. Transparency: Users must understand how and why content is flagged
  2. Human Oversight: AI should augment, not replace, human judgment
  3. Privacy Respect: Only analyze publicly available content with clear purpose
  4. Bias Prevention: Regular auditing for fairness across different groups

Commercial & Research Applications

Platform Moderation

  • Reddit: Subreddit health monitoring and user risk assessment
  • Discord: Server safety tools for community managers
  • Forums: Traditional forum moderation enhancement
  • Social Media: Brand safety and community management

Academic Research

  • Hate Speech Studies: Large-scale analysis of online racism patterns
  • Community Dynamics: Understanding how toxic communities form and evolve
  • Intervention Research: Measuring effectiveness of different moderation strategies
  • Cross-Platform Analysis: Comparing hate speech patterns across platforms

Corporate Applications

  • Brand Safety: Monitor social media mentions for racist associations
  • Employee Communications: Workplace harassment detection and prevention
  • Customer Service: Identify and escalate racist customer interactions
  • Content Creation: Ensure marketing content avoids problematic language

Source Code

The code is public under the GPL-3.0 licence: GitHub Repository.

Technical Specifications

System Requirements

  • Python: 3.8+ with virtual environment support
  • Memory: 4GB+ RAM for model loading
  • Storage: 2GB+ for models and cache
  • Network: Stable internet for Reddit API access

Dependencies

  • Core: Flask, Transformers, SQLite
  • ML: PyTorch, scikit-learn, numpy, pandas
  • Web: HTML5, CSS3, JavaScript, Font Awesome
  • API: Reddit API (PRAW), rate limiting libraries

Code: GitHub Repository

Downloads

Files are served from /public or external URLs.