PoliTune: Analyzing the Impact of Data Selection and Fine-Tuning on Economic and Political Biases in Large Language Models
This repository provides training scripts for fine-tuning LLMs using our preference datasets as described in the paper.
The datasets are hosted on Hugging Face Hub. There are two preference datasets:
configs/
- Contains the training recipes for LLMs.data/
- Contains the dataset wrappers.finetune/
- Contains the fine-tuning script.
The codebase depends on torchtune and huggingface.
To fine-tune the model, follow these steps:
- Download the model weights using torchtune's
tune download
. - Ensure the configuration file under
configs/
is correctly pointing to the downloaded model. - Run the fine-tuning process using
torchtune
:For example:tune run finetune/dpo_finetune.py --config configs/<config file> checkpointer.output_dir=<path to save the fine-tuned model> output_dir=<path to save the outputs and logs> dataset._component_=<data.datasets.politune_left|data.datasets.politune_right>
tune run finetune/dpo_finetune.py --config configs/llama8b_lora_dpo_single_device.yaml checkpointer.output_dir=checkpoints/ output_dir=output/ dataset._component_=data.datasets.politune_left
If you use this codebase or the datasets in your work, please cite our paper:
@inproceedings{agiza2024politune,
title={PoliTune: Analyzing the Impact of Data Selection and Fine-Tuning on Economic and Political Biases in Large Language Models},
author={Agiza, Ahmed and Mostagir, Mohamed and Reda, Sherief},
booktitle={Proceedings of the 2024 AAAI/ACM Conference on AI, Ethics, and Society},
pages={},
year={2024}
}
MIT License. See LICENSE file