Skip to content

archirajpoot/GDP--Hackathon

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

196 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FairForge Arena Banner

Google Solution Challenge FastAPI Google Cloud Gemini AI PyTorch RL PPO MongoDB Docker


๐Ÿ… Team ๐ŸŽฏ Focus ๐Ÿ›ค๏ธ Track ๐ŸŒ Impact
MASSIVE-X AI Fairness & Responsible AI Unbiased AI Decision-Making SDG 10 & SDG 16

FairForge Arena is an enterprise-grade AI Fairness Training Gym โ€” a complete platform to detect, measure, explain, and automatically eliminate hidden algorithmic bias before it impacts real people's lives.


[!NOTE] โ˜๏ธ Deployment Notice โ€” Due to a temporary Google Cloud billing issue, FairForge Arena is deployed on Vercel for fast and reliable access. It is built with a cloud-native architecture and is fully ready for scalable deployment on Google Cloud (Cloud Run + Vertex AI).


Measure Flag Fix Explain Comply


๐Ÿ“‹ Table of Contents


๐ŸŒ UN SDG Alignment

ย ย ย ย ย ย SDGย ย ย ย ย ย  Goal How FairForge Helps
๐ŸŸ  SDG 10 Reduced Inequalities Prevents algorithmic discrimination against marginalized groups in high-stakes automated decisions โ€” hiring, lending, healthcare diagnosis โ€” ensuring equal treatment regardless of race, gender, or age.
๐Ÿ”ต SDG 16 Peace, Justice & Strong Institutions Delivers transparent, auditable, and explainable AI governance through automated compliance reporting, cryptographic audit trails, and EU AI Act-aligned documentation.

โœจ Key Features

โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘                        FAIRFORGE ARENA  โ€”  CAPABILITIES                      โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฆโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
โ•‘  ๐Ÿ”  DETECT      โ•‘  Intersectional Bias Heatmap (gender ร— race ร— age)        โ•‘
โ•‘  ๐Ÿ“Š  MEASURE     โ•‘  7+ Fairness Metrics  |  Auto-detect protected attributes โ•‘
โ•‘  ๐Ÿšฉ  FLAG        โ•‘  Real-Time Drift Monitoring  |  Automated Alerts          โ•‘
โ•‘  ๐Ÿ‹๏ธ  TRAIN       โ•‘  PPO RL Agent  |  Live Training Curves                    โ•‘
โ•‘  โšก  FIX         โ•‘  One-Click Mitigation Controls  |  Instant Impact View    โ•‘
โ•‘  ๐Ÿค–  EXPLAIN     โ•‘  Gemini Counterfactual XAI  |  Plain-English Decisions    โ•‘
โ•‘  ๐Ÿ•ต๏ธ  SCAN        โ•‘  Shadow AI Scanner  |  LLM Usage Detection in Text        โ•‘
โ•‘  ๐Ÿ“„  COMPLY      โ•‘  EU AI Act PDF Reports  |  EEOC Four-Fifths Rule          โ•‘
โ•‘  ๐Ÿ”—  SECURE      โ•‘  Hash-Chained Integrity Trail  |  Tamper-Proof Logs       โ•‘
โ•‘  ๐Ÿ“ˆ  BENCHMARK   โ•‘  GPT-4o | Claude 3.5 | Gemini 1.5 | Llama 3.1 | Mistral   โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฉโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•=โ•โ•โ•โ•โ•

Feature Deep-Dive

๐Ÿ” Intersectional Bias Heatmap

Visualize bias across intersecting demographic dimensions โ€” gender ร— race ร— age โ€” in a single color-coded heatmap. Instantly spot which specific subgroup combinations are most impacted by discriminatory model behavior.

๐Ÿ‹๏ธ PPO Reinforcement Learning Arena

An active training gym powered by Stable-Baselines3 PPO that trains biased models against adversarial fairness constraints. The RL reward function mathematically optimizes the trade-off:

Reward = ฮฑยทAccuracy โˆ’ ฮฒยท|Disparate Impact โˆ’ 1| โˆ’ ฮณยทStatistical Parity Diff

Watch the agent improve fairness in real-time through live training curves.

๐Ÿค– Gemini Counterfactual Explainer

Powered by Google Gemini API via Vertex AI, this engine ingests fairness metrics and model decisions to generate plain-English "What-If" scenarios:

"If the applicant's age was 5 years older, their loan approval probability increases by 12%."

Makes complex algorithmic decisions understandable for compliance officers and business stakeholders.

๐Ÿ•ต๏ธ Shadow AI Scanner

Detect undisclosed LLM usage in any text by analyzing structural patterns, sentence rhythms, and LLM-specific phraseology. Crucial for organizations managing AI governance and disclosure requirements.

๐Ÿ”— Integrity Trail

Every audit action is stored in a cryptographically hash-chained log (each event contains the hash of the previous), making tampering mathematically detectable. Your audit trail is as secure as a blockchain.


๐Ÿš€ The FairForge Workflow

                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                        โ”‚           FAIRFORGE ARENA WORKFLOW              โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚  UPLOAD  โ”‚ โ”€โ”€โ”€โ–ถโ”‚  AUDIT   โ”‚ โ”€โ”€โ”€โ–ถ โ”‚ MITIGATE โ”‚ โ”€โ”€โ”€โ–ถโ”‚ EXPLAIN  โ”‚ โ”€โ”€โ”€โ–ถ โ”‚  EXPORT  โ”‚
   โ”‚          โ”‚      โ”‚          โ”‚      โ”‚          โ”‚      โ”‚          โ”‚      โ”‚          โ”‚
   โ”‚ Dataset  โ”‚      โ”‚Fairness  โ”‚      โ”‚Fix Bias  โ”‚      โ”‚ Gemini   โ”‚      โ”‚EU AI Act โ”‚
   โ”‚  Model   โ”‚      โ”‚  Check   โ”‚      โ”‚(RL+Fixes)โ”‚      โ”‚  XAI     โ”‚      โ”‚   PDF    โ”‚
   โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚                 โ”‚                  โ”‚                  โ”‚                  โ”‚
        โ–ผ                 โ–ผ                  โ–ผ                  โ–ผ                  โ–ผ
   โ€ข Auto-detect     โ€ข 7 Metrics       โ€ข Reweight         โ€ข Counterfactual   โ€ข EU AI Act
     schema          โ€ข Heatmap         โ€ข Drop Proxy         What-If          โ€ข Audit Logs
   โ€ข Protected       โ€ข Violations      โ€ข Threshold        โ€ข Plain-English    โ€ข Risk Docs
     attributes        Panel           โ€ข PPO Training       Answers          โ€ข Compliance

Step-by-Step

# Phase Action Outcome
1 ๐Ÿ” MEASURE Upload dataset/model โ†’ auto-compute Disparate Impact, Demographic Parity, Equal Opportunity, Intersectional Bias Know exactly where bias exists and how severe it is
2 ๐Ÿšฉ FLAG Real-time drift monitoring, adversarial stress-testing, edge-case probing Catch bias before it reaches production
3 โšก FIX One-click mitigation (reweighting, proxy removal, threshold tuning) + PPO RL training Mathematically reduce bias with minimal accuracy cost
4 ๐Ÿค– EXPLAIN Gemini counterfactuals, What-If explorer, natural language decision explanations Make fairness legible for every stakeholder
5 ๐Ÿ“„ COMPLY Generate EU AI Act / EEOC-compliant PDFs, tamper-proof audit trail Pass regulatory review with confidence

๐Ÿ—๏ธ System Architecture

High-Level Architecture

graph TB
    subgraph Users ["๐Ÿ‘ฅ USERS"]
        DS["๐Ÿง‘โ€๐Ÿ’ป Data Scientist"]
        CO["๐Ÿ“‹ Compliance Officer"]
        BS["๐Ÿ’ผ Business Stakeholder"]
    end

    subgraph Frontend ["๐Ÿ–ฅ๏ธ FRONTEND โ€” Tailwind CSS + Plotly.js + Glassmorphism"]
        UI["Interactive Dashboard SPA"]
        HM["Bias Heatmap"]
        TC["Training Curves"]
        WI["What-If Explorer"]
    end

    subgraph Backend ["โš™๏ธ BACKEND โ€” FastAPI (Python)"]
        API["REST API + WebSocket Routes"]
        FM["Fairness Metrics Engine\n(7+ Metrics)"]
        PE["Policy Engine\n(12 Fairness Rules)"]
        AD["Adversary / Stress Tester"]
        ME["Mitigation Engine"]
        SA["Shadow AI Scanner"]
    end

    subgraph AI ["๐Ÿค– AI LAYER"]
        RL["๐Ÿ‹๏ธ RL ENGINE\nStable-Baselines3 PPO\nGymnasium Environment\nReward: ฮฑยทAccโˆ’ฮฒยทDIโˆ’ฮณยทSPD"]
        XAI["๐Ÿง  XAI ENGINE\nGemini API via Vertex AI\nCounterfactual Analysis\nPlain-English Explanations"]
        COMP["๐Ÿ“„ COMPLIANCE ENGINE\nEU AI Act Report Generator\nHash-Chained Audit Trail\nRisk Scorer"]
    end

    subgraph GCP ["โ˜๏ธ GOOGLE CLOUD PLATFORM"]
        CR["Cloud Run\n(Serverless)"]
        GCS["Cloud Storage\n(PDF Reports)"]
        FA["Firebase Auth\n(JWT)"]
        VA["Vertex AI\n(Gemini)"]
    end

    subgraph DB ["๐Ÿ—„๏ธ DATA LAYER"]
        MDB["MongoDB\n(Motor AsyncIO)"]
        BDS["Benchmark Datasets\nHiring | Loans | Medical"]
        AT["Audit Trail\n(Hash-Chained)"]
    end

    DS & CO & BS --> UI
    UI --> HM & TC & WI
    UI --> API
    API --> FM & PE & AD & ME & SA
    FM & PE --> RL
    ME --> RL
    FM --> XAI
    API --> COMP
    RL & XAI & COMP --> GCP
    CR --> GCS
    CR --> FA
    CR --> VA
    API --> MDB
    MDB --> AT
    MDB --> BDS
Loading

Data Flow Diagram

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    |                     FAIRFORGE ARENA                       โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                              โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ                               โ–ผ                               โ–ผ
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚   ๐Ÿ” DATA & MODEL    โ”‚    โ”‚ ๐Ÿšฉ MONITORING &      โ”‚    โ”‚  ๐Ÿ“„ COMPLIANCE &    โ”‚
   โ”‚        AUDIT         โ”‚    โ”‚      FLAGGING         โ”‚    โ”‚     REPORTING        โ”‚
   โ”‚                      โ”‚    โ”‚                       โ”‚    โ”‚                      โ”‚
   โ”‚ โ€ข Upload Dataset     โ”‚    โ”‚ โ€ข Flag High-Risk Bias โ”‚    โ”‚ โ€ข EU AI Act Reports  โ”‚
   โ”‚ โ€ข Auto-Detect Attrs  โ”‚    โ”‚ โ€ข Generate Alerts     โ”‚    โ”‚ โ€ข Audit Trail Logs   โ”‚
   โ”‚ โ€ข Detect Proxy Vars  โ”‚    โ”‚ โ€ข Stress Test (Edge)  โ”‚    โ”‚ โ€ข Risk Documentation โ”‚
   โ”‚ โ€ข Compute 7+ Metrics โ”‚    โ”‚ โ€ข Continuous Monitor  โ”‚    โ”‚ โ€ข Export PDF to GCS  โ”‚
   โ”‚ โ€ข Intersectional     โ”‚    โ”‚ โ€ข WebSocket Streams   โ”‚    โ”‚ โ€ข Hash-Chain Verify  โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚                               โ”‚                               โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                              โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ                               โ–ผ                               โ–ผ
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚  ๐Ÿ”ง MITIGATION       โ”‚    โ”‚  ๐Ÿง  EXPLAINABILITY  โ”‚    โ”‚  ๐Ÿ“Š LLM BENCHMARK    โ”‚
   โ”‚     (RL-BASED)       โ”‚    โ”‚       (XAI)          โ”‚    โ”‚                      โ”‚
   โ”‚                      โ”‚    โ”‚                      โ”‚    โ”‚ โ€ข GPT-4o             โ”‚
   โ”‚ โ€ข Apply Bias Fixes   โ”‚    โ”‚ โ€ข Gemini Chat Bot    โ”‚    โ”‚ โ€ข Claude 3.5 Sonnet  โ”‚
   โ”‚ โ€ข RL Training (PPO)  โ”‚    โ”‚ โ€ข Counterfactual     โ”‚    โ”‚ โ€ข Gemini 1.5 Pro     โ”‚
   โ”‚ โ€ข Threshold Optimize โ”‚    โ”‚ โ€ข Plain-English Exp. โ”‚    โ”‚ โ€ข Llama 3.1          โ”‚
   โ”‚ โ€ข Compare Versions   โ”‚    โ”‚ โ€ข What-If Explorer   โ”‚    โ”‚ โ€ข Mistral Large      โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ’ป Technology Stack

Layer Technology Purpose
๐Ÿ–ฅ๏ธ Frontend Tailwind CSS, Plotly.js, Vanilla JS, Glassmorphism Interactive fairness dashboard & visualizations
โš™๏ธ Backend FastAPI, Uvicorn, Pydantic, WebSockets High-performance async API & real-time monitoring
๐Ÿ—„๏ธ Database MongoDB (Motor AsyncIO) Async dataset storage & audit log persistence
๐Ÿค– ML Engine PyTorch, Scikit-learn, AIF360 Fairness metrics computation & model evaluation
๐Ÿ‹๏ธ RL Training Stable-Baselines3 (PPO), Gymnasium, OpenEnv Reinforcement learning mitigation arena
๐Ÿง  Explainability Google Gemini API, Vertex AI Counterfactual XAI, natural language explanations
โ˜๏ธ Deployment Google Cloud Run, Cloud Storage, Docker Serverless, auto-scaling containerized deployment
๐Ÿ” Security Firebase Auth (JWT), Hash-Chain Logging Secure access & tamper-proof audit trail
๐Ÿ“Š Charting Chart.js, Plotly.js Real-time training curves & outcome heatmaps

๐Ÿ“‚ Project Structure

โš–๏ธ fairforge/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ app/                          # FastAPI Backend
โ”‚   โ”œโ”€โ”€ ๐Ÿ __init__.py
โ”‚   โ”œโ”€โ”€ ๐Ÿ main.py                   # API entry point + MLOps routes
โ”‚   โ”œโ”€โ”€ ๐Ÿ policies.py               # 12 fairness constraints & policy rules
โ”‚   โ”œโ”€โ”€ ๐Ÿ grader.py                 # 7-metric fairness evaluation engine
โ”‚   โ”œโ”€โ”€ ๐Ÿ adversary.py              # Bias injector for adversarial stress-testing
โ”‚   โ”œโ”€โ”€ ๐Ÿ fairness_metrics.py       # Core mathematical fairness logic (MEASURE)
โ”‚   โ”œโ”€โ”€ ๐Ÿ mitigation_engine.py      # Automated reweighting & FIX suggestions
โ”‚   โ””โ”€โ”€ ๐Ÿ gemini_auditor.py         # Google Gemini API integration (EXPLAIN)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ openenv/                      # Reinforcement Learning Gym
โ”‚   โ”œโ”€โ”€ ๐Ÿ env.py                    # Custom Gymnasium environment
โ”‚   โ”œโ”€โ”€ ๐Ÿ ppo_trainer.py            # PPO training loop & reward function
โ”‚   โ””โ”€โ”€ ๐Ÿ basilisk.py               # Core evaluation & grading scripts
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ frontend/                     # Single Page Dashboard
โ”‚   โ””โ”€โ”€ ๐ŸŒ index.html                # Full UI (Tailwind + Plotly + Glassmorphism)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ data/
โ”‚   โ””โ”€โ”€ ๐Ÿ“ tasks/                    # Benchmark datasets
โ”‚       โ”œโ”€โ”€ ๐Ÿ“Š hiring.csv            # Hiring decisions dataset
โ”‚       โ”œโ”€โ”€ ๐Ÿ“Š loans.csv             # Loan approvals dataset
โ”‚       โ””โ”€โ”€ ๐Ÿ“Š medical.csv           # Medical outcomes dataset
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ reports/                      # Generated compliance PDFs (โ†’ GCS)
โ”‚
โ”œโ”€โ”€ ๐Ÿณ Dockerfile                    # Production container configuration
โ””โ”€โ”€ ๐Ÿ“‹ requirements.txt              # Full dependency manifest

โš™๏ธ Quick Start

Prerequisites

Python 3.10+  |  Docker  |  MongoDB  |  Google Cloud SDK  |  Gemini API Key

Installation

# โ”€โ”€ Step 1 ยท Clone the repository โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
git clone https://github.com/your-username/FairForge-Arena.git
cd FairForge-Arena

# โ”€โ”€ Step 2 ยท Create virtual environment โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
python -m venv venv
source venv/bin/activate        # On Windows: venv\Scripts\activate

# โ”€โ”€ Step 3 ยท Install dependencies โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
pip install -r requirements.txt

# โ”€โ”€ Step 4 ยท Configure environment variables โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
cp .env.example .env
# โ†’ Set GEMINI_API_KEY, MONGODB_URI, GCP_PROJECT_ID, FIREBASE_CREDENTIALS

# โ”€โ”€ Step 5 ยท Start the server โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
python -m uvicorn app.main:app --host 127.0.0.1 --port 8000 --reload

# โ”€โ”€ Step 6 ยท Open your dashboard โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# โ†’ Navigate to http://127.0.0.1:8000

Docker Deployment

# Build and run with Docker
docker build -t fairforge-arena .
docker run -p 8000:8000 --env-file .env fairforge-arena

# Deploy to Google Cloud Run
gcloud run deploy fairforge-arena \
  --image gcr.io/YOUR_PROJECT/fairforge-arena \
  --platform managed \
  --region us-central1 \
  --allow-unauthenticated

๐Ÿ“Š Results & Impact

Bias Mitigation Performance

Metric โŒ Before FairForge โœ… After FairForge Improvement
Disparate Impact Ratio 0.54 (Severe Bias) 0.89 (Near-Fair) +65% ๐ŸŸข
Statistical Parity Diff 0.23 (High) 0.04 (Excellent) -83% ๐ŸŸข
Intersectional Bias High Excellent Dramatic ๐ŸŸข
Equal Opportunity Diff 0.31 0.06 -81% ๐ŸŸข
Accuracy Trade-off 87% 84% -3% only ๐ŸŸก

โฑ๏ธ Full audit-to-report workflow: ~5 minutes (excluding PPO training time)


๐Ÿ”ฎ Future Roadmap

PHASE 1             PHASE 2             PHASE 3             PHASE 4
(0โ€“3 Months)       (3โ€“6 Months)        (6โ€“12 Months)       (12+ Months)
FOUNDATION v3.1    SCALE v4.0          ENTERPRISE v5.0     GLOBAL PLATFORM
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”    โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”    โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”    โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
๐Ÿ”ง Platform        โšก Real-Time        ๐Ÿข Enterprise       ๐ŸŒ Ecosystem
โ€ข Production APIs  โ€ข Drift Monitoring  โ€ข SSO & RBAC        โ€ข Public Leaderboard
โ€ข RL Engine        โ€ข Live Alerts       โ€ข Team Collab       โ€ข Regulatory Mapping
โ€ข Data Pipelines   โ€ข Continuous Audit  โ€ข Audit Automation  โ€ข Global Compliance

๐Ÿง  AI Enhancements ๐Ÿงช Advanced AI      ๐Ÿ” Security         ๐Ÿค Community
โ€ข Gemini v2        โ€ข Causal AI Models  โ€ข Federated Audit   โ€ข Open Source SDK
โ€ข XAI v2           โ€ข Shadow AI Detect  โ€ข Data Privacy      โ€ข Research Papers
โ€ข Metric Expansion โ€ข Multimodal Fair.  โ€ข Secure Logging    โ€ข Industry Partners

๐Ÿ“Š Data            ๐Ÿ“Š Intelligence     ๐Ÿ“Š Governance       ๐Ÿ’ผ Business
โ€ข Multi-Dataset    โ€ข Model Benchmark   โ€ข Compliance Engine โ€ข SaaS Platform
โ€ข Structured Data  โ€ข Version Tracking  โ€ข Policy Mapping    โ€ข Enterprise Clients
โ€ข Multi-format     โ€ข Model Comparison  โ€ข Risk Scoring      โ€ข Monetization

๐Ÿ“œ License

This project was developed for the Google Developer Program โ€” Hack2Skill and Google Solution Challenge 2026.

Open for visitors โ€” feel free to โญ star.


Footer

Made with โค๏ธ and a commitment to fairer AI

Team MASSIVE-X

๐Ÿ‘‘ Team Leader | AbhishekGupta0164 |

FairForge Arena โ€” Train Bias Out. Build Trust In.

Stars Fork

About

Google Developer Program Hackathon Project - "FairForge Arena"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 67.4%
  • Python 32.3%
  • Dockerfile 0.3%