Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Open compass VLMEvalKit Physics Eval Utils

From Leeroopedia
Field Value
source VLMEvalKit
domain Vision, Evaluation, Physics, LaTeX Parsing

Overview

Provides low-level LaTeX answer extraction and mathematical equivalence checking utilities used by the Physics benchmark evaluator.

Description

This module implements multiple LaTeX extraction functions: `extract_all_boxed_content` for finding all `\boxed{}` expressions using regex with nested brace support, `extract_final_answer` for single answer extraction, `extract_final_answer_list` for comma-separated list answers, and `extract_final_answer_allform` (with 30-second timeout) as the unified entry point supporting both single and list answer types. The `_extract_core_eq` function strips `\implies` and equation prefixes, and `is_equiv` provides sympy-based symbolic equivalence comparison.

Usage

Called internally by the corresponding dataset class during evaluation.

Code Reference

  • Source: vlmeval/dataset/utils/physics_eval_utils.py, Lines: L1-142
  • Import: from vlmeval.dataset.utils.physics_eval_utils import extract_final_answer_allform, is_equiv

Key Functions:

@timeout_decorator.timeout(30, use_signals=False)
def extract_final_answer_allform(latex_response, answer_type=None, ...): ...
def extract_all_boxed_content(latex_response, ...): ...
def is_equiv(expr1, expr2): ...

I/O Contract

Direction Description
Inputs LaTeX response strings containing `\boxed{}` expressions
Outputs List of extracted answer strings; boolean equivalence results

Usage Examples

from vlmeval.dataset.utils.physics_eval_utils import extract_final_answer_allform

answers = extract_final_answer_allform("\\boxed{10.2\\ \\text{eV}}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment