Skip to content

fix(assistantbench): score empty dicts and mixed lists instead of crashing - #419

Open
damienen wants to merge 1 commit into
ServiceNow:mainfrom
damienen:fix/browsergym-04
Open

damienen wants to merge 1 commit into
ServiceNow:mainfrom
damienen:fix/browsergym-04

Conversation

@damienen

@damienen damienen commented Nov 2, 2026

Copy link
Copy Markdown

Fixes #418

Problem

With a dict gold answer, question_scorer raised instead of returning a score:

  • A prediction of {} makes calc_recall average an empty list. The NaN reaches the alignment step, which raises ValueError: matrix contains invalid numeric entries.
  • A prediction like [{"sender": "USPS", ...}, "maybe FedEx"] passes the type(pred[0]) == dict check in evaluate_dicts, then .get is called on the string and raises AttributeError.

Change

  • calc_recall returns 0 when there is nothing to compare.
  • evaluate_dicts requires every element of a list prediction to be a dict, and scores 0 otherwise, as it already did when the first element was not a dict.

Testing

Ran the real question_scorer with the dict gold from the dev set in a Docker sandbox with numpy and scipy, on main at 27a90ce815098f43414e93491e06907af468e45b.

  • Without the change (exit 1): {} raises ValueError, the mixed list raises AttributeError, the matching answer scores 1.0.
  • With the change (exit 0): {} scores 0.0, the mixed list scores 0, the matching answer still scores 1.0.

tests/assistantbench/test_evaluation.py needs gymnasium and the full browsergym install, so I did not run it.

…shing

calc_recall averaged an empty list (NaN) for an empty dict, and
evaluate_dicts only checked the first list element for being a dict.
Return 0 for no keys and require every list element to be a dict.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AssistantBench: scoring a dict answer crashes on "{}" and on lists that mix dicts with other values

1 participant