Skip to content

Official code for ICML 2024 paper on Persona In-Context Learning (PICLe)

Notifications You must be signed in to change notification settings

deeplearning-wisc/picle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Persona In-Context Learning (PICLe)

Official implementation of ICML 2024 paper, "PICLe: Eliciting Diverse Behaviors from Large Language Models with Persona In-Context Learning" by Hyeong Kyu Choi and Yixuan Li.

1. Setup Environment

git clone https://github.com/imhgchoi/PICLe.git
cd PICLe
conda env create -f environment.yml

2. Download LLM parameters

Download the needed LLM parameters from huggingface repos and place them in an accessible directory.

  • llama-2-7b-chat-hf ( link )
  • llama-2-13b-chat-hf ( link )
  • gpt-j-6b ( link )
  • vicuna-7b-v1.5 ( link )

3. Run Experiments

Persona SFT

Run the following command to fine-tune the Llama-2 model. Specify the directory where you saved the downloaded LLM parameters, [YOUR_MODEL_DIR], and the directory you would want to save your learned SFT model parameters, [YOUR_OUTPUT_DIR]. Insert the persona type you would want to adapt to in [PERSONA] (e.g. --target_persona narcissism). All persona types can be found here.

python src/main.py --mode persona_sft --target_persona [PERSONA] --model llama --exp_name persona_sft --output_dir [YOUR_OUTPUT_DIR] --model_dir [YOUR_MODEL_DIR] --num_epochs 4

To run this for all persona types, run

sh scripts/llama2/persona_sft.sh

Note, you need to modify the model and output directory arguments. This can be done similarly with other LLMs: llama2-large, vicuna, gptj.

Persona In-Context Learning (PICLe)

To apply PICLe to a target [PERSONA], run

python src/main.py --mode picle --target_persona [PERSONA] --model llama --exp_name PICLe --likelihood_func diff  --output_dir [YOUR_OUTPUT_DIR] --model_dir [YOUR_MODEL_DIR] --likelihood_use_epoch 4 --verbose

To run across all persona types, run

sh scripts/llama2/picle.sh

Again, the same applies to other LLMs: llama2-large, vicuna, gptj.

Baselines

Run the shell files in the same manner. For instance, to run the similarity baseline on llama2,

sh scripts/llama2/similarity.sh

For the sampling pool refinement experiments, simply add --pos_label_sample_only to the commands. Refer to scripts/llama2/picle_plus.sh for an example.

Citation

If you find our code useful, please consider citing our paper:

@inproceedings{choi2024beyond,
      title={PICLe: Eliciting Diverse Behaviors from Large Language Models with Persona In-Context Learning}, 
      author={Hyeong Kyu Choi and Yixuan Li},
      booktitle={International Conference on Machine Learning},
      year={2024}
}

About

Official code for ICML 2024 paper on Persona In-Context Learning (PICLe)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published