Skip to content

aix-group/llms-for-cfs

Repository files navigation

LLMs for Generating and Evaluating Counterfactuals: A Comprehensive Study

Code

Make sure to use --recurse-submodules flag to clone the submodules as well.

git clone --recurse-submodules 

Environment

We use the Mamba package manager.

mamba env create -f cfg.yml
conda activate cfg

Where is what?

  • The generated CFs can be found under ./llms/. CFs from GPT3.5/4 will be published upon approval from OpenAI (Credits for the experiments were obtained through OpenAI API Researcher Access Program).
  • GPT4 evaluation scores can be found under ./llm-eval-gpt4/
  • To run the data augmentation results use ./src/eval_augmentation.py (e.g., python eval_augmentation.py --data_origin llms/gpt3.5-20240313 --task sentiment --training_split combined --gpu 0 --model bert-base-uncased --seed 0)
  • To get the predictions using a finetuned classifier use ./src/add_preds.py (e.g., python add_preds.py --data_origin llms/llama2-20231209/ --task sentiment --training_split combined --gpu 0 --model textattack/bert-base-uncased-imdb)
  • To add perplexity use ./notebooks/add_ppl.ipynb
  • To add distance use the scripts under ./notebooks/ that start with dist
  • The CFs generation process can be found under ./src/gen_cf

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published