SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2007.03629 · 2020

Strong Generalization and Efficiency in Neural Programs

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 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 8 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-21; 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/2007.03629.json · badge: /api/ran/2007.03629.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
hardbyte/sorting-gym community (classifier label)
classifier basis not recorded on the link
8 ran · 1 no recorded run
FunctionStatusWhere it lives
bin_packing_lower_bound Ran
ran on a synthesized input
hardbyte/sorting-gym/sorting_gym/bounds.py
code served (permissive licence) · get_code("b70d684d703d7ee3")
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 int, ndim 0, dtype family int, 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)

# Based on the function signature and implementation:
# - sizes: should be an iterable of numbers that can be summed
# - bin_capacity: should be a positive integer for division

ARGS = {
    "sizes": [10, 20, 15, 5, 8],
    "bin_capacity": 25
}
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 int, ndim 0, dtype family int, 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
data_greater_than Ran
ran on a synthesized input
hardbyte/sorting-gym/sorting_gym/agents/scripted.py
code served (permissive licence) · get_code("4abf7590b6429bfd")
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 torch
import numpy as np

torch.manual_seed(0)

# The function data_greater_than accesses:
# - observation['pairwise_view_comparisons'] which should be indexable (list or array)
# - It indexes into it at offset + 5
# - The _get_pairwise_offset function computes an offset based on i, j, k parameters

# Let's trace through _get_pairwise_offset to understand what offset values we might need:
# For i=1, j=2, k=3:
#   i_jmp calculation: loop from i-1=0 down to 0 (inclusive)
#     tmpi=0: i_jmp += 3 - 1 = 2, so i_jmp = 2
#   return 2 * 6 + (2 - 1 - 1) * 6 = 12 + 0 = 12
# So offset could be 12, and we access cmps[12 + 5] = cmps[17]

# We need a pairwise_view_comparisons list that's long enough
# Let's make it accommodate reasonable i, j, k values
# Safe to make it large enough for various combinations

def compute_max_offset(max_i, max_j, max_k):
    """Compute maximum offset for given ranges"""
    max_offset = 0
    for i in range(max_i):
        for j in range(i + 1, max_j):
            i_jmp = 0
            for tmpi in range(i - 1, -1, -1):
                i_jmp += max_k - (tmpi + 1)
            offset = i_jmp * 6 + (j - i - 1) * 6
            max_offset = max(max_offset, offset)
    return max_offset

# Use moderate values
max_i, max_j, max_k = 3, 4, 5
max_offset = compute_max_offset(max_i, max_j, max_k)
required_length = max_offset + 6  # +6 because we access offset + 5

# Create observation dict with pairwise_view_comparisons
# Make it a list of values, with the last element at index required_length-1 being True/False
pairwise_comparisons = [0] * (required_length + 10)
pairwise_comparisons[17] = True  # Set a value at a computed offset location

observation = {
    'pairwise_view_comparisons': pairwise_comparisons
}

# Set up parameters for data_greater_than
i = 1
j = 2
k = 3

ARGS = {
    'observation': observation,
    'i': i,
    'j': j,
    'k': k
}
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 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
data_less_than Ran
ran on a synthesized input
hardbyte/sorting-gym/sorting_gym/agents/scripted.py
code served (permissive licence) · get_code("b285ef8446916ce8")
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 0, dtype family float; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-26T22:17:14Z. 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 numpy as np

torch.manual_seed(0)

# The function data_less_than accesses:
# - observation['pairwise_view_comparisons'] which is indexed at offset + 3
# - _get_pairwise_offset(i, j, k) which performs calculations based on i, j, k

# We need to construct valid i, j, k values and a pairwise_view_comparisons array
# Let's choose reasonable values: i=2, j=4, k=5
i = 2
j = 4
k = 5

# Calculate what offset would be for these values
i_jmp = 0
for tmpi in range(i - 1, -1, -1):
    i_jmp += k - (tmpi + 1)
offset = i_jmp * 6 + (j - i - 1) * 6

# offset should be: i_jmp = (5-1) + (5-2) = 4 + 3 = 7
# offset = 7 * 6 + (4 - 2 - 1) * 6 = 42 + 1 * 6 = 48

# We need pairwise_view_comparisons to have at least offset + 4 elements
# to safely access cmps[offset + 3]
min_length = offset + 4

# Create a pairwise_view_comparisons array with values
# The function checks cmps[offset + 3], which should be a boolean-like value
pairwise_view_comparisons = torch.zeros(min_length, dtype=torch.float32)
pairwise_view_comparisons[offset + 3] = 1.0  # Set this to 1 (True)

observation = {
    'pairwise_view_comparisons': pairwise_view_comparisons
}

ARGS = {
    'observation': observation,
    'i': i,
    'j': j,
    'k': k
}
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 Tensor, ndim 0, dtype family float — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
descents Ran
ran on a synthesized input
hardbyte/sorting-gym/sorting_gym/envs/ring.py
code served (permissive licence) · get_code("22287bda96accecb")
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 int, ndim 0, dtype family int, 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)

# The function `descents` takes an array-like object and counts adjacent drops
# when wrapping around. It needs to support:
# - len() to get the length
# - indexing with [] to access elements
# - comparison operators (>)
# - iteration via range

# Create a simple list of numbers
array = [5, 2, 8, 3, 7, 1]

ARGS = {
    "array": array
}
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 int, ndim 0, dtype family int, 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
is_rotation_of_sorted Ran
ran on a synthesized input
hardbyte/sorting-gym/sorting_gym/envs/ring.py
code served (permissive licence) · get_code("0fe8263a064edca4")
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 torch
import numpy as np

torch.manual_seed(0)

# Test case 1: A rotation of a sorted array (one descent)
# [3, 4, 5, 1, 2] - sorted rotation with descent between 5 and 1
array1 = [3, 4, 5, 1, 2]

# Test case 2: A completely sorted array (no descents)
array2 = [1, 2, 3, 4, 5]

# Test case 3: All equal elements (no descents)
array3 = [2, 2, 2, 2]

# Test case 4: Multiple descents (not a rotation of sorted)
array4 = [5, 1, 4, 2, 3]

ARGS = {
    "array": array1
}
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 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
knapsack_lp_bound Ran
ran on a synthesized input
hardbyte/sorting-gym/sorting_gym/bounds.py
code served (permissive licence) · get_code("4f93634eefffa454")
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

# The function expects:
# - items: an iterable of (weight, value) tuples
# - capacity: a numeric value representing the knapsack capacity

# Create a small set of items for testing
items = [
    (2, 10),
    (3, 15),
    (5, 20),
    (1, 5),
]

# Create a capacity value
capacity = 8

ARGS = {
    "items": items,
    "capacity": capacity,
}
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
knapsack_optimal Ran
ran on a synthesized input
hardbyte/sorting-gym/sorting_gym/bounds.py
code served (permissive licence) · get_code("0db85d6ebb107100")
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 int, ndim 0, dtype family int, 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

# Set seed for reproducibility
torch.manual_seed(0)

# The function expects:
# - items: an iterable of (weight, value) tuples
# - capacity: an integer representing the knapsack capacity

# Create a simple list of items with (weight, value) pairs
items = [
    (2, 3),    # weight=2, value=3
    (3, 4),    # weight=3, value=4
    (4, 5),    # weight=4, value=5
    (5, 6),    # weight=5, value=6
]

# Set capacity
capacity = 10

ARGS = {
    "items": items,
    "capacity": capacity,
}
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 int, ndim 0, dtype family int, 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
merge_discrete_spaces Ran
ran on a synthesized input
hardbyte/sorting-gym/sorting_gym/envs/wrappers.py
code served (permissive licence) · get_code("69c62328eecadf78")
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 MultiDiscrete. 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 numpy as np
from gymnasium import spaces

# Construct test arguments for merge_discrete_spaces
# The function expects a list of spaces (Discrete, MultiBinary, or Tuple containing those)

input_spaces = [
    spaces.Discrete(n=5),
    spaces.MultiBinary(n=3),
    spaces.MultiDiscrete(nvec=[2, 4, 3]),
    spaces.Tuple((
        spaces.Discrete(n=7),
        spaces.MultiBinary(n=2)
    ))
]

ARGS = {
    "input_spaces": input_spaces
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
gymnasium, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MultiDiscrete — a MultiDiscrete output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MultiDiscrete output the recorded ndim 1 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
v_less_than Not yet run
unverified (harvested, no recorded run)
hardbyte/sorting-gym/sorting_gym/agents/scripted.py
code served (permissive licence) · get_code("9ce0eb119558ac72")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

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

Abstract

We study the problem of learning efficient algorithms that strongly generalize in the framework of neural program induction. By carefully designing the input / output interfaces of the neural model and through imitation, we are able to learn models that produce correct results for arbitrary input sizes, achieving strong generalization. Moreover, by using reinforcement learning, we optimize for program efficiency metrics, and discover new algorithms that surpass the teacher used in imitation. With this, our approach can learn to outperform custom-written solutions for a variety of problems, as we tested it on sorting, searching in ordered lists and the NP-complete 0/1 knapsack problem, which sets a notable milestone in the field of Neural Program Induction. As highlights, our learned model can perform sorting perfectly on any input data size we tested on, with $O(n log n)$ complexity, whilst outperforming hand-coded algorithms, including quick sort, in number of operations even for list sizes far beyond those seen during training.

For agents

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

get_harvested_code_for_paper("2007.03629")
get_code_for_paper("2007.03629")
have("2007.03629")

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

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

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

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

Connect an agent — have() is free.