LangFair: A Python Package for Assessing Bias and Fairness in Large Language Model Use Cases
Authors/Creators
- 1. CVS Health Corporation
Files
joss.07570.pdf
Files
(91.0 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:074312afd3c75e3fc7a32f967b143809
|
351.5 kB | Preview Download |
|
md5:f63896a269b83bf8392b4e08f4a6d625
|
90.7 MB | Preview Download |
Additional details
Identifiers
Related works
- Describes
- 10.5281/zenodo.14622998 (DOI)
- Is reviewed by
- https://github.com/openjournals/joss-reviews/issues/7570 (URL)
Dates
- Issued
-
January 23, 2025
References
- Bouchard, D., Chauhan, M. S., Skarbrevik, D., Bajaj, V., & Ahmad, Z. (2025). LangFair: A Python Package for Assessing Bias and Fairness in Large Language Model Use Cases (Version v0.3.1) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.14622998
- Rudinger, R., Naradowsky, J., Leonard, B., & Van Durme, B. (2018). Gender Bias in Coreference Resolution (Version 1). arXiv. https://doi.org/10.48550/arxiv.1804.09301
- Zhao, J., Wang, T., Yatskar, M., Ordonez, V., & Chang, K.-W. (2018). Gender Bias in Coreference Resolution: Evaluation and Debiasing Methods (Version 1). arXiv. https://doi.org/10.48550/arxiv.1804.06876
- Webster, K., Recasens, M., Axelrod, V., & Baldridge, J. (2018). Mind the GAP: A Balanced Corpus of Gendered Ambiguous Pronouns. Transactions of the Association for Computational Linguistics, 6, 605–617. https://doi.org/10.1162/tacl_a_00240
- Levy, S., Lazar, K., & Stanovsky, G. (2021). Collecting a Large-Scale Gender Bias Dataset for Coreference Resolution and Machine Translation (Version 2). arXiv. https://doi.org/10.48550/arxiv.2109.03858
- Nadeem, M., Bethke, A., & Reddy, S. (2020). StereoSet: Measuring stereotypical bias in pretrained language models (Version 1). arXiv. https://doi.org/10.48550/arxiv.2004.09456
- Bartl, M., Nissim, M., & Gatt, A. (2020). Unmasking Contextual Stereotypes: Measuring and Mitigating BERT's Gender Bias (Version 1). arXiv. https://doi.org/10.48550/arxiv.2010.14534
- Nangia, N., Vania, C., Bhalerao, R., & Bowman, S. R. (2020). CrowS-Pairs: A Challenge Dataset for Measuring Social Biases in Masked Language Models (Version 1). arXiv. https://doi.org/10.48550/arxiv.2010.00133
- Felkner, V. K., Chang, H.-C. H., Jang, E., & May, J. (2023). WinoQueer: A Community-in-the-Loop Benchmark for Anti-LGBTQ+ Bias in Large Language Models (Version 2). arXiv. https://doi.org/10.48550/arxiv.2306.15087
- Barikeri, S., Lauscher, A., Vulić, I., & Glavaš, G. (2021). RedditBias: A Real-World Resource for Bias Evaluation and Debiasing of Conversational Language Models (Version 1). arXiv. https://doi.org/10.48550/arxiv.2106.03521
- Qian, R., Ross, C., Fernandes, J., Smith, E., Kiela, D., & Williams, A. (2022). Perturbation Augmentation for Fairer NLP (Version 2). arXiv. https://doi.org/10.48550/arxiv.2205.12586
- Kiritchenko, S., & Mohammad, S. (2018). Examining Gender and Race Bias in Two Hundred Sentiment Analysis Systems. Proceedings of the Seventh Joint Conference on Lexical and Computational Semantics, 43–53. https://doi.org/10.18653/v1/s18-2005
- Gehman, S., Gururangan, S., Sap, M., Choi, Y., & Smith, N. A. (2020). RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Models. Findings of the Association for Computational Linguistics: EMNLP 2020, 3356–3369. https://doi.org/10.18653/v1/2020.findings-emnlp.301
- Dhamala, J., Sun, T., Kumar, V., Krishna, S., Pruksachatkun, Y., Chang, K.-W., & Gupta, R. (2021). BOLD. Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, 862–872. https://doi.org/10.1145/3442188.3445924
- Huang, Y., Zhang, Q., Y, P. S., & Sun, L. (2023). TrustGPT: A Benchmark for Trustworthy and Responsible Large Language Models (Version 1). arXiv. https://doi.org/10.48550/arxiv.2306.11507
- Nozza, D., Bianchi, F., & Hovy, D. (2021). HONEST: Measuring Hurtful Sentence Completion in Language Models. Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 2398–2406. https://doi.org/10.18653/v1/2021.naacl-main.191
- Parrish, A., Chen, A., Nangia, N., Padmakumar, V., Phang, J., Thompson, J., Htut, P. M., & Bowman, S. (2022). BBQ: A hand-built bias benchmark for question answering. Findings of the Association for Computational Linguistics: ACL 2022, 2086–2105. https://doi.org/10.18653/v1/2022.findings-acl.165
- Li, T., Khashabi, D., Khot, T., Sabharwal, A., & Srikumar, V. (2020). UNQOVERing Stereotyping Biases via Underspecified Questions. Findings of the Association for Computational Linguistics: EMNLP 2020, 3475–3489. https://doi.org/10.18653/v1/2020.findings-emnlp.311
- Krieg, K., Parada-Cabaleiro, E., Medicus, G., Lesota, O., Schedl, M., & Rekabsaz, N. (2023). Grep-BiasIR: A Dataset for Investigating Gender Representation Bias in Information Retrieval Results. Proceedings of the 2023 Conference on Human Information Interaction and Retrieval, 444–448. https://doi.org/10.1145/3576840.3578295
- Liang, P., Bommasani, R., Lee, T., Tsipras, D., Soylu, D., Yasunaga, M., Zhang, Y., Narayanan, D., Wu, Y., Kumar, A., Newman, B., Yuan, B., Yan, B., Zhang, C., Cosgrove, C., Manning, C. D., Ré, C., Acosta-Navas, D., Hudson, D. A., … Koreeda, Y. (2022). Holistic Evaluation of Language Models. https://doi.org/10.48550/arxiv.2211.09110
- Wang, B., Chen, W., Pei, H., Xie, C., Kang, M., Zhang, C., Xu, C., Xiong, Z., Dutta, R., Schaeffer, R., Truong, S. T., Arora, S., Mazeika, M., Hendrycks, D., Lin, Z., Cheng, Y., Koyejo, S., Song, D., & Li, B. (2023). DecodingTrust: A Comprehensive Assessment of Trustworthiness in GPT Models (Version 5). arXiv. https://doi.org/10.48550/arxiv.2306.11698
- Huggingface. (2022). GitHub - huggingface/evaluate: Evaluate: A library for easily evaluating machine learning models and datasets. https://github.com/huggingface/evaluate
- Nazir, A., Chakravarthy, T. K., Cecchini, D. A., Khajuria, R., Sharma, P., Mirik, A. T., Kocaman, V., & Talby, D. (2024). LangTest: A comprehensive evaluation library for custom LLM and NLP models. Software Impacts, 19, 100619. https://doi.org/10.1016/j.simpa.2024.100619
- Srivastava, A., Rastogi, A., Rao, A., Shoeb, A. A. M., Abid, A., Fisch, A., Brown, A. R., Santoro, A., Gupta, A., Garriga-Alonso, A., Kluska, A., Lewkowycz, A., Agarwal, A., Power, A., Ray, A., Warstadt, A., Kocurek, A. W., Safaya, A., Tazarv, A., … Wu, Z. (2022). Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language models. https://doi.org/10.48550/arxiv.2206.04615
- Lintang Sutawika, Hailey Schoelkopf, Leo Gao, Baber Abbasi, Stella Biderman, Jonathan Tow, ben fattori, Charles Lovering, farzanehnakhaee70, Jason Phang, Anish Thite, Fazz, Aflah, Niklas Muennighoff, Thomas Wang, sdtblck, nopperl, gakada, tttyuntian, … AndyZwei. (2024). EleutherAI/lm-evaluation-harness: v0.4.3 (Version v0.4.3) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.12608602
- Huang, Y., Sun, L., Wang, H., Wu, S., Zhang, Q., Li, Y., Gao, C., Huang, Y., Lyu, W., Zhang, Y., Li, X., Liu, Z., Liu, Y., Wang, Y., Zhang, Z., Vidgen, B., Kailkhura, B., Xiong, C., Xiao, C., … Zhao, Y. (2024). TrustLLM: Trustworthiness in Large Language Models (Version 6). arXiv. https://doi.org/10.48550/arxiv.2401.05561
- Bellamy, R. K. E., Dey, K., Hind, M., Hoffman, S. C., Houde, S., Kannan, K., Lohia, P., Martino, J., Mehta, S., Mojsilovic, A., Nagar, S., Ramamurthy, K. N., Richards, J., Saha, D., Sattigeri, P., Singh, M., Varshney, K. R., & Zhang, Y. (2018). AI Fairness 360: An Extensible Toolkit for Detecting, Understanding, and Mitigating Unwanted Algorithmic Bias (Version 1). arXiv. https://doi.org/10.48550/arxiv.1810.01943
- Weerts, H., Dudík, M., Edgar, R., Jalali, A., Lutz, R., & Madaio, M. (2023). Fairlearn: Assessing and Improving Fairness of AI Systems. Journal of Machine Learning Research, 24. https://jmlr.org/papers/v24/23-0389.html
- Saleiro, P., Kuester, B., Hinkson, L., London, J., Stevens, A., Anisfeld, A., Rodolfa, K. T., & Ghani, R. (2018). Aequitas: A Bias and Fairness Audit Toolkit (Version 2). arXiv. https://doi.org/10.48550/arxiv.1811.05577
- Wexler, J., Pushkarna, M., Bolukbasi, T., Wattenberg, M., Viegas, F., & Wilson, J. (2019). The What-If Tool: Interactive Probing of Machine Learning Models. IEEE Transactions on Visualization and Computer Graphics, 1–1. https://doi.org/10.1109/tvcg.2019.2934619
- Tensorflow. (2020). GitHub - tensorflow/fairness-indicators: Tensorflow's Fairness Evaluation and Visualization Toolkit. https://github.com/tensorflow/fairness-indicators
- Vasudevan, S., & Kenthapadi, K. (2020). LiFT. Proceedings of the 29th ACM International Conference on Information & Knowledge Management, 2773–2780. https://doi.org/10.1145/3340531.3412705
- Bouchard, D. (2024). Bring Your Own Prompts: Use-Case-Specific Bias and Fairness Evaluation for LLMs (Version 6). arXiv. https://doi.org/10.48550/arxiv.2407.10853
- Zekun, W., Bulathwela, S., & Koshiyama, A. S. (2023). Towards Auditing Large Language Models: Improving Text-based Stereotype Detection (Version 1). arXiv. https://doi.org/10.48550/arxiv.2311.14126
- Gallegos, I. O., Rossi, R. A., Barrow, J., Tanjim, M. M., Kim, S., Dernoncourt, F., Yu, T., Zhang, R., & Ahmed, N. K. (2023). Bias and Fairness in Large Language Models: A Survey (Version 3). arXiv. https://doi.org/10.48550/arxiv.2309.00770
- Huang, P.-S., Zhang, H., Jiang, R., Stanforth, R., Welbl, J., Rae, J., Maini, V., Yogatama, D., & Kohli, P. (2020). Reducing Sentiment Bias in Language Models via Counterfactual Evaluation. Findings of the Association for Computational Linguistics: EMNLP 2020, 65–83. https://doi.org/10.18653/v1/2020.findings-emnlp.7
- Zhang, J., Bao, K., Zhang, Y., Wang, W., Feng, F., & He, X. (2023). Is ChatGPT Fair for Recommendation? Evaluating Fairness in Large Language Model Recommendation. Proceedings of the 17th ACM Conference on Recommender Systems, 993–999. https://doi.org/10.1145/3604915.3608860
- Goldfarb-Tarrant, S., Marchant, R., Muñoz Sánchez, R., Pandya, M., & Lopez, A. (2021). Intrinsic Bias Metrics Do Not Correlate with Application Bias. Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), 1926–1940. https://doi.org/10.18653/v1/2021.acl-long.150
- Delobelle, P., Tokpo, E., Calders, T., & Berendt, B. (2022). Measuring Fairness with Biased Rulers: A Comparative Study on Bias Metrics for Pre-trained Language Models. Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 1693–1706. https://doi.org/10.18653/v1/2022.naacl-main.122
Citations
- Khapre, S., Mersha, M. A., Shakil, H., Baruah, J., & Kalita, J. (2026). Toxicity in online platforms and AI systems: A survey of needs, challenges, mitigations, and future directions. Expert Systems with Applications, 299, 129832. https://doi.org/10.1016/j.eswa.2025.129832
- Narayanan, A., Sekhon, K., Alinoori, M., & Raza, S. (2026). FairSense-AgentiX: An Agentic Platform for Multi-Modal Fairness and AI Risk Analysis. Journal of Open Source Software, 11(126), 11060. https://doi.org/10.21105/joss.11060
- Changoluisa Lasluisa, E. H., Changoluisa Lasluisa, M. B., Alemán Gualpa, P. D., Recalde Varela, P. M., & Baldeón-Egas, P. F. (2026). Counterfactual Audit of Ethnic-Origin Bias and Architectural Mitigation in Generative AI Assistants for Debt Collection in Savings and Credit Cooperatives. Computers, 15(11), 765. https://doi.org/10.3390/computers15110765
- Sécheresse, X., Guilbert–Ly, J.-Y., & Villedieu de Torcy, A. (2025). GAAPO: genetic algorithmic applied to prompt optimization. Frontiers in Artificial Intelligence, 8. https://doi.org/10.3389/frai.2025.1613007
- Karras, A., Theodorakopoulos, L., Karras, C., Krimpas, G. A., Giannaros, A., & Bakalis, C.-P. (2025). LLM-Driven Big Data Management Across Digital Governance, Marketing, and Accounting: A Spark-Orchestrated Framework. Algorithms, 18(12), 791. https://doi.org/10.3390/a18120791