Skip to content

About

A multi-agent AI system that automatically audits, explains, and mitigates algorithmic bias with clear, verifiable, end-to-end reports.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

142 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aletheia

ALETHEIA AI

Autonomous Algorithmic Fairness Auditing Protocol

Python FastAPI LangGraph Vertex AI Docker Next.js MCP License


image

Table of Contents


What is Aletheia?

Aletheia is a production-ready, autonomous agentic pipeline that detects, measures, fixes, and verifies bias in any dataset or pretrained ML model — without requiring a data science team.

At its core is a custom-built Audit Algorithm MCP Server (Knowledge Skill Delivery model) that injects runnable algorithm knowledge into each agent's context at runtime. Rather than hardcoding any single fairness method, Aletheia's agents dynamically discover, reason through, and implement the most appropriate algorithm for the specific dataset structure, domain, and data availability they encounter.

Upload CSV or Model  →  4 Autonomous Agents  →  PDF Report + Fixed Output
       ↓                        ↓                         ↓
  No ML expertise          Docker isolated            Plain English
  No configuration         MCP-powered               + Technical metrics
  No code required         13 algorithms             + Drop-in fix

Why India Needs This

India's AI ecosystem is deploying algorithms in high-stakes decisions affecting millions — without any systematic fairness auditing.

Sector Reality Today
HRtech (Naukri, Unstop, HireQuotient) AI screening tools learn caste and gender signals from historical hiring data
Fintech (Slice, KreditBee, MoneyView) ML credit scoring uses postcodes and education as proxies for socioeconomic group
HealthTech Diagnostic AI trained on urban hospital data performs significantly worse on rural patients
EdTech Adaptive learning models calibrated on high-income student patterns disadvantage others

India currently has no AI fairness regulation equivalent to the EU AI Act. The Digital Personal Data Protection Act 2023 covers privacy but not algorithmic bias. However, India's Constitution already addresses this — Articles 15 and 16 prohibit discrimination on grounds of religion, race, caste, sex, and place of birth. AI systems that replicate historical discrimination patterns conflict with these guarantees.

Aletheia helps Indian companies get ahead of regulation before it arrives.


How it Works

Action step

Two Audit Modes

Mode 1 — Dataset Audit

Upload a CSV with demographic attributes and an outcome column. No model required.

What you get:

  • Fixed dataset CSV with bias repaired
  • Publication-ready PDF audit report
  • Interactive AI Chatbot to query agent findings in plain English
  • Test Mode for instant pipeline simulation
  • Before/after fairness metric comparison
  • All agent code (ipykernel) visible and downloadable

Agents: Data Surveyor → Fairness Adjudicator → Bias Mitigator → Report Compiler

→ Full Dataset Agent Breakdown


Mode 2 — Model Audit

Upload a trained sklearn-compatible .pkl or .joblib model + a representative sample CSV.

What you get:

  • threshold_map.json (classifiers) or correction_map.json (regressors) — drop-in fix
  • Fixed predictions CSV
  • SHAP attribution charts
  • Interactive AI Chatbot customized to explain model thresholds and prediction disparities
  • Test Mode for instant model auditing simulation
  • Counterfactual discrimination evidence
  • Publication-ready PDF audit report

Agents: Model Inspector/Profiler → Behavioral/Disparity Auditor → Threshold Calibrator/Output Recalibrator → Report Compiler

→ Full Model Agent Breakdown


LLM BiasProbe (Addon)

Aletheia's two audit modes test datasets and trained models. LLM BiasProbe is a separate addon that adversarially tests any LLM API endpoint for bias — your own model, a third-party API, a local Ollama model — pointed at a specific deployment use case you describe.

Describe use case  →  Gemini generates forced-choice scenarios  →  Target model answers  →  Gemini judges

Why forced-choice, not yes/no: a single "would you approve this one candidate?" prompt has a ceiling effect — absent a competing candidate, a model says yes almost regardless of the protected attribute, and bias hides behind that ceiling. Every BiasProbe scenario is instead a head-to-head choice between two positions, where Position A is pinned to be objectively stronger on fixed, non-protected merit facts (a MELD score, years of experience) that never change across variants — only the protected attribute moves. An unbiased model should pick A every time; a choice that instead tracks the attribute is the bias signal.

Plug in any target endpoint: Ollama, OpenAI-compatible (OpenAI, Groq, Together, vLLM, LM Studio), Anthropic, or a fully custom HTTP endpoint (request template + response path), with a live "Test Connection" check before committing to a real run. API keys are session-only — never written to disk.

Available two ways:

  • CLI — biasprobe/, see biasprobe/README.md
  • GUI — the LLM BiasProbe sidebar tab: endpoint config form → live results table (fills in row by row as the target answers and the judge scores it) → full report (Summary/Cases/Raw, downloadable JSON)

The 13-Algorithm MCP Server

Aletheia's core differentiator is the custom Audit Algorithm MCP Server — a Knowledge Skill Delivery system that injects peer-reviewed fairness algorithm specifications into agent context at runtime.

Agents call list_algorithms() → get_algorithm_info() for each candidate → reason through an elimination log → load_algorithm_knowledge() for selected algorithms → implement from mathematical specification.

No hardcoded choices. No library wrappers. Full auditability.

→ Full MCP & Algorithm Reference

Algorithm Categories at a Glance

Category Algorithms Purpose
Detection Intersectional Scanner, Mutual Info Proxy, Distance Covariance, SHAP Proxy Find hidden bias
Mitigation Disparate Impact Repair, Equal Opportunity, Recidivism Calibrator Fix the bias
Causal Causal Fair Inference, Counterfactual Fairness, Causal Explanation Understand why
Structural Fairness Feedback Reparation, DRO Without Demographics, Relational Fairness PSL Specialist cases

Architecture

System Architecture

cloud-artiture

Three Pillars of the Architecture

01 — Knowledge Skill Delivery Model The custom MCP Auditor server injects complete runnable algorithm knowledge into agent context at runtime. Any new algorithm can be added without touching agent code. Adapts implementation to each dataset's column structure from first principles. No external library dependencies — full auditability.

02 — Custom Sandbox Environment LangGraph orchestrates specialist agents in a highly isolated Docker sandbox. Every decision a human fairness researcher would make — automated. All data isolated, never leaves the container. Full reproducible audit trail across all agents.

03 — Dual-Audience Output Layer Plain-English verdict and before/after comparison for decision-makers. Full statistical metrics (DIR, SPD, EOD, FPRD), fixed CSV/model, and technical ZIP for ML teams. All agent code (ipykernel notebooks) available for user interpretability. Publication-ready PDF with charts and compliance tables.


Key Differentiators

Capability IBM AIF360 Google What-If Microsoft Fairlearn Aequitas Themis-ML **Aletheia **
Zero-code drag-and-drop Partial Partial ****
Auto algorithm selection ** 13 algorithms**
Bias detection Manual Visual only Manual Limited Full — proxy, intersectional, causal
Automated bias mitigation Some Some Some ** Full before/after**
Proxy / indirect bias ** SHAP, dCor, MI**
Intersectional analysis ****
Causal fairness analysis ** PSE, CEF**
Sandboxed execution ** Docker isolated**
PDF audit report ** Publication-ready**
Plain-English findings Partial Partial ** Full narrative**
Fixed dataset/model output Manual Manual ** Auto-generated**
Requires ML expertise Some ** No**
Multi-agent AI pipeline ** LangGraph**
Plugin for coding agents ** Claude, Codex, Gemini**

Four things no competitor does:

  1. Closes the full loop — detect → fix → document. Every competitor is either a library, a visualiser, or a point detector. None close the loop automatically.
  2. Dynamic algorithm selection via KSD — 13 algorithms selected at runtime based on domain and data structure. No hardcoded wrappers.
  3. Four-agent LangGraph orchestration in Docker — custom sandbox handler. No other fairness tool uses multi-agent AI orchestration.
  4. Zero-code — built for non-technical users — equally usable by a founder and a data scientist.

Plugin Support

Aletheia is packaged as a plug-and-play plugin for all major AI coding agents.

→ Full Plugin Integration Guide

npx create-aletheia-skill@latest

Supports: Claude Code · Gemini CLI / Antigravity · OpenAI Codex · Custom Agents


Privacy & Security

→ Full Privacy & Sandbox Architecture

Zero-knowledge architecture. Your data never reaches us.

  • All processing happens inside an isolated Docker container on your infrastructure
  • The MCP server receives only algorithm IDs — never your data
  • Container is destroyed after every audit
  • GDPR-compatible by architecture
  • Full self-host option for air-gap isolation

Agent Breakdowns

Mode Documentation
Dataset Audit Pipeline Dataset Agents — all 4 agents explained
Model Audit Pipeline Model Agents — classification + regression
Algorithm Reference 13 Algorithms — MCP server explained

Tech Stack

AI Orchestration

Technology Role
LangGraph Multi-agent state machine orchestration
Vertex AI / Gemini 3.1 Pro LLM backbone for all 4 agents
MCP Protocol Custom tool/knowledge delivery servers
Docker Sandbox Isolated Python REPL execution environment

Cloud & Infrastructure

Technology Role
Google Cloud Run Auto-scaling frontend hosting
Google Compute Engine Backend VM with Docker socket
Artifact Registry Container image storage
Secrets Manager Vertex AI credential storage

Backend & APIs

Technology Role
FastAPI WebSocket streaming backend server
Python 3.10+ All agent logic and algorithm code
WeasyPrint + matplotlib Server-side PDF generation
NumPy / Pandas / SHAP / scipy ML computation

Frontend

Technology Role
Next.js 14 / React AgenticFlow dashboard
WebSocket Real-time agent output streaming
Tailwind CSS Responsive observability UI
JSON Schema-driven charts Dynamic chart rendering

Cost Estimate

Component Resource Est. Cost / Month
Compute Engine (Backend) 2× e2-standard-2 (2 vCPU, 8 GB RAM) ~₹8,200
Persistent Disk 2× 50 GB balanced ~₹900
Static IP Address 2× Attached Static IPs ~₹500
Cloud Run (Frontend) Serverless Next.js, auto-scaling ~₹0–500
Artifact Registry Docker images (~450 MB) ~₹100
Vertex AI API Gemini 3.1 Pro, scales with volume ~₹200–1,000
Total ~₹11,000/month

Quick Start

Using the Live MVP

Removed the Deployment
  1. Select Dataset Audit or Model Audit
  2. Upload your file (CSV for datasets, .pkl/.joblib + sample.csv for models)
  3. Watch the 4-agent pipeline run in real time
  4. Download your PDF report and fixed output

As a Claude Code Skill

npx create-aletheia-skill@latest
# Select: Claude Code → Import via Settings > Plugins

Then in Claude: "The Aletheia sandbox container is already built. Audit this dataset: [attach file]"

Self-Hosting

git clone https://github.com/Aditya5191/Aletheia-AI
cd Aletheia-AI

# Build Docker sandbox
docker build -t sandbox-python:latest ./mcps/sandbox/

# Start backend
cd backend/dataset_backend
pip install -r requirements.txt
uvicorn backend.api:app --port 8005

# Start MCP servers
python mcps/sandbox/mcp_server.py &
python mcps/auditor/server.py &
python mcps/miscellaneous/server.py &

# Start frontend
cd frontend && npm install && npm run dev

Deployment Commands

Project: project-1c7dff83-6a39-4797-94c · Zone: us-central1-a · Frontend: Cloud Run

Infrastructure Overview

VM Role Machine Static IP Ports
aletheia-dataset-vm Dataset Audit Backend e2-standard-2 34.136.58.37 8005
aletheia-model-vm Model Audit Backend e2-standard-2 35.232.143.12 8006
aletheia-llmbias-vm LLM BiasProbe Backend e2-standard-2 136.115.172.168 8007
aletheia-granite4-vm Ollama (Granite LLM) e2-standard-4 136.119.188.112 11434

Each backend VM runs Caddy (reverse proxy with auto-TLS via sslip.io) → Docker container (FastAPI app).


SSH into VMs

# Dataset VM
gcloud compute ssh aletheia-dataset-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a

# Model VM
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a

# LLM BiasProbe VM
gcloud compute ssh aletheia-llmbias-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a

# Granite (Ollama) VM
gcloud compute ssh aletheia-granite4-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a

View Logs (Live)

Stream real-time logs from any backend container:

# Dataset backend logs
gcloud compute ssh aletheia-dataset-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker logs -f dataset-api"

# Model backend logs
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker logs -f model-api"

# LLM BiasProbe backend logs
gcloud compute ssh aletheia-llmbias-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker logs -f biasprobe-api"

# Ollama logs
gcloud compute ssh aletheia-granite4-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker logs -f ollama"

# Last N lines only (no follow)
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker logs --tail 50 model-api"

Container Management

⚠️ CRITICAL: Do not name your main backend containers starting with aletheia-model- or aletheia-api- (e.g. aletheia-model-api). The backend's sandbox cleanup routine deletes containers with these prefixes on startup. If you use these names, the container will mistakenly delete itself! Always stick to dataset-api, model-api, and biasprobe-api.

# List all containers on a VM
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker ps -a"

# Restart a container
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker restart model-api"

# Stop and remove a container
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker rm -f model-api"

# Pull latest image and run (Model backend example)
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker pull us-central1-docker.pkg.dev/project-1c7dff83-6a39-4797-94c/aletheia/backend-model:latest && \
  sudo docker run -d --name model-api --restart unless-stopped \
    -p 8006:8006 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e QA_OLLAMA_URL=http://10.128.0.5:11434 \
    -e QA_OLLAMA_MODEL=granite4:micro-h \
    -e DEPLOY_ENV=cloud \
    us-central1-docker.pkg.dev/project-1c7dff83-6a39-4797-94c/aletheia/backend-model:latest"

# Check container environment variables
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker exec model-api env"

Hot-Patch (Update Code Without Rebuilding Image)

Copy a local file into the running container and restart — useful for quick fixes:

# Step 1: SCP the file to the VM
gcloud compute scp path/to/local/file.py aletheia-model-vm:/tmp/file.py \
  --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a

# Step 2: Copy into the container and restart
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker cp /tmp/file.py model-api:/app/path/to/file.py && sudo docker restart model-api"

Frontend Deployment (Cloud Run)

# Build and deploy frontend
cd frontend
npm run build

gcloud run deploy aletheia-frontend \
  --source . \
  --project=project-1c7dff83-6a39-4797-94c \
  --region=us-central1 \
  --allow-unauthenticated

Build & Push Docker Images (Artifact Registry)

# Authenticate Docker with Artifact Registry
gcloud auth configure-docker us-central1-docker.pkg.dev

# Build and push Dataset backend
docker build -t us-central1-docker.pkg.dev/project-1c7dff83-6a39-4797-94c/aletheia/backend-dataset:latest \
  -f backend/dataset_backend/Dockerfile .
docker push us-central1-docker.pkg.dev/project-1c7dff83-6a39-4797-94c/aletheia/backend-dataset:latest

# Build and push Model backend
docker build -t us-central1-docker.pkg.dev/project-1c7dff83-6a39-4797-94c/aletheia/backend-model:latest \
  -f backend/model_backend/Dockerfile .
docker push us-central1-docker.pkg.dev/project-1c7dff83-6a39-4797-94c/aletheia/backend-model:latest

# Build and push Sandbox image
docker build -t us-central1-docker.pkg.dev/project-1c7dff83-6a39-4797-94c/aletheia/sandbox-python:latest \
  ./mcps/sandbox/
docker push us-central1-docker.pkg.dev/project-1c7dff83-6a39-4797-94c/aletheia/sandbox-python:latest

Troubleshooting

# Check if all VMs are running
gcloud compute instances list --project=project-1c7dff83-6a39-4797-94c

# Check Caddy reverse proxy logs
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo journalctl -u caddy --no-pager -n 50"

# Check disk usage on a VM
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="df -h && sudo docker system df"

# Kill stale sandbox containers on a VM
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker ps -a --filter name=aletheia- --format '{{.ID}}' | xargs -r sudo docker rm -f"

# Test Ollama connectivity from a backend VM
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="curl -s http://10.128.0.5:11434/api/tags | head -20"

# Check OOM / crash status of a container
gcloud compute ssh aletheia-model-vm --project=project-1c7dff83-6a39-4797-94c --zone=us-central1-a \
  --command="sudo docker inspect model-api -f '{{.State.OOMKilled}} {{.State.ExitCode}} {{.State.Status}}'"

Documentation Index

File Contents
README.md This file — full overview
docs/DATASET_AGENTS.md Dataset pipeline — all 4 agents, inputs, outputs
docs/MODEL_AGENTS.md Model pipeline — classification + regression agents
docs/ALGORITHMS.md All 13 MCP algorithms explained
docs/PLUGINS.md Plugin integration for Claude Code, Codex, Gemini CLI
docs/PRIVACY.md Privacy architecture, Docker isolation, self-hosting
biasprobe/README.md LLM BiasProbe — standalone CLI + GUI addon for adversarial bias testing of any LLM endpoint

Vertex AI

About

A multi-agent AI system that automatically audits, explains, and mitigates algorithmic bias with clear, verifiable, end-to-end reports.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages