Giter Club home page Giter Club logo

bias-analysis's Introduction

Scaling Implicit Bias Analysis across Transformer-based Language Models

Abstract

In the evolving field of machine learning, deploying fair and transparent models remains a formidable challenge. This study builds on earlier research, demonstrating that neural architectures exhibit inherent biases by analyzing a broad spectrum of transformer-based language models from base to extra-large configurations. This article investigates movie reviews for genre-based bias, which leverages the Word Embedding Association Test (WEAT), revealing that scaling models up tends to mitigate bias, with larger models showing up to a 29% reduction in prejudice. Additionally, this study underscores the effectiveness of prompt-based learning, a facet of prompt engineering, as a practical approach to bias mitigation, reducing genre bias in reviews by more than 37% on average. This suggests that the refinement of development practices should include the strategic use of prompts in shaping model outputs, highlighting the crucial role of ethical AI integration to weave fairness seamlessly into the core functionality of transformer models.

Keywords

AI, Model Scaling, Generative Pretrained Transformer (GPT), K-Means, Bidirectional Encoder Representations from Transformers (BERT), Transformer, Prompt Engineering, Language Models, Word Embedding Association Test (WEAT), Natural Language Processing (NLP)

Dataset

This project utilizes the IMDB Movie Reviews Dataset to analyze bias across different language models.

Installation

To set up your environment to run these notebooks and scripts, follow the steps below:

# Clone the repository
git clone https://github.com/Deep6Lab/Bias-Analysis
cd Bias-Analysis

# Set up a Python virtual environment (recommended)
python -m venv env
source env/bin/activate  # On Windows use env\Scripts\activate

# Install required packages
pip install numpy pandas matplotlib seaborn scikit-learn nltk tensorflow keras pytorch transformers beautifulsoup4 wordcloud colorsys

# Additional dependency for transformers
pip install -U transformers

# Install PyTorch (visit the official website https://pytorch.org/ for custom installation options)
pip install torch torchvision torchaudio

# Run the script
python main.py 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.