Skip to main content

DetoxAI is a Python package for debiasing neural networks. It provides a simple and efficient way to remove bias from your models while maintaining their performance. The package is designed to be easy to use and integrate into existing projects. For more information about the package, see the website https://detoxai.github.io and documentation https://detoxai.readthedocs.io

Installation

DetoxAI is available on PyPI, and can be installed by running the following command:

 pip install detoxai

Quickstart

The snippet below shows the high-level API of DetoxAI and how to use it.

import detoxai

model = ...
dataloader = ... # has to output a tuple of three tensors: (x, y, protected attributes)

corrected = detoxai.debias(model, dataloader)

metrics = corrected["SAVANIAFT"].get_all_metrics() # Get metrics for the model debiased with SavaniAFT method
model = corrected["SAVANIAFT"].get_model()

A shortest snippet that would actually run and shows how to plug DetoxAI into your code is below.

import torch
import torchvision
import detoxai

model = torchvision.models.resnet18(pretrained=True)
model.fc = torch.nn.Linear(model.fc.in_features, 2)  # Make it binary classification

X = torch.rand(128, 3, 224, 224)
Y = torch.randint(0, 2, size=(128,))
PA = torch.randint(0, 2, size=(128,))

dataloader = torch.utils.data.DataLoader(list(zip(X, Y, PA)), batch_size=32)

results: dict[str, detoxai.CorrectionResult] = detoxai.debias(model, dataloader)

Too see more examples of detoxai in use, navigate to the github repo https://github.com/DetoxAI/detoxai and see examples/ folder.

Acknowledgment

If you use this library in your work please cite as:

@misc{detoxai2025,
  author={Ignacy St\k{e}pka and Lukasz Sztukiewicz and Micha\l{} Wili\'{n}ski and Jerzy Stefanowski},
  title={{DetoxAI}: a {Python} Package for Debiasing Neural Networks},
  year={2025},
  url={https://github.com/DetoxAI/detoxai},
}

License

MIT License

Metadata

Release files for detoxai 0.3.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for detoxai 0.3.8
File Size Uploaded
detoxai-0.3.8.tar.gz 8.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for detoxai 0.3.8
File Interpreter ABI Platform
detoxai-0.3.8-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 MB

Release files / detoxai-0.3.8.tar.gz

Download URL detoxai-0.3.8.tar.gz
Size 8.3 MB
Tags Source
SHA-256 checksum
How to use checksums
f8f43877317600cfcca4bfd4392754dc2216726afc3656002f59e6bc719537ec
BLAKE2b-256 checksum
How to use checksums
34a84215368c1700a9cd2f370b4f9382de775b802293fa874e5d22e103bfeae9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.2

Release files / detoxai-0.3.8-py3-none-any.whl

Download URL detoxai-0.3.8-py3-none-any.whl
Size 92.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e555696948460f75dd2dc1b39b6655badf53e68af352c67851579785c45a782d
BLAKE2b-256 checksum
How to use checksums
6363314a70a853236588f3ee8d9d014336c5a2a9c94f016ccb83352161837ef0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.2

Release history Release notifications | RSS feed

This release

0.3.8 This release

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page