AssistantBench number scoring returns inf for the answer "-inf" and scores above 1 for negative golds

オープン
#420 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
numpy, python
領域
testing-qa

調査の方向性

The formula lives in distance_function_log in evaluate_numbers.py, reached through question_scorer in the AssistantBench evaluation package. Read the function first, then reproduce with the script in the issue. Done means guards for non-finite and opposite-sign or negative inputs keep scores in [0, 1], and the exact-score tests in tests/assistantbench/test_evaluation.py still pass.

索引モデルが issue の本文から書いたものです。

説明

distance_function_log in evaluate_numbers.py assumes pred and gold are positive. Two cases break that:

  • The answer -inf parses as a float. np.log(gold / pred) is then log(-0.0), which is -inf, so the score is 1 - (-inf) = inf. It is not clamped to 1.
  • With a negative gold, pred > gold picks the wrong ratio, so a much larger magnitude scores better than it should. Answer -5000 against gold -5 scores 7.9.

Scores are meant to be in [0, 1], so a single inf also makes a run's mean accuracy infinite.

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")
# load only the evaluation subpackage (the package __init__ needs a browser stack)
for name, path in [("ab", base), ("ab.evaluation", base + "/evaluation")]:
    m = types.ModuleType(name); m.__path__ = [path]; sys.modules[name] = m
qs = importlib.import_module("ab.evaluation.evaluator").question_scorer
for pred, gold in [("-inf", "20"), ("-inf", "$55"), ("-5000", "-5")]:
    print(f"pred={pred!r} gold={gold!r} score={qs(pred, gold)[0]}")

Expected: a score in [0, 1] for each pair.

Actual:

pred='-inf' gold='20' score=inf
pred='-inf' gold='$55' score=inf
pred='-5000' gold='-5' score=7.907755278982137

A fix should keep the original two branches of the formula and only add guards for non-finite values and for opposite-sign or negative inputs. Rewriting it as 1 - abs(log(pred / gold)) changes the last float bits and breaks the exact score comparisons in tests/assistantbench/test_evaluation.py.

Seen on 0a785fbed075 and still present on main at 27a90ce81509.

Related

#404 and #418 report other AssistantBench scoring problems (thousands separators in fix_number, and dict or mixed list answers crashing question_scorer). This issue is about distance_function_log itself, which assumes positive numbers, so it returns inf for the answer "-inf" and scores above 1 when the gold is negative.

主要言語
Python
スター
1.4k
フォーク
202
平均マージ
6日 15時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ServiceNow/BrowserGym のほかの issue

ServiceNow/BrowserGym の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。