SkillOpt icon indicating copy to clipboard operation
SkillOpt copied to clipboard

OfficeQA drops a numeric 0 gold answer when loading JSON splits

Open Shizoqua opened this issue 2 weeks ago • 0 comments

_normalize_row in skillopt/envs/officeqa/dataloader.py reads the gold answer with str(row.get("ground_truth") or row.get("answer") or ""). JSON splits can store a numeric answer, and 0 or 0.0 is falsy, so it is skipped. The item loads with an empty ground_truth and no answers, and a model that answers 0 scores EM 0 and F1 0.

OfficeQA answers are mostly numbers from Treasury tables, so 0 is a plausible gold value. CSV splits are not affected, because CSV values are strings.

Steps to reproduce

import json, pathlib, tempfile
from skillopt.envs.officeqa.dataloader import OfficeQADataLoader
from skillopt.envs.officeqa.evaluator import evaluate

split = pathlib.Path(tempfile.mkdtemp()) / "val"
split.mkdir()
rows = [{"uid": "q1", "question": "How many bonds were issued?", "ground_truth": 0}]
(split / "items.json").write_text(json.dumps(rows))

for item in OfficeQADataLoader().load_split_items(str(split)):
    print(item["uid"], repr(item["ground_truth"]), item["answers"], evaluate("0", item["ground_truth"])["em"])

Expected

q1 '0' ['0'] 1.0

Actual

q1 '' [] 0.0

A 0.0 gold value is dropped the same way.

Environment

Python 3.11.18, Linux, main at 45f65ca.

Shizoqua avatar Nov 11 '26 19:11 Shizoqua