GithubHelp home page GithubHelp logo

andyjliu / persona-steered-generation-bias Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 42.53 MB

Code and data that can be used to replicate results for the ACL 2024 findings paper "Evaluating Large Language Model Biases in Persona-Steered Generation".

Jupyter Notebook 80.68% Python 19.32%

persona-steered-generation-bias's Introduction

persona-steered-generation-bias

Code and data that can be used to replicate results for the ACL 2024 findings paper "Evaluating Large Language Model Biases in Persona-Steered Generation".

Setup

conda create -n persona_steered_generation python==3.11
conda activate persona_steered_generation
pip install -r requirements.txt
git clone https://github.com/tatsu-lab/opinions_qa.git
conda env config vars set OPENAI_API_KEY=<YOUR_KEY_HERE>

Evaluation

src/generate_stances.py can be used to, given an OpinionsQA survey, generate a list of stances that can be passed into a prompt for persona-steered generation; all personas are stored in src/personas_and_topics.json. Note that this script uses the OpenAI API to generate initial descriptions of each persona: we recommend verifying that persona descriptions are similar for both sides of a topic and accurately reflect the personas that they describe. It may be necessary to manually rewriting descriptions before generating data using them to avoid affecting evaluation. Once new data is generated and stored in the persona-tracking-data directory, it can be automatically evaluated for steerability using the src/persona_evaluation.py script. Metric values can then be computed with the src/analyze_experiment.py script.

Replication

The data in the persona-tracking-results directory is sourced by running our experimental analysis scripts on the corresponding data directories. The replicate_figures.ipynb notebook can then be used to replicate all results and figures from our paper.

Acknowledgements

Raw data is sourced from OpinionsQA. The LLM caricature metrics used are modified versions of those found in CoMPosT.

persona-steered-generation-bias's People

Contributors

andyjliu 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.