This repository is the official implementation of our EMNLP 2025 paper Promote, Suppress, Iterate: How Language Models Answer One-to-Many Factual Queries.
Experiments are run in:
| Package | Version |
|---|---|
| conda | 23.1.0 |
| Python | 3.8 |
| CUDA | 11.7 |
conda create -n one_to_many python=3.8
conda activate one_to_many
pip install -r requirements.txtThe datasets directory contains all the data used in the experiments with the following structure:
└── datasets
└── actor_movies
└──meta-llama/Meta-Llama-3-8B-Instruct
└──prompt_template_1
├── actor_movies_1.jsonl
├── actor_movies_2.jsonl
└── actor_movies_3.jsonl
└──prompt_template_2
└──prompt_template_3
└──mistralai/Mistral-7B-Instruct-v0.2
└── ...
└── artist_songs
└── country_cities
Each pair of dataset and model has three prompt templates. {dataset_name}_{i}.jsonl is the answer step. The datasets are also available on Hugging Face at LorenaYannnnn/how_lms_answer_one_to_many_factual_queries.
Refer to README.md for file content details and section 3.2 of the paper for dataset curation.
- Set model, dataset, prompt template, and answer step in run_main_configs.yaml. Set
exp_typeto bedecode_attn_mlp_outputs. - Run:
bash scripts/run_main.sh - Visualize results by setting model/dataset in visualize_decode_attention_mlp_output.sh and run:
Adjust visualization parameters in
bash scripts/visualize_decode_attention_mlp_output.shvisualize_token_lens_three_ans_to_layer_result()in visualize_decode_attention_mlp_outputs.py.
We follow ROME to run causal tracing experiments. All codes are in causal_tracing directory.
- Set model, dataset, prompt template, and token you want to noise (noise_subject/noise_prev_ans) in run_causal_tracing.sh.
- Run:
bash scripts/run_causal_tracing.sh - Visualize results by setting model/dataset in visualize_causal_tracing.sh and run:
bash scripts/visualize_causal_tracing.sh
- Set model, dataset, and answer step in run_main_configs.yaml. Set
exp_typeto beanalyze_critical_tokens. - Run:
bash scripts/run_main.sh - Visualize results by setting model/dataset in visualize_critical_token_outputs.sh and run:
bash scripts/visualize_critical_token_outputs.sh
- Set
exp_typeto beexamine_finegrained_attention_headin run_main_configs.yaml - Run:
bash scripts/run_main.sh - Visualize results by setting model/dataset in visualize_finegrained_attention_head_output.sh and run:
bash scripts/visualize_finegrained_attention_head_output.sh
@inproceedings{yan2025promote,
title = {Promote, Suppress, Iterate: How Language Models Answer One-to-Many Factual Queries},
author = {Yan, Tianyi Lorena and Jia, Robin},
booktitle = {Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing},
year = {2025}
}