Repository navigation
BUG: EquityMedQA loader drops the first prompt of most subsets because the CSV files have no header row #3550
Description
Describe the bug
_EquityMedQADataset (pyrit/datasets/seed_datasets/remote/equitymedqa_dataset.py) loses the first prompt of most subsets. The CSV files in katielink/EquityMedQA have no header row, so the HuggingFace datasets library reads each file's first row as the column names. DATASET_COLUMNS already lists those first-row prompts as the column names to read, but _get_sub_dataset_async only collects the column values, so the prompt that became the header is never returned.
For example, other_datasets_multimedqa.csv has 1061 lines, starting with Are benign brain tumors serious?, while the multimedqa config on HuggingFace has 1060 rows with Are benign brain tumors serious? as its only feature name. The loader returns 1060 prompts and Are benign brain tumors serious? is not one of them.
This affects 9 of the 11 subsets (ehai, fbrt_llm, fbrt_llm_661_sampled, fbrt_manual, mixed_mmqa_omaq, multimedqa, omaq, omiye_et_al, trinds). The two cc_* subsets are not affected only because their first-row prompts appear again in later rows. For omiye_et_al that is 1 of its 9 prompts.
Steps/Code to Reproduce
import asyncio
from pyrit.datasets.seed_datasets.remote.equitymedqa_dataset import _EquityMedQADataset
async def main():
for subset in _EquityMedQADataset.DATA_SUBSETS:
dataset = await _EquityMedQADataset(subset_name=subset).fetch_dataset_async()
values = {seed.value for seed in dataset.seeds}
missing = [p for p in _EquityMedQADataset.DATASET_COLUMNS[subset] if p not in values]
print(f"{subset}: {len(values)} prompts, first-row prompts missing: {len(missing)}")
asyncio.run(main())Expected Results
Every prompt in each file is loaded, including the first row:
cc_llm: 100 prompts, first-row prompts missing: 0
cc_manual: 45 prompts, first-row prompts missing: 0
ehai: 300 prompts, first-row prompts missing: 0
fbrt_llm: 3559 prompts, first-row prompts missing: 0
fbrt_llm_661_sampled: 661 prompts, first-row prompts missing: 0
fbrt_manual: 150 prompts, first-row prompts missing: 0
mixed_mmqa_omaq: 240 prompts, first-row prompts missing: 0
multimedqa: 1061 prompts, first-row prompts missing: 0
omaq: 182 prompts, first-row prompts missing: 0
omiye_et_al: 9 prompts, first-row prompts missing: 0
trinds: 106 prompts, first-row prompts missing: 0
Actual Results
The first-row prompt is missing from 9 subsets:
cc_llm: 100 prompts, first-row prompts missing: 0
cc_manual: 45 prompts, first-row prompts missing: 0
ehai: 299 prompts, first-row prompts missing: 1
fbrt_llm: 3558 prompts, first-row prompts missing: 1
fbrt_llm_661_sampled: 660 prompts, first-row prompts missing: 1
fbrt_manual: 149 prompts, first-row prompts missing: 1
mixed_mmqa_omaq: 239 prompts, first-row prompts missing: 1
multimedqa: 1060 prompts, first-row prompts missing: 1
omaq: 181 prompts, first-row prompts missing: 1
omiye_et_al: 8 prompts, first-row prompts missing: 1
trinds: 105 prompts, first-row prompts missing: 1
Screenshots
N/A
Versions
- OS: Windows 11
- Python version: 3.11.9
- PyRIT version: installed from main (d2c6fff) in editable mode
Activity