SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.01145 · NeurIPS · 2024

ReEvo: Large Language Models as Hyper-Heuristics with Reflective Evolution

Guojie Song, Zhiguang Cao, Jinkyoo Park, Federico Berto, Haeyeon Kim, Haoran Ye, Jiarui Wang, Chuanbo Hua

arXiv · PDF · Open in the Atlas

Code that ran

5 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 4 failures of our instrument; 5 no recorded run), measured 2026-11-22; 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/2402.01145.json · badge: /api/ran/2402.01145.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
ai4co/llm-as-hh canonical (classifier label)
classifier basis: census
4 ran · 4 no recorded run
ai4co/reevo canonical (classifier label)
classifier basis: classifier_2025
1 ran · 1 no recorded run
FunctionStatusWhere it lives
BaseClient Ran
ran on a synthesized input · constructed an object; no result was computed
ai4co/reevo/reevo.py
code served (permissive licence) · get_code("baa0f6551fb92434")
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 an instance of its own class, BaseClient: the run constructed the object and did not call it, so no result was computed. 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 logging
from unittest.mock import Mock

# Setup logging
logging.basicConfig(level=logging.INFO)

# Create a mock implementation of BaseClient for testing
class MockBaseClient:
    def __init__(self, model: str, temperature: float = 1.0) -> None:
        self.model = model
        self.temperature = temperature
    
    def _chat_completion_api(self, messages: list[dict], temperature: float, n: int = 1):
        # Mock response that returns a list of mock choice objects
        mock_choices = []
        for _ in range(n):
            mock_choice = Mock()
            mock_choice.message = Mock()
            mock_choice.message.content = "Mock response"
            mock_choices.append(mock_choice)
        return mock_choices
    
    def chat_completion(self, n: int, messages: list[dict], temperature=None) -> list[dict]:
        temperature = temperature or self.temperature
        return self._chat_completion_api(messages, temperature, n)
    
    def multi_chat_completion(self, messages_list: list[list[dict]], n: int = 1, temperature=None):
        import concurrent.futures
        
        assert isinstance(messages_list, list), 'messages_list should be a list.'
        if not isinstance(messages_list[0], list):
            messages_list = [messages_list]
        if len(messages_list) > 1:
            assert n == 1, 'Currently, only n=1 is supported for multi-chat completion.'
        if 'gpt' not in self.model:
            messages_list *= n
            n = 1
        
        with concurrent.futures.ThreadPoolExecutor() as executor:
            args = [dict(n=n, messages=messages, temperature=temperature) for messages in messages_list]
            choices = executor.map(lambda p: self.chat_completion(**p), args)
        
        contents = []
        for choice in choices:
            for c in choice:
                contents.append(c.message.content)
        return contents

# Define arguments for BaseClient.__init__
ARGS = {
    "model": "gpt-4",
    "temperature": 0.7
}
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 BaseClient — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BaseClient 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
multi_head_attention Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ai4co/llm-as-hh/problems/cvrp_pomo/CVRPModel.py
pointer only (licence: MIT); the stored copy get_code serves, from SobihanSurendran/LGS, is pointer only (licence: NONE) · get_code("6dc103e776ff9eed")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from SobihanSurendran/LGS, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

multi_head_attention Ran
ran; our contract draft was wrong, not the code
ai4co/llm-as-hh/problems/cvrp_lehd/VRPModel.py
code served (permissive licence) · get_code("388642e538834053")
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 Tensor, ndim 3, dtype family float, shape (2, 4, 15) 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 torch.nn as nn

torch.manual_seed(0)

# Construct tensors for multi_head_attention
# Expected shape: (batch_size, num_heads, sequence_length, key_dim)
batch_s = 2
head_num = 3
n = 4
key_dim = 5

q = torch.randn(batch_s, head_num, n, key_dim)
k = torch.randn(batch_s, head_num, n, key_dim)
v = torch.randn(batch_s, head_num, n, key_dim)

ARGS = {
    "q": q,
    "k": k,
    "v": v
}
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 Tensor, ndim 3, dtype family float, shape (2, 4, 15) — shape (2, 4, 15) 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
multi_head_attention Ran
ran; our contract draft was wrong, not the code
ai4co/llm-as-hh/problems/tsp_lehd/TSPModel.py
code served (permissive licence) · get_code("3ce72bef872610ae")
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 Tensor, ndim 3, dtype family float, shape (2, 4, 15) 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 torch.nn as nn

torch.manual_seed(0)

# Analyze the function to determine tensor shapes:
# - q, k, v are used with .size(0), .size(1), .size(2), .size(3)
# - q and k are matmul'd with transpose: (batch, head, n, key_dim) x (batch, head, key_dim, input_s)
# - v is matmul'd with weights: (batch, head, input_s, key_dim)
# - output is reshaped to (batch, n, head * key_dim)

batch_s = 2
head_num = 3
n = 4
key_dim = 5
input_s = 6

# Create q: (batch_s, head_num, n, key_dim)
q = torch.randn(batch_s, head_num, n, key_dim)

# Create k: (batch_s, head_num, input_s, key_dim)
k = torch.randn(batch_s, head_num, input_s, key_dim)

# Create v: (batch_s, head_num, input_s, key_dim)
v = torch.randn(batch_s, head_num, input_s, key_dim)

ARGS = {
    "q": q,
    "k": k,
    "v": v,
}
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 Tensor, ndim 3, dtype family float, shape (2, 4, 15) — shape (2, 4, 15) 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
reshape_by_heads Ran
ran; our contract draft was wrong, not the code
ai4co/llm-as-hh/problems/cvrp_lehd/VRPModel.py
pointer only (licence: MIT); the stored copy get_code serves, from yihang0410/RADAR, is pointer only (licence: NONE) · get_code("459fe521069329c6")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from yihang0410/RADAR, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ReEvo Not yet run
unverified (harvested, no recorded run)
ai4co/reevo/reevo.py
code served (permissive licence) · get_code("a401fd4d14204c6f")
How it ran

no invocation recorded.

heuristics_seed Not yet run
unverified (harvested, no recorded run)
ai4co/llm-as-hh/problems/cvrp_lehd/VRPModel.py
code served (permissive licence) · get_code("4030db5033718067")
How it ran

no invocation recorded.

heuristics_seed Not yet run
unverified (harvested, no recorded run)
ai4co/llm-as-hh/problems/tsp_lehd/TSPModel.py
code served (permissive licence) · get_code("1c283fdaa36724b7")
How it ran

no invocation recorded.

seed_heuristics Not yet run
unverified (harvested, no recorded run)
ai4co/llm-as-hh/problems/cvrp_pomo/CVRPModel.py
code served (permissive licence) · get_code("c86f90cdf060dee7")
How it ran

no invocation recorded.

seed_heuristics Not yet run
unverified (harvested, no recorded run)
ai4co/llm-as-hh/problems/tsp_pomo/TSPModel.py
code served (permissive licence) · get_code("33152f946f8f0b74")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 2 the same month, 2 later) and 7 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.

FunctionAlso present inEarliest-datedOthers named
reshape_by_heads 28 other papers
10 dated earlier, 1 the same month, 15 later, 1 same year, order not determinable, 1 undated · 15 only as an assembly brick
2010.16011 (2020-10)
POMO: Policy Optimization with Multiple Optima for Reinforcement Learning
2106.11113 (2021-06)
Matrix Encoding Networks for Neural Combinatorial Optimization
2203.15386 (2022-03)
Pareto Set Learning for Neural Multi-objective Combinatorial Optimization
and 25 more not named here
multi_head_attention 13 other papers
5 dated earlier, 1 the same month, 6 later, 1 undated · 6 only as an assembly brick
2010.16011 (2020-10)
POMO: Policy Optimization with Multiple Optima for Reinforcement Learning
2203.15386 (2022-03)
Pareto Set Learning for Neural Multi-objective Combinatorial Optimization
2205.13209 (2022-05)
Sym-NCO: Leveraging Symmetricity for Neural Combinatorial Optimization
and 10 more not named here
multi_head_attention 2 other papers
2 dated earlier · 1 only as an assembly brick
2205.13225 (2022-05)
DevFormer: A Symmetric Transformer for Context-Aware Device Placement
2310.07985 (2023-10)
Neural Combinatorial Optimization with Heavy Decoder: Toward Large Scale Generalization

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-22.

Repositories linked to this paper

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

Abstract

The omnipresence of NP-hard combinatorial optimization problems (COPs) compels domain experts to engage in trial-and-error heuristic design. The long-standing endeavor of design automation has gained new momentum with the rise of large language models (LLMs). This paper introduces Language Hyper-Heuristics (LHHs), an emerging variant of Hyper-Heuristics that leverages LLMs for heuristic generation, featuring minimal manual intervention and open-ended heuristic spaces. To empower LHHs, we present Reflective Evolution (ReEvo), a novel integration of evolutionary search for efficiently exploring the heuristic space, and LLM reflections to provide verbal gradients within the space. Across five heterogeneous algorithmic types, six different COPs, and both white-box and black-box views of COPs, ReEvo yields state-of-the-art and competitive meta-heuristics, evolutionary algorithms, heuristics, and neural solvers, while being more sample-efficient than prior LHHs.

For agents

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

get_harvested_code_for_paper("2402.01145")
get_code_for_paper("2402.01145")
have("2402.01145")

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

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

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

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

Connect an agent — have() is free.