TL;DR
Can large language models turn a mathematical definition into a Python program that actually generalizes to millions of unseen combinatorial objects? FindStatBench puts 11 leading models to the test across 2,329 tasks and over 5.5 million held-out instances—and not a single model solves half of them perfectly. Even more surprisingly, giving models more examples in the prompt can sometimes make them write worse code.
What Problem Does This Paper Address?
Most coding benchmarks test whether an LLM can write short utility functions, solve competitive programming puzzles, or navigate software repositories. Meanwhile, math benchmarks typically grade final answers or formal proofs.
FindStatBench targets a distinct, underexplored middle ground: combinatorial code synthesis. Given a mathematical description of a rule—say, computing a statistic on a permutation or mapping one type of tree to another—can a model write a single, clean Python function solve(obj) that implements that exact rule? Crucially, a plausible-looking program might pass a few small examples by luck or brute force, yet fail completely when tested on larger, more complex structures. FindStatBench tests whether models truly capture the underlying mathematical rule.
Methods
The author builds an automated, execution-based evaluation harness with a standardized solve(obj) interface, stripping away repository navigation and API boilerplate:
- Closed-book prompting: Models receive the mathematical description and up to five public input–output examples (ordered by size), with explicit source headers removed.
- Restricted execution: Generated Python functions are run in a sandboxed subprocess with an import allowlist and a 3-second timeout.
- Strict scoring: A task is only marked "solved" if the program passes every held-out instance.
- Diagnostic ablations: Beyond one-shot generation, the paper tests public-example repair (giving the model one chance to fix its code based only on public test failures, shown below), zero- vs. five-example prompts, output token budget increases, pass@k sampling, and semantic rescoring (using grammar-preserving parsers to accept equivalent representations of set partitions and binary trees).
Datasets
FindStatBench is a newly introduced, frozen evaluation corpus parsed from FindStat (the combinatorial statistics database). It spans 24 combinatorial collections (including permutations, plane partitions, Dyck paths, graphs, posets, set partitions, and binary trees) and consists of:
- 2,329 total tasks: 1,993 integer-valued statistics and 336 object-to-object maps.
- 5,517,046 held-out evaluation instances: 1,929,082 for statistics and 3,587,964 for maps.
Because FindStatBench is an evaluation-only benchmark, no training datasets are used.
Key Insights and Ideas
- Maps are consistently harder than statistics: Every single model scores lower on object-to-object maps than on integer statistics, with map-to-statistic accuracy ratios ranging from 0.62 to 0.82.
- Difficulty varies wildly by mathematical domain: All models breeze through plane partitions (scoring above 73%, with Claude Sonnet 4.6 hitting 96.9%), yet completely hit a wall on set partitions (<5%) and binary trees (<4%).
- More examples can actually hurt: Intuitively, showing examples should help. Yet on three named map tasks, Qwen3-235B achieves 100% held-out accuracy with zero examples, but drops below 13% (and fails all five public checks) when given five examples. As shown below for conjugate partitions (
Mp00044), the five-example prompt nudges the model into writing a buggy list-popping optimization that crashes with an index error.
- Models are complementary, and sampling helps: An 11-model oracle solves 60.54% of tasks—11.25 percentage points above the best single model. Similarly, drawing 5 samples from Qwen3-235B on a 497-task subset boosts task accuracy by 9.90 percentage points, showing that models often can solve these problems if given multiple shots.
Key Results
- No model solves half the tasks: Across all 2,329 tasks, Claude Sonnet 4.6 leads at 49.29% strict task accuracy (56.04% instance accuracy), followed closely by gpt-oss-120b at 49.25% (55.13% instance accuracy) and GPT-5.4-mini at 48.35%.
- Open-weight models match production APIs at a fraction of the cost: As illustrated below, gpt-oss-120b achieves virtually the same accuracy as Claude Sonnet 4.6 while costing $2.83 to run across the corpus compared to $21.96 for Sonnet.
- Repair and bigger budgets help, but don't solve the benchmark: Giving models one turn of public-example feedback on a 500-task subset (
core500) boosts task accuracy by 3.8–7.4 percentage points (e.g., GPT-5.4-mini rises from 48.20% to 55.60%), yet 44.4–70.0% of tasks remain unsolved. - Semantic equivalence isn't the culprit: Rescoring outputs with grammar-preserving parsers accepts 0.53% more instance decisions and flips 20 task outcomes, but set partitions (5.02% best instance accuracy) and binary trees (3.86%) remain nearly unsolved.
Limitations and Future Work
The author notes several important caveats:
- Implicit encodings and external references: Some FindStat descriptions reference external mathematical constructions or leave object-encoding conventions implicit, meaning failures can stem from format mismatches rather than pure algorithmic inability.
- Contamination risks: Because FindStat is publicly available online, models may have seen some underlying mathematics during pretraining.
- Uncontrolled serving environments: Comparing production APIs and open-weight endpoints involves different provider-native reasoning controls and output caps, rather than strictly matched compute.
Future work points toward better inference-time program selection (capturing the ~10+ percentage point gap revealed by the oracle and sampling experiments) and richer agentic workflows beyond single-turn public-example repair.
Summary updated