math-verify
HuggingFace library for verifying mathematical answers
Decision gist · record as of 2026-08-14
Yes, with conditions. Install if you need to evaluate LLM math outputs and can work with Python >= 3.10; the package has low install friction, no known vulnerabilities, and outperforms existing evaluators on MATH dataset. Do not install if you require ongoing active development—the package is aging (last commit 2026-01-10) and may not receive rapid updates for new edge cases or datasets.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >= 3.10.
- Must specify an antlr4 runtime extra (antlr4_13_2, antlr4_11_0, or antlr4_9_3) during installation to avoid potential runtime issues.
- Low friction: pure Python wheel with a single runtime dependency (latex2sympy2_extended).
License · maintenance · safety
Apache 2.0 (permissive) — Apache 2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects that can accommodate attribution.
last release 2026-01-10 (216 days) · last repo commit 2026-01-10 · 1,177 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,283,852 downloads/mo, #2,675 on PyPI
Alternatives
Verify before relying
pip install 'math-verify[antlr4_13_2]'
from math_verify import parse, verify
gold = parse("${1,3} \\cup {2,4}$")
answer = parse("${1,2,3,4}$")
verify(gold, answer) # Returns True or False- Whether the 0.1328 MATH dataset score remains current or if newer evaluations exist.
- Performance characteristics (speed, memory) when processing large batches of answers or complex symbolic expressions.
- Stability and compatibility of the three supported antlr4 runtime versions in production environments.
What it is and what it does
Math-Verify is a mathematical expression evaluator built to assess LLM outputs on math tasks. It solves the problem that existing evaluators often fail due to strict format requirements, limited parsing, or inflexible comparison logic—sometimes underestimating model performance significantly. The package works in three stages: extracting answers from model output using regex patterns with configurable priority, parsing extracted text (including LaTeX and plain expressions) into a common SymPy representation while normalizing malformations and handling special cases like percentages and complex numbers, and finally comparing the parsed answer to a gold standard using both symbolic and numerical methods.
The parser supports three extraction targets (LaTeX, plain expressions, and literal strings) and handles a wide range of mathematical constructs: set theory, intervals, equations, inequalities, matrices, complex numbers, and relations. Comparison is intelligent—it recognizes equivalent forms (e.g., a + b equals b + a), handles precision-based numeric equality, and includes special logic for sets, intervals, and flipped inequalities. The package is designed for researchers and developers evaluating LLM math reasoning, with optional command-line tools for batch evaluation on datasets like MATH-Hard, MATH-500, GSM8K, AMC23, and AIME24.
Use it for
- Evaluate LLM outputs on standardized math benchmarks (MATH, GSM8K, AMC, AIME) to measure model reasoning accuracy.
- Grade student or model answers in educational platforms where answers may be written in multiple equivalent forms.
- Batch-process CSV files of model predictions and gold answers to identify systematic evaluation errors in existing pipelines.
- Extract and normalize mathematical answers from unstructured LLM outputs before feeding them to downstream grading systems.
- Compare symbolic expressions for equivalence in automated homework or quiz systems that accept multiple valid forms.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
Install if you need to evaluate LLM math outputs and can work with Python >= 3.10; the package has low install friction, no known vulnerabilities, and outperforms existing evaluators on MATH dataset. Do not install if you require ongoing active development—the package is aging (last commit 2026-01-10) and may not receive rapid updates for new edge cases or datasets.
Install
math-verify on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (latex2sympy2_extended). Maintenance status is aging—last commit 2026-01-10—but the package is actively used (top 5000 on PyPI) and carries no known vulnerabilities.
Requires Python >= 3.10. Must specify an antlr4 runtime extra (antlr4_13_2, antlr4_11_0, or antlr4_9_3) during installation to avoid potential runtime issues.
License in practice
Apache 2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects that can accommodate attribution.
Quickstart
pip install 'math-verify[antlr4_13_2]'
from math_verify import parse, verify
gold = parse("${1,3} \\cup {2,4}$")
answer = parse("${1,2,3,4}$")
verify(gold, answer) # Returns True or False
Verify before relying
- Whether the 0.1328 MATH dataset score remains current or if newer evaluations exist.
- Performance characteristics (speed, memory) when processing large batches of answers or complex symbolic expressions.
- Stability and compatibility of the three supported antlr4 runtime versions in production environments.
Package facts
| License | Apache 2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagelatex2sympy2_extended |
| Maintenance | Aging 216 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,283,852 / month, #2,675 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: math_verify-0.9.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “math answer verification”
- math-verifyEvaluates mathematical expressions from LLM outputs by parsing LaTeX…
- django-mathfiltersProvides Django template filters for basic arithmetic…
- reasoning-gymReasoning Gym generates procedurally verifiable reasoning datasets…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also latex2sympy2 · latex2sympy2-extended · py-expression-eval · simple-equ · uncertainties · sybil · latex2mathml · pysr · sphinx-math-dollar · sphinxcontrib-jsmath