The top-level keys in the json file correspond to primary fields, and each data point within a field is represented as a dictionary, with the following key-value pairs:
main_entity(str): an entity from the generated entity listparametric_knowledge(str): extracted parametric knowledge about themain_entitynamed_entity_lst(lst): named entities with corresponding types returned by NER modelsconflict_generation_method(str): either "substitution" or "shuffling", representing in-domain named entity substitution and in-domain entity shuffling respectivelyentity_before(str): an entity originally presents in theparametric_knowledgebefore substitution or shufflingentity_after(str): the entity that replaces theentity_beforein cases of substitution or shufflingconflicting_knowledge(str): the conflicting knowledge created by substitution or shufflingquestion_about_conflicting_segments(str): a question related to the conflicting segments ofconflicting_knowledgequestion_about_nonconflicting_segments(str): a question related to the nonconflicting segments ofconflicting_knowledge
Install dependencies:
pip install -r requirements.txtSet your OpenAI API key:
export OPENAI_API_KEY="your_openai_api_key"The exact prompts used for all experiments are included in the prompts folder, with the corresponding samples provided in Appendix E of the paper.
You can run the experiments using the following command:
# example
python run.py \
--input_file dataset/gpt-3.5-turbo/data.json \
--prompt_file prompts/task2/zero-shot.prompt \
--output_file results/task2/zero-shot.jsonIf you have any questions or comments about our paper or data, feel free to reach out via email at [email protected]. We will do our best to respond within one business day.
If you found this work helpful, please consider starring this repository and citing our paper as shown below:
@article{wang2023resolving,
title={Resolving knowledge conflicts in large language models},
author={Wang, Yike and Feng, Shangbin and Wang, Heng and Shi, Weijia and Balachandran, Vidhisha and He, Tianxing and Tsvetkov, Yulia},
journal={arXiv preprint arXiv:2310.00935},
year={2023}
}