Skip to content

feat: add PutnamBench benchmark - #1115

Merged
gwarmstrong merged 5 commits into
mainfrom
stepheng/benchmark-putnam
Apr 23, 2026
Merged

gwarmstrong merged 5 commits into
mainfrom
stepheng/benchmark-putnam

Conversation

@stephencge

Copy link
Copy Markdown
Contributor

Summary

Binds the PutnamBench Lean4 formal-proof test split (660 theorems) to the existing math_formal_lean resources server and simple_agent (single-turn, matching NeMo-Skills' evaluation protocol). No new server code.

Includes

  • benchmarks/putnam_bench/ — benchmark config, prepare.py, prompts/default.yaml, README.
    • Data source: trishullab/PutnamBench at pinned commit 64cedd86ef523f3d5f5dc7a21c10e3f69564c7d4. prepare.py clones the repo into a tempdir, runs the upstream lean4/scripts/rewrite_solutions.py (which emits 660 .lean files with sorry-swapping applied), then regex-parses each into the math_formal_lean schema.
    • Prompt reuses lean4/formal-proof-deepseek-prover-v2 (same as miniF2F and MOBench) — intentionally differs from NeMo-Skills' upstream which uses lean4/formal-proof. Per user preference for consistency across the three Lean benchmarks we're porting.
    • Per-row schema {name, split, header, informal_prefix, formal_statement} — byte-identical to Skills' nemo_skills/dataset/putnam-bench/test.jsonl (verified via sorted-diff across all 660 rows). No goal field; server doesn't use it and upstream omits it.
    • prepare.py asserts exactly 660 .lean files materialize, to catch drift in either the pinned repo or the upstream rewrite_solutions.py.

Test plan

  • ng_prepare_benchmark completes the clone+subprocess+parse flow and writes 660-row JSONL byte-identical to NeMo-Skills' upstream output.
  • ng_list_benchmarks shows putnam_bench bound to putnam_bench_math_formal_lean_simple_agent with num_repeats=32.
  • Existing resources_servers/math_formal_lean tests unaffected (mocked sandbox).
  • pre-commit run --files benchmarks/putnam_bench/**/* clean.

End-to-end pass@k baseline deferred to a follow-up run with a Lean sandbox; pipeline is the same as the miniF2F port (#1111) which was validated against NeMo-Skills.

Notable difference vs. the other Lean benchmarks

Prepare is heavier than miniF2F/MOBench/ProofNet: it requires git on PATH and network access to github.com/trishullab/PutnamBench. Runs the upstream's own Python script as a subprocess in a tempdir. End-to-end prepare takes ~10s on a warm network. Pinning solves the drift concern — any change to the upstream rewrite_solutions.py behavior will trip the 660-file assertion.

🤖 Generated with Claude Code

stephencge and others added 2 commits April 22, 2026 14:16
Binds the PutnamBench Lean4 formal-proof test split (660 theorems) to the
existing `math_formal_lean` resources server and `simple_agent` (single-turn,
matching NeMo-Skills' evaluation protocol). No new server code.

## Includes

- `benchmarks/putnam_bench/` — benchmark config, `prepare.py`, `prompts/default.yaml`,
  README.
  - Data source: `trishullab/PutnamBench` at pinned commit
    `64cedd86ef523f3d5f5dc7a21c10e3f69564c7d4`. `prepare.py` clones the repo,
    runs the upstream `lean4/scripts/rewrite_solutions.py` (which emits 660
    `.lean` files with `sorry`-swapping applied), then regex-parses each into
    the `math_formal_lean` server's schema.
  - Prompt reuses `lean4/formal-proof-deepseek-prover-v2` (same as miniF2F and
    MOBench) — per user preference, not the upstream NeMo-Skills choice of
    `lean4/formal-proof`.
  - Per-row schema `{name, split, header, informal_prefix, formal_statement}`
    — byte-identical to Skills' `nemo_skills/dataset/putnam-bench/test.jsonl`
    (verified via sorted-diff across all 660 rows). No `goal` field; server
    doesn't use it and upstream omits it.
  - `prepare.py` asserts exactly 660 `.lean` files materialize, to catch drift
    in either the pinned repo or the upstream `rewrite_solutions.py`.

## Test plan

- `ng_prepare_benchmark` completes the clone+subprocess+parse flow and writes
  660-row JSONL byte-identical to NeMo-Skills' upstream.
- `ng_list_benchmarks` shows `putnam_bench` bound to
  `putnam_bench_math_formal_lean_simple_agent` with `num_repeats=32`.
- Existing `resources_servers/math_formal_lean` tests unaffected (mocked sandbox).
- `pre-commit run --files benchmarks/putnam_bench/**/*` clean.

End-to-end pass@k baseline deferred to a follow-up run with a Lean sandbox;
pipeline is the same as the miniF2F port (#1111) which was validated against
NeMo-Skills.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Stephen Ge <[email protected]>
The pinned upstream commit hash `COMMIT_HASH = "64cedd86..."` is a 40-char hex
literal and trips detect-secrets' "Hex High Entropy String" rule. The three
sibling Lean benchmarks don't hit this because their SHA is embedded inside a
raw.githubusercontent.com URL string, which the scanner treats as context.
PutnamBench uses `git clone` instead of a raw URL, so the SHA appears bare.

Adding the standard inline `pragma: allowlist secret` marker.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Stephen Ge <[email protected]>

@gwarmstrong gwarmstrong 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.

Please propagate the prompt location from #1111

stephencge and others added 2 commits April 23, 2026 14:15
Reference `benchmarks/prompts/lean4_formal_proof_deepseek_prover_v2.yaml`
(merged in via main after miniF2F #1111 landed) and delete the benchmark-local
`prompts/default.yaml`. Same content byte-for-byte; no behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: Stephen Ge <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Apr 23, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@gwarmstrong
gwarmstrong enabled auto-merge (squash) April 23, 2026 18:31
@gwarmstrong
gwarmstrong merged commit e92ed6a into main Apr 23, 2026
6 checks passed
@gwarmstrong
gwarmstrong deleted the stepheng/benchmark-putnam branch April 23, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants