Official implementation for paper Exchange of Perspective Prompting Enhances Reasoning in Large Language Models with code, prompts, model outputs.
pip install jsonlines
pip install openai
pip install jinja2The code needs to be configured with your account' secret key.
Set api_key and azure_endpoint to its value:
api_key = "Put Your Key Here"
azure_endpoint ="Put Your azure_endpoint url"We run the main with the following:
python main.py --prompt_dir [base prompt] --eng [openAI model] --seed [seed number] --hint [PHP prompt] --dataset [datasetname] --num_test -1 --q1 [ori: standard or CoT, complex: complex CoT] --q2 [ori: standard or CoT, complex: complex CoT] --sample [sample number] --temp [0.0 for greedy, 0.7 for sc]Or, we can just use the file in bash directory:
bash scripts/cot.shIf you find this work useful, please cite our paper:
@misc{sun2025exchangeperspectivepromptingenhances,
title={Exchange of Perspective Prompting Enhances Reasoning in Large Language Models},
author={Lin Sun and Can Zhang},
year={2025},
eprint={2506.03573},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2506.03573},
}