Skip to main content

A comprehensive set of fairness metrics, datasets and algorithms to address and mitigate bias in Natural Language Processing.

Project description

Fair Language Processing (FairLangProc)

The Fair Language Processing package is a extensible open-source Python library containing techniques developed by the research community to help detect and mitigate bias in Natural Language Processing throughout the AI application lifecycle.

The FairLangProc package includes:

  1. Data sets to test for biases in NLP models.
  2. Metrics based on different philosophies to quantified said biases.
  3. Algorithms to mitigate biases. It has been created with the intention of encouraging the use of bias mitigation strategies in the NLP community, and with the hope of democratizing these tools for the ever-increasing set of NLP practitioners. We invite you to use it and improve it.

The companion paper provides a comprehensive introduction to the concepts and capabilities, with all code available in notebooks. Furthermore, we are working torwards a comprehensive documentation.

We have developed the package with extensibility in mind. This library is still in development. We encourage your contributions.

Supported fairness datasets

Data Set Size Reference
BBQ 58,492 Parrish et al., 2021
BEC-Pro 5,400 Bartl et al., 2020
BOLD 23,679 Dhamala et al., 2021
BUG 108,419 Levy et al., 2021
Crow-SPairs 1,508 Nangia et al., 2020
GAP 8,908 Webster et al., 2018
HolisticBias 460,000 Smith et al., 2022
HONEST 420 Nozza et al., 2021
StereoSet 16,995 Nadeem et al., 2020
UnQover 30 Li et al., 2020
WinoBias+ 1,367 Vanmassenhove et al., 2021
WinoBias 3,160 Zhao et al., 2018
WinoGender 720 Rudinger et al., 2018

Supported fairness metrics

Supported bias mitigation algorithms

Setup

Python

Has been tested and ran with Python 3.13. Compatibility with older versions is possible and expected, although no tests have been run to check the possible configurations.

To install the latest stable version from PyPI, run:

pip install FairLangProc

Manual installation

Clone the latest version of this repository:

git clone https://github.com/arturo-perez-peralta/FairLangProc

Using FairLangProc

The notebooks directory contains a diverse collection of jupyter notebooks that showcase how to use the different processors, metrics and data sets. If you'd like to run the examples requiring , download the data sets now and place them in a folder named Fair-LLM-Benchmarks inside the 'FairLangProc/datsets' path or simply clone the repository from Gallegos et al.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fairlangproc-0.1.3.tar.gz (45.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fairlangproc-0.1.3-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

Details for the file fairlangproc-0.1.3.tar.gz.

File metadata

  • Download URL: fairlangproc-0.1.3.tar.gz
  • Upload date:
  • Size: 45.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fairlangproc-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4e2701346603c44ac7500b02933be3260b5dcd36e34656d00b5a50a7402ccb5a
MD5 fb81e9185dc879a189d7cf5b5b707a5b
BLAKE2b-256 3c23029d1bc44c0ca067f765a6c680d07f135bdb5d676f087a72d0ca5b2cc929

See more details on using hashes here.

File details

Details for the file fairlangproc-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: fairlangproc-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 55.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fairlangproc-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bc7893ed7349e954c662cfddcbaf612336c6536ef0151be34f972da4b0ba318b
MD5 6009812b575355faf86c88b7387385f6
BLAKE2b-256 f42da11d4728276a5b839fcb386dfa94fa91422132c3ab473e295445d29ae4ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page