GithubHelp home page GithubHelp logo

pruning-bias's Introduction

Gender Biases and Where to Find Them:

Exploring Gender Bias Using Movement Pruning โœ‚

Accepted to NAACL2022, Workshop on Gender Bias in Natural Language Processing

๐Ÿ‘‰ arxiv paper ๐Ÿ‘ˆ

What does it do

We freeze weights of a pre-trained BERT and we fine-prune it on a gender debiasing loss. Optimized are only the pruning scores -- they act a gate to the BERT's weights. We utilzie block movement pruning.

Reproducibility

Setup

conda env create -f envs/pruning-bias.yaml
conda activate debias
pip uninstall nn_pruning
pip install git+https://github.com/[anonymized]/nn_pruning.git@automodel

Block pruning

python run.py --multirun \
    experiment=debias_block_pruning_frozen \
    model.embedding_layer=last,all \
    model.debias_mode=sentence,token \
    prune_block_size=32,64

Pruning enitre heads

python run.py --multirun \
    experiment=debias_head_pruning_frozen_values_only \
    model.embedding_layer=last,all \
    model.debias_mode=sentence,token

Debiasing-only:

python run.py --multirun \
    model.embedding_layer=first,last,all,intermediate \
    model.debias_mode=sentence,token
  • The first run will download, process, and cache datasets.
  • By default, debiasing will run on a single GPU. For more options, see configs.
  • We use run_glue.py to evaluate GLUE. To evaluate pruned models, we manually load the pruning scores state dicts.

Credits

  • Block pruning:
@article{Lagunas2021BlockPF,
  title={Block Pruning For Faster Transformers},
  author={Franccois Lagunas and Ella Charlaix and Victor Sanh and Alexander M. Rush},
  journal={ArXiv},
  year={2021},
  volume={abs/2109.04838}
}
  • The original debiaing idea:
@inproceedings{kaneko-bollegala-2021-context,
    title={Debiasing Pre-trained Contextualised Embeddings},
    author={Masahiro Kaneko and Danushka Bollegala},
    booktitle = {Proc. of the 16th European Chapter of the Association for Computational Linguistics (EACL)},
    year={2021}
}
  • Hydra+lightning template by ashleve.

pruning-bias's People

Contributors

kainoj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.