SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2506.07972 · ICLR · 2025

HeuriGym: An Agentic Benchmark for LLM-Crafted Heuristics in Combinatorial Optimization

Zhiru Zhang, Chenhui Deng, Yaohui Cai, Carla Gomes, Shufeng Kong, Yingheng Wang, Jiajie Li, Hongzheng Chen, Hins Hu, Shirley Huang, Rongjian Liang, Haoxing Ren, and 1 more

arXiv · PDF · Open in the Atlas

Code that ran

7 of 12 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; 5 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/2506.07972.json · badge: /api/ran/2506.07972.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
cornell-zhang/heurigym canonical (classifier label)
classifier basis not recorded on the link
7 ran · 5 no recorded run
FunctionStatusWhere it lives
generate_summary_table Ran
ran on a synthesized input
cornell-zhang/heurigym/llm_solver_agent.py
code served (permissive licence) · get_code("45282c499a87b003")
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 str. 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

torch.manual_seed(0)

# Construct results_data - a dictionary mapping model names to their metrics
results_data = {
    "Model_A": {
        "Accuracy": 0.95,
        "Precision": 0.92,
        "Recall": 0.88,
        "F1_Score": 0.90
    },
    "Model_B": {
        "Accuracy": 0.93,
        "Precision": 0.94,
        "Recall": 0.91,
        "F1_Score": 0.92
    },
    "Model_C": {
        "Accuracy": 0.97,
        "Precision": 0.96,
        "Recall": 0.95,
        "F1_Score": 0.955
    }
}

ARGS = {
    "results_data": results_data
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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_graph Ran
ran on a synthesized input
cornell-zhang/heurigym/egraph_extraction/program/verifier.py
code served (permissive licence) · get_code("ba48fb31f2879a84")
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 json
import tempfile
import os

# Create a temporary JSON file with valid graph structure
temp_dir = tempfile.mkdtemp()
graph_path = os.path.join(temp_dir, "graph.json")

graph_data = {
    "nodes": {
        "node1": {"type": "expr", "op": "add"},
        "node2": {"type": "expr", "op": "mul"},
        "node3": {"type": "const", "value": 5}
    },
    "root_eclasses": ["eclass0", "eclass1"]
}

with open(graph_path, 'w', encoding='utf-8') as f:
    json.dump(graph_data, f)

ARGS = {
    "path": graph_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 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
load_solution Ran
ran on a synthesized input
cornell-zhang/heurigym/egraph_extraction/program/verifier.py
code served (permissive licence) · get_code("f6a39d9a77e36206")
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 list, 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 tempfile
import os

# Create a temporary file with a valid solution (list of IDs)
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "solution.txt")

# Write a list of strings to the file in a format that ast.literal_eval can parse
solution_data = ['id_1', 'id_2', 'id_3']
with open(temp_file, 'w') as f:
    f.write(str(solution_data))

ARGS = {
    'path': temp_file
}
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 list, ndim 1, dtype family float — a list 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
normalize_score Ran
ran on a synthesized input
cornell-zhang/heurigym/egraph_extraction/program/metric.py
code served (permissive licence) · get_code("0d1082ba17362e02")
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 float, 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 torch
import numpy as np

torch.manual_seed(0)

# Construct valid arguments for normalize_score
# The function takes two numeric parameters: score and baseline
# It performs comparisons and arithmetic operations on them

# Case 1: Both positive (baseline / score)
score_positive = 5.0
baseline_positive = 3.0

# Case 2: Both negative (score / baseline)
score_negative = -5.0
baseline_negative = -3.0

# We'll use the positive case for valid execution
ARGS = {
    "score": score_positive,
    "baseline": baseline_positive
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
parse_best_results Ran
ran on a synthesized input
cornell-zhang/heurigym/llm_solver_agent.py
code served (permissive licence) · get_code("9f4010a5778070cb")
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 JSON file with valid best_results data
temp_dir = tempfile.mkdtemp()
json_file_path = os.path.join(temp_dir, "best_results.json")

# Create sample best_results.json data
best_results_data = {
    "trial_1": {"cost": "0.5"},
    "trial_2": {"cost": "0.75"},
    "trial_3": {"cost": "0.25"},
    "trial_4": {"cost": "1.0"}
}

with open(json_file_path, 'w') as f:
    json.dump(best_results_data, f)

ARGS = {
    "json_file": json_file_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
read_instance Ran
ran on a synthesized input
cornell-zhang/heurigym/crew_pairing/program/utils.py
code served (permissive licence) · get_code("77d809abe68c246b")
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 Instance. 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 csv
import tempfile
from pathlib import Path
from datetime import datetime

# Create a temporary CSV file with the required columns
temp_dir = tempfile.TemporaryDirectory()
temp_file = Path(temp_dir.name) / "test_instance.csv"

# Write a valid CSV with flight leg data
csv_content = """FltNum,DptrDate,DptrTime,DptrStn,ArrvDate,ArrvTime,ArrvStn,DutyCostPerHour,ParingCostPerHour
AA100,01/15/2024,09:00,NKX,01/15/2024,11:30,PGX,150.50,120.75
AA101,01/15/2024,13:00,PGX,01/15/2024,15:45,NKX,150.50,120.75
AA102,01/16/2024,08:30,NKX,01/16/2024,10:15,PGX,,
AA103,01/16/2024,14:00,PGX,01/16/2024,16:30,NKX,,
"""

with temp_file.open('w', newline='') as f:
    f.write(csv_content)

ARGS = {
    "file_path": str(temp_file)
}
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 Instance — a Instance output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Instance 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
verify Ran
ran on a synthesized input
cornell-zhang/heurigym/egraph_extraction/program/verifier.py
code served (permissive licence) · get_code("4fa724a25bba66d7")
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 json
import tempfile
import os

# Create temporary files for input and output
temp_dir = tempfile.mkdtemp()
input_file = os.path.join(temp_dir, "graph.json")
output_file = os.path.join(temp_dir, "solution.txt")

# Create a valid graph.json file
graph_data = {
    "nodes": {
        "n1": {"eclass": "ec1", "children": []},
        "n2": {"eclass": "ec2", "children": ["n1"]},
        "n3": {"eclass": "ec3", "children": ["n2"]},
    },
    "root_eclasses": ["ec3"]
}

with open(input_file, 'w', encoding='utf-8') as f:
    json.dump(graph_data, f)

# Create a valid solution file with a valid DAG selection
# Select n3 (root ec3), n2 (child ec2), n1 (child ec1)
solution = ["n3", "n2", "n1"]

with open(output_file, 'w', encoding='utf-8') as f:
    f.write(repr(solution))

ARGS = {
    "input_file": input_file,
    "output_file": output_file,
}
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 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
calculate_cost Not yet run
unverified (harvested, no recorded run)
cornell-zhang/heurigym/config.py
code served (permissive licence) · get_code("6fcd80e8413e9b07")
How it ran

no invocation recorded.

evaluate Not yet run
unverified (harvested, no recorded run)
cornell-zhang/heurigym/global_routing/baseline/run_baseline.py
code served (permissive licence) · get_code("0a0b8626cedf1ab8")
How it ran

no invocation recorded.

get_model_pricing Not yet run
unverified (harvested, no recorded run)
cornell-zhang/heurigym/config.py
code served (permissive licence) · get_code("4ab4ed9eea06dabc")
How it ran

no invocation recorded.

greedy Not yet run
unverified (harvested, no recorded run)
cornell-zhang/heurigym/egraph_extraction/baseline/greedy_baseline.py
code served (permissive licence) · get_code("5bd4fd26f4dc8ebb")
How it ran

no invocation recorded.

run_instantgr Not yet run
unverified (harvested, no recorded run)
cornell-zhang/heurigym/global_routing/baseline/run_baseline.py
code served (permissive licence) · get_code("94646147e106b4ed")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 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 12 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

While Large Language Models (LLMs) have demonstrated significant advancements in reasoning and agent-based problem-solving, current evaluation methodologies fail to adequately assess their capabilities: existing benchmarks either rely on closed-ended questions prone to saturation and memorization, or subjective comparisons that lack consistency and rigor. In this work, we introduce HeuriGym, an agentic framework designed for evaluating heuristic algorithms generated by LLMs for combinatorial optimization problems, characterized by clearly defined objectives and expansive solution spaces. HeuriGym empowers LLMs to propose heuristics, receive evaluative feedback via code execution, and iteratively refine their solutions. We evaluate nine state-of-the-art models on various problems across domains such as computer systems, logistics, and biology, exposing persistent limitations in tool use, planning, and adaptive reasoning. To quantify performance, we propose the Quality-Yield Index (QYI), a metric that captures both solution pass rate and quality. Even top models like GPT-o4-mini-high and Gemini-2.5-Pro attain QYI scores of only 0.6, well below the expert baseline of 1. Our open-source benchmark aims to guide the development of LLMs toward more effective and realistic problem-solving in scientific and engineering domains.

For agents

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

get_harvested_code_for_paper("2506.07972")
get_code_for_paper("2506.07972")
have("2506.07972")

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

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

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

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

Connect an agent — have() is free.