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

Aperta
#418 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@damienen ci sta già lavorando.

Dal 2/11/2026.

  • #419 di @damienen — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
numpy, python
Ambito
ai

Direzione di ricerca

The scorer lives in browsergym/assistantbench/src/browsergym/assistantbench/evaluation/evaluator.py, with the crashing paths in question_scorer, calc_recall and evaluate_dicts. Run the repro script from the issue against a checkout to see the three failing inputs. Pull request #419 is already open against this issue, so review it before starting. Done means all three answers return a score in [0, 1] without raising.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

question_scorer in the AssistantBench evaluator raises instead of returning a score when the gold answer is a dict and the prediction is {}, or a list whose first element is a dict but later elements are not. A model can emit either as its final answer, so validation of those tasks crashes.

Two causes:

  • calc_recall averages an empty list for {}, which gives NaN, and the alignment step then raises ValueError.
  • evaluate_dicts only checks that pred[0] is a dict, then calls .get on every element.

Repro

Needs numpy==2.1.3 scipy==1.14.1. Set SRC to a checkout of the repo.

import os, sys, types, importlib
src = os.environ.get("SRC", "src")
base = os.path.join(src, "browsergym/assistantbench/src/browsergym/assistantbench")
pkg = types.ModuleType("ab"); pkg.__path__ = [base]; sys.modules["ab"] = pkg
ev = importlib.import_module("ab.evaluation.evaluator")
gold = '{"sender": "USPS", "price (usd)": "41.75"}'
cases = ['{"sender": "USPS", "price (usd)": "41.75"}', '{}',
         '[{"sender": "USPS", "price (usd)": "41.75"}, "maybe FedEx"]']
for p in cases:
    try:
        print("OK", p, "->", ev.question_scorer(p, gold))
    except Exception as e:
        print("CRASH", p, "->", type(e).__name__, e)

Expected: a score in [0, 1] for all three answers.

Actual:

OK {"sender": "USPS", "price (usd)": "41.75"} -> (np.float64(1.0), 1.0)
CRASH {} -> ValueError matrix contains invalid numeric entries
CRASH [{"sender": "USPS", "price (usd)": "41.75"}, "maybe FedEx"] -> AttributeError 'str' object has no attribute 'get'

Seen at 0a785fbed075 and still present on main at 27a90ce81509. I have a small fix ready and can open a PR.

Lingua principale
Python
Stelle
1.4k
Fork
202
Merge medio
6g 15h
PR unite (30g)
3

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ServiceNow/BrowserGym

Tutte le issue di ServiceNow/BrowserGym

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.