Skip to content

feat(math): unify mathematical scoring with Math-Verify - #1785

Merged
Yunnglin merged 8 commits into
mainfrom
feat/math-verify-unification
Sep 28, 2026
Merged

Yunnglin merged 8 commits into
mainfrom
feat/math-verify-unification

Conversation

@Yunnglin

@Yunnglin Yunnglin commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1774
Fixes #1783

Supersedes the partial percentage fix in #1775 with shared Math-Verify grading.

Changes

EvalScope could accept numeric answers differing by 100x and award full credit for two empty answers. Mathematical extraction, parsing and equivalence now delegate to math-verify[antlr4_13_2]==0.9.0, replacing copied parsers and symbolic graders without a legacy fallback.

  • Preserve public mathematical helpers and adapter interfaces. Parse complete model outputs and standalone answer fragments appropriately, prioritize boxed answers, compare parsed objects only, and preserve percent signs for display. Empty/unparsed predictions score zero; invalid references and execution errors remain excluded before judge recall. The adapter scoring boundary also excludes extraction failures and invalid HiPhO references, persisting failed reviews while allowing subsequent samples to continue.
  • Keep HF defaults (strict=True, float_rounding=6, numeric_precision=15). 1800 vs 18 and 0.18 vs 18 do not match; 18% vs 0.18 matches. Upstream integer percentage compatibility (10 vs 10%) is retained.
  • Remove the copied general parser, AIME grader/normalizer and OlympiadBench symbolic grader. Migrate the remaining mathematical callers, including DocMath, HMMT and HiPhO, while preserving integer requirements, declared tolerances, multiple-answer organization and partial credit. DocMath's 0.15% relative tolerance remains based on the reference magnitude. Remove DocMath string eval, failed-parse-to-zero and unconditional scale matching. Choice, text and OCR scoring keep their existing paths.
  • Fix ChartQA numeric-zero handling while retaining 5% relaxed accuracy. Migrate MeasureBench numeric/fraction parsing and retain complete boxed answers, units, time/interval handling and independent unit scoring.
  • Call Math-Verify directly in the existing evaluation threads with parsing_timeout=None and timeout_seconds=None. Remove the custom subprocess pool, worker module, cross-process request schema and evaluator lifecycle hook. No mathematical hard deadline is provided.
  • Pin omegaconf==2.4.0.dev15 only in AIGC requirements. Remove redundant base ANTLR, SymPy, LaTeX and word2number declarations, and move pylatexenc to OmniDocBench optional requirements.
  • Advance evaluation versions for all 29 affected benchmarks (v1.1; OlympiadBench v1.2). Old reviews cannot be reused directly; rerun_review=True reuses saved predictions and recomputes scores.

Validation

  • 519 tests passed on macOS/Python 3.10, covering mathematical metrics, benchmark policies, judge failure handling, cache versioning, evaluator behavior and OmegaConf/LAVIS configuration and processor initialization. Includes 67 chart/instrument cases, concurrent calls that forbid subprocess creation and signal timers, HiPhO partial-credit/failure cases, DocMath tolerance boundaries, and an offline native pipeline that persists an extraction failure without aborting or inflating the aggregation denominator.
  • Replayed all 1,319 GSM8K and 500 MATH-500 samples through native adapters, aggregation and reports with four fixed output variants: 7,276 reviews. Removing subprocess execution and completing scoring failure handling change no extraction, score, status, aggregate score or effective sample count in this replay. The preceding comparison against the original grader attributed all 3,394 score changes to upstream extraction/fragment parsing or removal of unconditional 100x matching, with no unexplained changes or new scoring failures.
  • All 69 real scoring contexts across 29 benchmarks match expectations and retain their results after the execution simplification and failure-handling fixes. Eleven historical GSM8K model outputs also retain their results.
  • make lint, make lint-imports, offline test_ci_lite and isolated-environment pip check passed. Clean base/AIGC/OlympiadBench installation was verified at the preceding migration stage. No paid inference was used. One-off validation scripts, local datasets and reports are excluded from this PR.

Compatibility

The latest direct-call implementation was validated on macOS; Linux and Windows were not rerun. The external VLMEvalKit package is outside this change: ms-vlmeval==0.0.20 requires ANTLR 4.11.1, conflicting with 4.13.2, so compatibility of the vlmeval and all extras is not claimed. Fixed-output replay validates scoring, not model performance.

Copilot AI lite review requested due to automatic review settings September 28, 2026 08:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Two moderate review findings remain unresolved.

Review effort: Lite
Findings: None

What changed in this PR

This PR unifies mathematical scoring around Math-Verify, adds bounded worker execution, and updates affected benchmarks, dependencies, tests, validation tooling, and documentation.

Changes:

  • Replaces legacy mathematical parsers and graders with Math-Verify.
  • Adds worker pooling, timeout handling, cleanup, and failure management.
  • Updates benchmark versions, scoring policies, dependencies, tests, and documentation.

Review findings:

  • Moderate: HiPhO grading can abort on an unparseable reference before failure handling.
  • Moderate: Numeric Accuracy may treat complete reasoning responses as fragments.
File Reviewed change
tests/​metrics/​test_omega_aigc.py OmegaConf and AIGC compatibility tests
tests/​metrics/​test_math_verify.py Math-Verify scoring regression coverage
tests/​metrics/​test_math_runtime.py Worker runtime and failure handling tests
tests/​metrics/​test_instrument_reading.py Chart and instrument scoring tests
tests/​api/​test_math_evaluation_versions.py Evaluation version and replay tests
scripts/​validation/​update_math_docs.py Validation documentation update tooling
scripts/​validation/​report_math.py Mathematical validation reporting
scripts/​validation/​regrade_math.py Regrading validation workflow
scripts/​validation/​measure_math_runtime.py Runtime measurement tooling
scripts/​validation/​math_adapter_fixtures.py Adapter validation fixtures
requirements/​framework.txt Framework mathematical dependencies
requirements/​aigc.txt AIGC OmegaConf pin
evalscope/​metrics/​nlp/​metrics.py Shared numeric metric integration
evalscope/​metrics/​math/​worker.py Isolated Math-Verify worker
evalscope/​metrics/​math/​runtime.py Worker pool and lifecycle management
evalscope/​metrics/​math/​contracts.py Cross-process contracts
evalscope/​evaluator/​evaluator.py Mathematical worker cleanup
evalscope/​benchmarks/​tir_bench/​utils.py Shared TIR mathematical scoring
evalscope/​benchmarks/​tir_bench/​tir_bench_adapter.py TIR adapter migration
evalscope/​benchmarks/​poly_math/​poly_math_adapter.py PolyMath scoring migration
evalscope/​benchmarks/​omnidoc_bench/​legacy/​requirements.txt Optional dependency relocation
evalscope/​benchmarks/​olympiad_bench/​utils.py Olympiad scoring utilities
evalscope/​benchmarks/​olympiad_bench/​requirements.txt Olympiad dependencies
evalscope/​benchmarks/​olympiad_bench/​olympiad_bench_adapter.py Olympiad adapter migration
evalscope/​benchmarks/​minerva_math/​minerva_math_adapter.py Minerva scoring migration
evalscope/​benchmarks/​mgsm/​mgsm_adapter.py MGSM scoring migration
evalscope/​benchmarks/​measure_bench/​utils.py Shared numeric and unit parsing
evalscope/​benchmarks/​measure_bench/​measure_bench_adapter.py MeasureBench scoring migration
evalscope/​benchmarks/​math_vista/​math_vista_adapter.py MathVista scoring compatibility
evalscope/​benchmarks/​math_vision/​math_vision_adapter.py MathVision scoring compatibility
evalscope/​benchmarks/​math_verse/​math_verse_adapter.py MathVerse scoring compatibility
evalscope/​benchmarks/​math_500/​math_500_adapter.py MATH-500 scoring migration
evalscope/​benchmarks/​imo_answerbench/​imo_answerbench_adapter.py IMO AnswerBench scoring migration
evalscope/​benchmarks/​hmmt/​utils.py HMMT extraction utilities
evalscope/​benchmarks/​hmmt/​hmmt26_adapter.py HMMT 2026 adapter migration
evalscope/​benchmarks/​hmmt/​hmmt25_adapter.py HMMT 2025 adapter migration
evalscope/​benchmarks/​hmmt/​hmmt_nov25_adapter.py HMMT November 2025 adapter migration
evalscope/​benchmarks/​hipho/​utils.py HiPhO extraction utilities
evalscope/​benchmarks/​hipho/​hipho_adapter.py HiPhO Math-Verify grading
evalscope/​benchmarks/​gsm8k/​gsm8k_adapter.py GSM8K scoring migration
evalscope/​benchmarks/​gsm8k_v/​gsm8k_v_adapter.py GSM8K-V scoring migration
evalscope/​benchmarks/​gsm8k_indic/​gsm8k_indic_adapter.py Indic GSM8K scoring migration
evalscope/​benchmarks/​docmath/​utils.py DocMath extraction utilities
evalscope/​benchmarks/​docmath/​docmath_adapter.py DocMath scoring migration
evalscope/​benchmarks/​competition_math/​competition_math_adapter.py Competition Math scoring migration
evalscope/​benchmarks/​cmmu/​cmmu_adapter.py CMMU scoring migration
evalscope/​benchmarks/​cmath/​cmath_adapter.py CMATH scoring migration
evalscope/​benchmarks/​chartqa/​utils.py ChartQA numeric handling
evalscope/​benchmarks/​chartqa/​chartqa_adapter.py ChartQA scoring migration
evalscope/​benchmarks/​arxivmath/​arxivmath_adapter.py ArXivMath scoring migration
evalscope/​benchmarks/​amc/​amc_adapter.py AMC scoring migration
evalscope/​benchmarks/​aime/​math_normalize.py AIME normalization removal/update
evalscope/​benchmarks/​aime/​grader.py AIME legacy grader removal/update
evalscope/​benchmarks/​aime/​aime_adapter.py AIME scoring migration
evalscope/​benchmarks/​agieval/​agieval_adapter.py AGIEval scoring migration
evalscope/​benchmarks/​_meta/​docmath.json DocMath evaluation metadata
evalscope/​benchmarks/​_meta/​aime26.json AIME 2026 evaluation metadata
evalscope/​benchmarks/​_meta/​aime25.json AIME 2025 evaluation metadata
evalscope/​api/​metric/​exceptions.py Metric-unavailable exception handling
evalscope/​api/​benchmark/​adapters/​default_data_adapter.py Exclusion and fallback handling
docs/​zh/​benchmarks/​olympiad_bench.md Chinese Olympiad documentation
docs/​zh/​benchmarks/​docmath.md Chinese DocMath documentation
docs/​zh/​benchmarks/​aime26.md Chinese AIME 2026 documentation
docs/​zh/​benchmarks/​aime25.md Chinese AIME 2025 documentation
docs/​en/​benchmarks/​olympiad_bench.md English Olympiad documentation
docs/​en/​benchmarks/​docmath.md English DocMath documentation
docs/​en/​benchmarks/​aime26.md English AIME 2026 documentation
docs/​en/​benchmarks/​aime25.md English AIME 2025 documentation
.gitignore Local validation artifact exclusions

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Yunnglin
Yunnglin merged commit 987a843 into main Sep 28, 2026
4 checks passed
Yunnglin added a commit that referenced this pull request Oct 15, 2026
…1860)

* fix(olympiad_bench): read full-width commas in answers as separators

Chinese OlympiadBench references separate answers with a full-width
comma ('$4$,$30$'). The official judge maps ',' to ','; that mapping was
dropped when scoring moved to Math-Verify (#1785), so these references
either fail to parse and drop out of the denominator, or score 0 against
an answer written with the ASCII commas the prompt asks for. Map ',' to ','
in the reference and the prediction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(olympiad_bench): bump evaluation_version to v1.3

Full-width comma normalization changes default scoring semantics, so cached
v1.2 reviews must be invalidated and rescored.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Yunnglin <mao.looper@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants