DataAgentBench icon indicating copy to clipboard operation
DataAgentBench copied to clipboard

query_imdb/query8 validator rejects the correct character spelling and requires a misspelling

Open marc-shade opened this issue 4 months ago • 0 comments

query_imdb/query8/validate.py rejects the correctly spelled character name and accepts only a misspelling, because its normalize() maps an apostrophe to a space while the check searches for a literal with no space.

Verified on main @ 9ed8bdde3.

The cause

def normalize(text):
    ...
    text = re.sub(r"[^a-z0-9\s]", " ", text.lower())   # apostrophe becomes a SPACE
    ...

if "cockamamies salesgirl" not in llm_norm:            # literal has NO space
    return False, "Character name 'Cockamamie\\'s Salesgirl' not found in LLM output."

The ground truth for this field is "Cockamamie's" Salesgirl. Running the validator's own normalize() over it yields cockamamie s salesgirl, which never equals the literal cockamamies salesgirl it searches for.

Note the actress clause immediately below uses the correct pattern, normalize("Aaron, Caroline") not in llm_norm; only the character clause hardcodes a pre-normalized string.

Observed behaviour

Holding every other clause satisfied and varying only the character name:

character name in answer result
"Cockamamie's" Salesgirl (correct, matches ground truth) fail
the exact ground_truth.csv field text fail
Cockamamies Salesgirl (misspelled) PASS

So the query is only passable by an agent that omits the apostrophe. An agent that copies the name correctly out of the database is scored wrong.

This also means validate(ground_truth) is False for this query. Feeding each of the 104 validators its own ground truth, 103 accept it and this is the only one that does not.

Suggested fix

Drop apostrophes in normalize() rather than converting them to spaces. This is additive: it accepts the correct spelling and the curly ’ variant that models often emit, while still accepting the current no-apostrophe form, so no existing passing answer regresses.

def normalize(text):
    text = re.sub(r"(?<=\d),(?=\d{3}\b)", "", text)
    text = text.lower()
    text = re.sub(r"['’`]", "", text)   # "Cockamamie's" -> cockamamies
    text = re.sub(r"[^a-z0-9\s]", " ", text)
    return re.sub(r"\s+", " ", text).strip()

Measured with that change, holding other clauses fixed:

character name result
"Cockamamie's" Salesgirl PASS
“Cockamamie’s” Salesgirl (curly) PASS
Cockamamies Salesgirl PASS (unchanged)
exact ground-truth field text PASS
a different character fail (still discriminates)

Happy to send a PR.

marc-shade avatar Aug 02 '26 17:08 marc-shade