File size: 2,463 Bytes
0c5edf7 a6d1985 45111f3 a6d1985 45111f3 a6d1985 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
---
title: Headlne
emoji: π₯
colorFrom: indigo
colorTo: pink
sdk: gradio
sdk_version: 5.23.1
app_file: app.py
pinned: false
---
Bias Bin: Bias Detection and Mitigation in Language Models
Bias Bin is an interactive Gradio-based web application for detecting and mitigating gender bias in narrative text. It uses a fine-tuned BERT model and counterfactual data augmentation techniques to highlight and analyze bias in NLP outputs.
π§ Project Overview
This tool allows users to:
β’ Detect gender bias in input text using a BERT-based classification model.
β’ Explore counterfactual predictions by swapping gendered terms.
β’ Visualize bias scores to understand model behavior.
β’ Demonstrate bias mitigation through gender-swapped text examples.
This project was developed as part of a university coursework in Deep Learning & Generative AI.
π Repository Contents
β’ app.py β Main Python file to launch the Gradio web app.
β’ Evaluation&Results.ipynb β Notebook with experiments, model evaluations, and visualizations.
β’ fine_tuned_model.zip β Zip file containing the fine-tuned BERT model (must be extracted).
β’ requirements.txt β List of Python dependencies.
βοΈ Setup Instructions
1. Clone the Repository
git clone https://huggingface.co/spaces/aryn25/bias.bin
cd bias.bin
2. Install Dependencies
pip install -r requirements.txt
3. Extract the Model
Unzip the fine_tuned_model.zip file and place the extracted folder in the project root.
4. Run the App
python app.py
5. Open in Browser
Visit the Gradio URL printed in the terminal
π Methodology
β’ Model: Fine-tuned BERT classifier trained on gender-labeled narrative datasets.
β’ Bias Detection: Uses counterfactual data augmentation by swapping gendered words (e.g., βheβ β βsheβ).
β’ Metrics: Bias scores are computed based on prediction discrepancies between original and counterfactual samples.
π References
This project is built using foundational and peer-reviewed research on:
β’ BERT and Transformer models
β’ Gender bias in NLP
β’ Counterfactual data augmentation
β’ Bias mitigation techniques
Full citation list available in the project report.
π Authors
Created by Aryan N. Salge and team as part of the Deep Learning & Generative AI coursework at the National College of Ireland.
π License
This project is for educational and research purposes. Please cite appropriately if you use or adapt the work.
|