evaluate_model_outputs.py: rows whose gold cannot be extracted are dropped from the accuracy denominator, so the printed accuracy disagrees with the is_correct column the script writes
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
調査の方向性
evaluate_model_outputs.py:74-112 から始め、metric.py:61-64 が例外を発生させたときに process_answers が total_count、correct_count、出力行をどのように更新するかを追跡します。Issue に記載されている bare-gold と error-row のケースを再現し、その後、コンソールの概要と CSV の is_correct の値が同じ分母を使用していることを確認します。関連する CLI の問題に対応する場合は、12 行目の --gold_is_latex の宣言も確認します。
索引モデルが issue の本文から書いたものです。
説明
evaluate_model_outputs.py:74-107 (the documented "Advanced Usage" script in the README):
grade = 0
try:
grade, extracted_answers = verify_func([row['gold']], [row['answer']])
...
total_count += 1 # :85, only reached if verify_func returned
if grade == 1:
correct_count += 1
...
except Exception as e:
results.append({
...
'is_correct': grade == 1, # grade is still 0 -> False
'error': str(e)
}) # total_count is not incremented
...
accuracy = correct_count / total_count if total_count > 0 else 0 # :112
math_metric raises ValueError("No gold targets found ...") when parse(gold) returns [] (metric.py:61-64, commented "Assert on empty gold"). That exception is caught here, the row is written to the output CSV with is_correct=False and an error value, but it is excluded from total_count. The console summary never mentions it.
Bare-number golds hit this path readily. --gold_is_latex is declared action='store_true', default=True (:12), so it is True with or without the flag and the ExprExtractionConfig() gold branch at :64 cannot be selected from the CLI. LatexExtractionConfig only matches $..$, \[..\], \(..\), \boxed{} or \frac{}{}, so a gold cell such as 42 (GSM8K/AMC style), an empty cell, or a NaN cell yields [].
Measured
Unmodified evaluate_model_outputs.py, metric.py, parser.py at ba3d3aa; process_answers called on small DataFrames. (latex2sympy2_extended is a git submodule that was not checked out, so a minimal stand-in was used for the LaTeX-to-sympy step. The failing path, no regex match giving [], never reaches it: parse('42', [LatexExtractionConfig()]) is [], parse('$42$', [LatexExtractionConfig()]) is [42, '42'].)
| Case | Rows | Printed summary | is_correct column in the output CSV |
|---|---|---|---|
control: gold in $..$, 3 right / 3 wrong |
6 | Total 6, Correct 3, 50.00% | 3/6 = 50.00%, 0 error rows |
control: examples/model_outputs.csv from the README |
6 | Total 6, Correct 6, 100.00% | 6/6, 0 error rows |
control: blank (NaN) and '' answers, gold $42$ |
2 | Total 2, Correct 0, 0.00% | 0/2 (answer-side failures are counted correctly) |
the 6 control rows + 4 wrong answers with bare gold 42 |
10 | Total 6, Correct 3, 50.00% | 3/10 = 30.00%, 4 rows with error="No gold targets found for at least one gold. Gold: ['42'], ..." |
| 1 formatted right row + 5 bare-gold rows | 6 | Total 1, Correct 1, 100.00% | 1/6 = 16.67%, 5 error rows |
| 5 wrong answers, all gold bare | 5 | Total 0, Correct 0, 0.00% | 0/5, 5 error rows |
NaN gold and '' gold + 1 right + 1 wrong |
4 | Total 2, Correct 1, 50.00% | 1/4 = 25.00%, 2 error rows |
Printed accuracy is correct / (rows - errored), which is greater than or equal to the CSV's own correct / rows, and strictly greater whenever there is at least one error row and at least one correct row. When every row errors, the script prints Accuracy: 0.00%, the same figure it prints for a model that got everything wrong.
Consequence
The number reported for a run depends on how many gold cells the extractor could not read, and nothing in the console output says so. Two runs over the same model outputs can differ by tens of points if one dataset stores golds as 42 and the other as $42$. The error column is present only in the CSV, and only on the affected rows.
Suggested fix
The same except branch already records the row as is_correct: grade == 1 (False), and metric.py:61-64 raises on purpose so that an unreadable gold is loud. The summary should follow what the row-level output already says. Smallest change: move total_count += 1 above the try: so every row is counted. A stricter variant that keeps unscorable rows out of the ratio should print how many were skipped (for example Skipped (error): N) and refuse to print an accuracy when total_count == 0, instead of the else 0 fallback. extract_answers.py shows the pattern for the failure row itself: its except branch appends a row with extraction_success: False and keeps it in the output.
Separately, --gold_is_latex can never be False as declared (store_true with default=True), so plain-number golds cannot be scored through this script. action=argparse.BooleanOptionalAction would make the flag work as its help text and the maintainer reply in #28 imply.
Happy to open the PR.
- 主要言語
- Python
- スター
- 1.2k
- フォーク
- 65
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
huggingface/Math-Verify のほかの issue
-
verify() raises ValueError comparing chained relations of different length対応中かも @chetana1410 が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
huggingface/Math-Verify#93 ·
-
A period inside the math delimiters (`$\frac{1}{3}.$`) makes correct answers fail and can make wrong ones pass対応中かも @MohammadHijjawi97 が 25 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
huggingface/Math-Verify#85 ·
-
verify() rejects a not-equal written in the other order対応中かも @chetana1410 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
huggingface/Math-Verify#100 ·
-
verify() rejects an absolute-value inequality that is the same interval対応中かも @chetana1410 が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
huggingface/Math-Verify#98 ·
-
verify() rejects equivalent chained relations written in a different order対応中かも @chetana1410 が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
huggingface/Math-Verify#96 ·
huggingface/Math-Verify の issue をすべて見る
似ている issue
-
request-theme
難易度 1/5 1時間未満 初心者へのやさしさ 66/100
LizardByte/ThemerrDB#9575 ·
メンテナーはふだん 1 日以内に返信
-
author-page correction
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
acl-org/acl-anthology#10599 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
zilliztech/memsearch#818 ·
メンテナーはふだん 1 日以内に返信
-
[FAQ] Commit ID for Projects対応中かも @github-actions が今日担当しました。 オープンfaq-proposal
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
DataTalksClub/faq#503 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
README.zh-CN/ja/es still hard-code 501 test counts after README.md went count-free対応中かも @Aaqibhafeezkhan が今日担当しました。 オープンbeginner documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
BistaDinesh03/critique#164 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信