SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.02735 · 2025

FormalMATH: Benchmarking Formal Mathematical Reasoning of Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2505.02735.json · badge: /api/ran/2505.02735.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
sphere-ai-lab/formalmath-bench canonical (classifier label)
classifier basis not recorded on the link
7 ran · 1 no recorded run
FunctionStatusWhere it lives
check_correct Ran
ran on a synthesized input
sphere-ai-lab/formalmath-bench/evaluate_results.py
code served (permissive licence) · get_code("f7fa34e021f66336")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random

# The function check_correct takes:
# 1. answers: a list of dicts, each with an 'answer_bool' key
# 2. sample_size: an integer for the sample size

# Create sample answers list with dicts containing 'answer_bool' keys
answers = [
    {'answer_bool': True, 'text': 'correct'},
    {'answer_bool': False, 'text': 'incorrect'},
    {'answer_bool': True, 'text': 'correct'},
    {'answer_bool': False, 'text': 'incorrect'},
    {'answer_bool': True, 'text': 'correct'},
]

sample_size = 3

ARGS = {
    'answers': answers,
    'sample_size': sample_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_processed_items Ran
ran on a synthesized input
sphere-ai-lab/formalmath-bench/generate_answers.py
code served (permissive licence) · get_code("6122ad5dac7dcce0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned set. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

ARGS = {
    "results": [
        {
            "source": "source1",
            "refined_statement": "statement1"
        },
        {
            "source": "source2",
            "refined_statement": "statement2"
        },
        {
            "source": "source1",
            "refined_statement": "statement3"
        }
    ]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_checkpoint Ran
ran on a synthesized input
sphere-ai-lab/formalmath-bench/generate_answers.py
code served (permissive licence) · get_code("fb9704f4a410dd44")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary checkpoint file with valid JSON content
temp_dir = tempfile.mkdtemp()
checkpoint_path = os.path.join(temp_dir, "checkpoint.json")

# Write a sample checkpoint with some data
checkpoint_data = {
    "model_state": {"layer1": [1, 2, 3], "layer2": [4, 5, 6]},
    "optimizer_state": {"lr": 0.001},
    "epoch": 42
}

with open(checkpoint_path, 'w') as f:
    json.dump(checkpoint_data, f)

ARGS = {
    "checkpoint_file": checkpoint_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_progress_from_file Ran
ran on a synthesized input
sphere-ai-lab/formalmath-bench/verify_answers.py
code served (permissive licence) · get_code("1a271976c31318ca")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import os
import tempfile

# Create a temporary directory for test files
test_dir = tempfile.mkdtemp()

# Create a valid JSON file
valid_json_path = os.path.join(test_dir, "valid_progress.json")
with open(valid_json_path, 'w', encoding='utf-8') as f:
    json.dump({"epoch": 5, "loss": 0.123, "accuracy": 0.95}, f)

# ARGS dictionary with valid filepath
ARGS = {
    "filepath": valid_json_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
process_answer Ran
ran on a synthesized input
sphere-ai-lab/formalmath-bench/verify_answers.py
code served (permissive licence) · get_code("aa547b75c4c59632")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import threading
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

class MockThread:
    """Mock thread object that simulates submit_and_receive behavior."""
    
    def __init__(self, outcome_mode='success'):
        self.outcome_mode = outcome_mode
    
    def submit_and_receive(self, request_dict):
        """Mock submit_and_receive that returns different outcomes based on mode."""
        if self.outcome_mode == 'success':
            return {
                'messages': [
                    {'severity': 'info', 'text': 'All good'}
                ]
            }
        elif self.outcome_mode == 'error':
            return {
                'messages': [
                    {'severity': 'error', 'text': 'Compilation error'}
                ]
            }
        elif self.outcome_mode == 'sorries':
            return {
                'messages': [
                    {'severity': 'sorries', 'text': 'Sorry messages'}
                ]
            }
        elif self.outcome_mode == 'none':
            return None
        else:
            return {'messages': []}


item = {
    'id': 1,
    'content': 'test_item',
    'metadata': {'key': 'value'}
}

answer = """def hello():
    print("Hello, world!")
extra code here"""

autoformalization = "theorem test : True := "

thread = MockThread(outcome_mode='success')

ARGS = {
    'item': item,
    'answer': answer,
    'autoformalization': autoformalization,
    'thread': thread
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
process_single_item Ran
ran on a synthesized input
sphere-ai-lab/formalmath-bench/generate_answers.py
code served (permissive licence) · get_code("364022703da9e6db")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from unittest.mock import Mock

torch.manual_seed(0)

# Define a mock model that implements the interface expected by process_single_item
class MockLanguageModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 4)
    
    def generate(self, prompts, sampling_params, use_tqdm=False):
        # Returns a list of lists of outputs
        # Each inner list contains Output objects with .text attribute
        mock_outputs = []
        for prompt in prompts:
            batch_outputs = []
            for i in range(2):  # Simulate 2 outputs per prompt
                output = Mock()
                output.text = f"Generated text {i} for prompt"
                batch_outputs.append(output)
            mock_outputs.append(batch_outputs)
        return mock_outputs

# Create mock model instance
model = MockLanguageModel()

# Define sampling parameters (can be a dict or object with relevant attributes)
sampling_params = {
    'temperature': 0.7,
    'top_p': 0.9,
    'max_tokens': 100
}

# Create a test item
item = {
    'autoformalization': 'theorem example : True := by',
    'source': 'test_source'
}

# Define number of batches to process
num_batches = 2

ARGS = {
    'item': item,
    'sampling_params': sampling_params,
    'num_batches': num_batches
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
simulate_single Ran
ran on a synthesized input
sphere-ai-lab/formalmath-bench/evaluate_results.py
code served (permissive licence) · get_code("a3e8557fa26d12f8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random

# Construct the arguments for simulate_single
# The function expects: args = (data, sample_sizes)
# where data is a dict mapping theorem names to lists of answer dicts
# and sample_sizes is a list of integers

# Create sample data structure
data = {
    'theorem_1': [
        {'answer_bool': True},
        {'answer_bool': False},
        {'answer_bool': True},
        {'answer_bool': False},
    ],
    'theorem_2': [
        {'answer_bool': False},
        {'answer_bool': True},
    ],
    'theorem_3': [
        {'answer_bool': True},
        {'answer_bool': True},
        {'answer_bool': False},
        {'answer_bool': False},
        {'answer_bool': True},
    ],
}

# Create sample sizes to test
sample_sizes = [1, 2, 3]

# Create the args tuple as expected by simulate_single
args = (data, sample_sizes)

ARGS = {
    'args': args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
monte_carlo_evaluate Not yet run
unverified (harvested, no recorded run)
sphere-ai-lab/formalmath-bench/evaluate_results.py
code served (permissive licence) · get_code("14c5116f1bf2b4fa")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Formal mathematical reasoning remains a critical challenge for artificial intelligence, hindered by limitations of existing benchmarks in scope and scale. To address this, we present FormalMATH, a large-scale Lean4 benchmark comprising 5,560 formally verified problems spanning from high-school Olympiad challenges to undergraduate-level theorems across diverse domains (e.g., algebra, applied mathematics, calculus, number theory, and discrete mathematics). To mitigate the inefficiency of manual formalization, we introduce a novel human-in-the-loop autoformalization pipeline that integrates: (1) specialized large language models (LLMs) for statement autoformalization, (2) multi-LLM semantic verification, and (3) negation-based disproof filtering strategies using off-the-shelf LLM-based provers. This approach reduces expert annotation costs by retaining 72.09% of statements before manual verification while ensuring fidelity to the original natural-language problems. Our evaluation of state-of-the-art LLM-based theorem provers reveals significant limitations: even the strongest models achieve only 16.46% success rate under practical sampling budgets, exhibiting pronounced domain bias (e.g., excelling in algebra but failing in calculus) and over-reliance on simplified automation tactics. Notably, we identify a counterintuitive inverse relationship between natural-language solution guidance and proof success in chain-of-thought reasoning scenarios, suggesting that human-written informal reasoning introduces noise rather than clarity in the formal reasoning settings. We believe that FormalMATH provides a robust benchmark for benchmarking formal mathematical reasoning.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2505.02735")
get_code_for_paper("2505.02735")
have("2505.02735")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2505.02735.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2505.02735.svg)](https://syntology.ai/paper/2505.02735)

Connect an agent — have() is free.