HealthContradict is a dataset for assessing how language models use contextual information to answer health questions, especially in the presence of conflicting contexts.
[https://www.nature.com/articles/s41746-025-02336-0]
HealthContradict/
├── scripts/ # All main Python scripts
│ ├── a1_pair_contradict_doc.py
│ ├── a2_create_dataset.py
│ ├── a3_create_prompt.py
│ ├── b1_inference.py
│ └── b2_eval_acc.py
├── dataset/ # Processed datasets and generated prompts
│ ├── dataset_ready.jsonl
│ ├── prompts_1.jsonl ... prompts_5.jsonl
├── doc/ # Source document CSVs
│ ├── doc-all-stance.csv
│ └── doc-contradict.csv
├── query/ # Query JSONL files
│ └── query-all.jsonl
- Install Python 3.12 and pip.
- Install dependencies:
pip install -r requirements.txt
All scripts are in the scripts/ folder. Run them from the project root:
python3 scripts/b1_inference.py --model_path <MODEL_DIR> --prompt_dir datasetRuns inference using a language model on the generated prompts.
python3 scripts/b2_eval_acc.py --base_path <RESPONSES_DIR> --num_files 5Evaluates model predictions using accuracy and F1 metrics.
doc/: Source document CSVs.query/: Queries JSONLs.dataset/: The dataset and the prompt files.
- Run
a1_pair_contradict_doc.pyanda2_create_dataset.pyto build the dataset. - Run
a3_create_prompt.pyto generate prompts. - Run
b1_inference.pyto get model responses. - Run
b2_eval_acc.pyto evaluate results.
Should you have any inquiries, feel free to contact us at boya.zhang@unige.ch