Detect Β· Measure Β· Understand bias in SLMs and LLMs β locally, privately, at scale
| π¬ Bias Audits | π€ Models Tested | π Prompts Run | π·οΈ Bias Types | π©βπ¬ Researchers |
|---|---|---|---|---|
| 1,847+ | 23+ | 94,200+ | 6 | 12+ |
π Website Β· π Docs Β· π Issues Β· π¬ Discussions Β· π DOI
EquiLens is a production-ready black-box bias detection framework for Small Language Models (SLMs) and Large Language Models (LLMs). It probes models purely through their input/output interface β no weight access required β using systematic prompt engineering to surface differential responses across demographic groups.
Built as a final-year B.Tech research project at Amrita Vishwa Vidyapeetham, EquiLens gives researchers, developers, and compliance teams rigorous tools to identify, quantify, and report on bias β all running locally via Ollama, keeping data and model interactions private.
Situation: As SLMs gain adoption in hiring, healthcare, and education, bias in their outputs poses real ethical and legal risk β but most auditing tools require white-box access or cloud APIs.
Task: Design a framework that audits any Ollama-compatible model purely through prompts, produces statistically validated bias scores, and is deployable by a solo researcher without GPU cluster access.
Action: Built a three-phase pipeline (corpus generation β model auditing β statistical analysis) with 94,200+ curated prompt variants spanning gender, race, occupation, and sentiment, backed by a FastAPI job system and dual CLI/web interface.
Result: Detected statistically significant gender bias (Cohen's d > 0.4) and occupational stereotyping in multiple SLMs. Framework published on Zenodo with a citable DOI, one-command Docker deployment, and a live research website.
Accomplished X, as measured by Y, by doing Z
- Quantified bias across 6 dimensions in local LLMs β measured by Cohen's d effect sizes and p-values β by engineering 15,000+ demographically-balanced prompt pairs and running them against Ollama-hosted models.
- Reduced bias audit time from days to hours β measured by end-to-end pipeline runtime β by building a concurrent auditor with automatic retry, checkpoint resume, and optional GPU acceleration.
- Enabled reproducible AI fairness research β measured by a citable Zenodo DOI and a one-command Docker deployment β by packaging the full pipeline as a configuration-driven Python framework with structured corpus generation.
- Delivered a full-stack research tool β measured by a working CLI + REST API + web UI β by architecting a three-tier FastAPI/Gradio system with background job queuing and SQLite persistence.
- No model internals required β works with any Ollama-compatible model via REST API
- Prompt-pair methodology β identical prompts with only the demographic variable changed
- 6 bias dimensions: Gender Β· Racial/Ethnic Β· Occupational Β· Sentiment Β· Counterfactual Β· Associative
- 94,200+ curated prompt variants from a JSON-driven corpus specification
Phase 1: Corpus Generation
word_lists.json β generate_corpus.py β balanced CSV
(names Γ professions Γ trait templates, all demographic pairs)
Phase 2: Model Auditing
CSV corpus β audit_model.py β Ollama API β scored response CSV
(concurrent, resumable, GPU-accelerated via Ollama)
Phase 3: Statistical Analysis
scored CSV β analytics.py β bias scores, effect sizes, HTML/Markdown reports
(t-tests, Cohen's d, confidence intervals, AI-powered narrative insights)
- One command via UV:
uv run equilens web - One command via Docker:
docker compose -f infra/docker-compose.yml up - Dual interface β rich Terminal CLI + built-in web dashboard (Alpine.js, no build step)
- Background job system with real-time SSE log streaming
- Automatic port management, Docker detection, GPU detection
- Periodic automated backups with configurable retention
# Install as a global UV tool β works on any machine with uv + Ollama
uv tool install git+https://github.com/Life-Experimentalist/EquiLens.git
# Start Ollama
ollama serve && ollama pull llama3.2:latest
# Launch dashboard
equilens web # β http://localhost:8000
equilens --help # see all commandsOr try without installing:
uvx --from git+https://github.com/Life-Experimentalist/EquiLens.git equilens --help
# Install UV if you don't have it
pip install uv
# Clone and install
git clone https://github.com/Life-Experimentalist/EquiLens.git
cd EquiLens
uv sync
# Start Ollama (separate terminal)
ollama serve
ollama pull llama3.2:latest
# Launch dashboard β single command, single server
uv run equilens web
# β Dashboard: http://localhost:8000
# β API docs: http://localhost:8000/docsgit clone https://github.com/Life-Experimentalist/EquiLens.git
cd EquiLens
docker compose -f infra/docker-compose.yml up
# β Dashboard: http://localhost:8000
# β API docs: http://localhost:8000/docs
# β Ollama: http://localhost:11434uv sync
# Step 1: Generate bias corpus
uv run equilens generate-corpus
# Step 2: Audit a model
uv run equilens audit --model llama3.2:latest
# Step 3: Analyze results
uv run equilens analyze results/audit_*.csv| Command | Description |
|---|---|
equilens web |
Launch dashboard + API server at http://localhost:8000 |
equilens backend |
Launch FastAPI backend only (API-only mode) |
equilens audit --model <name> |
Run bias audit against a model |
equilens analyze <results.csv> |
Run statistical analysis |
equilens generate-corpus |
Generate a new prompt corpus |
equilens status |
System health check (Ollama, Docker, GPU) |
Full dashboard documentation: docs/DASHBOARD.md
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EquiLens v2.2 β
ββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββ€
β Dashboard (Alpine.js) β CLI (Typer + Rich) β
β FastAPI + Jinja2 β No backend required β
β http://localhost:8000 β β
ββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββ€
β Core Pipeline β
β Phase 1: Corpus Gen β Phase 2: Audit β Phase 3: Analyze β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Ollama (Local LLM Runtime) β
β llama3.2 Β· phi3 Β· mistral Β· gemma Β· qwen Β· deepseek Β· ... β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Full architecture: docs/architecture/ARCHITECTURE.md
| Category | Description | Example Probe |
|---|---|---|
| Gender | Male vs female name substitution | "Alice/Bob is applying for a software role..." |
| Racial/Ethnic | Western vs non-Western names | "Emily/Fatima submitted the report..." |
| Occupational | Profession-based stereotyping | "The nurse/engineer said..." |
| Sentiment | Positive/negative trait association | Adjective pairing by demographic group |
| Counterfactual | Response change on single demographic swap | Identical scenario, only name changes |
| Associative | Implicit word-level associations | Word completion near group identifiers |
| Requirement | Minimum | Recommended |
|---|---|---|
| Python | 3.11 | 3.12+ |
| Ollama | Latest | Latest |
| RAM | 8 GB | 16 GB |
| Disk | 5 GB + models | 20 GB |
| GPU | Not required | NVIDIA CUDA |
EquiLens/
βββ src/
β βββ Phase1_CorpusGenerator/ # Prompt corpus generation
β β βββ generate_corpus.py
β β βββ word_lists.json # Curated demographic word lists
β βββ Phase2_ModelAuditor/ # Black-box model probing
β β βββ audit_model.py
β β βββ enhanced_audit_model.py
β βββ Phase3_Analysis/ # Statistics + reporting
β β βββ analytics.py
β βββ equilens/ # Main Python package
β βββ cli.py # `equilens` CLI entry point
β βββ gradio_app.py # Gradio web UI (backend-connected)
β βββ web_ui.py # Standalone legacy UI
β βββ backend/api.py # FastAPI REST API
β βββ telemetry.py # Usage metric counters
β βββ core/ # Manager, Ollama config, ports
βββ data/
β βββ telemetry.json # Usage metrics seed
β βββ jobs/equilens_jobs.db # SQLite job database
βββ docs/ # Full documentation suite
βββ tests/ # Unit + integration tests
βββ docker-compose.yml
βββ Dockerfile
βββ pyproject.toml
| Guide | Description |
|---|---|
| Quick Start | 5-minute setup guide |
| Gradio UI Guide | Web interface walkthrough |
| CLI Reference | All CLI commands |
| Configuration | Config options |
| Architecture | System design diagrams |
| Pipeline | Phase-by-phase data flow |
| Analytics Guide | Reports and statistics |
| Docker Setup | Docker deployment |
| Ollama Setup | Ollama configuration |
| UV Scripts | UV workflow reference |
| Keyboard Shortcuts | CLI shortcuts |
Published on Zenodo β citable for academic work:
@software{equilens2025,
author = {VKrishna04},
title = {EquiLens: Black-Box AI Bias Detection Framework},
year = {2025},
publisher = {Zenodo},
doi = {10.5281/zenodo.17014103},
url = {https://doi.org/10.5281/zenodo.17014103}
}Related paper: public/AIDE_2026_Sem7.pdf β Auditing Gender Bias in Small Language Models.
Contributions welcome β see CONTRIBUTING.md.
Good first issues: additional bias category templates, new visualization types, alternative LLM backends, more language/cultural word lists.
Apache 2.0 β see LICENSE.md.
Built with rigour for responsible AI Β· Amrita Vishwa Vidyapeetham Β· 2025