SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.01573 · 2024

Class-Level Code Generation from Natural Language Using Iterative, Tool-Enhanced Reasoning over Repository

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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 3 have no contract verdict; 0 failures of our instrument; 0 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/2405.01573.json · badge: /api/ran/2405.01573.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
microsoft/repoclassbench community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
extract_method_info Ran
ran on a synthesized input
microsoft/repoclassbench/repoclassbench/evaluator/java_evaluator.py
code served (permissive licence) · get_code("7c44da58af120b8c")
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 torch
import numpy as np

# Mock node class to simulate tree-sitter node structure
class MockNode:
    def __init__(self, node_type, text, start_point=(0, 0)):
        self.type = node_type
        self.text = text
        self.start_point = start_point
        self.children = []

# Build a mock AST node for a Java method
# The function expects a node with children of types: 'formal_parameters', 'identifier', 'block'
node = MockNode('method_declaration', '', start_point=(0, 0))

# Add identifier child (method name)
identifier_child = MockNode('identifier', b'exampleMethod', start_point=(0, 0))
node.children.append(identifier_child)

# Add formal_parameters child (method signature)
formal_params_child = MockNode('formal_parameters', b'(int x, String y)', start_point=(0, 0))
node.children.append(formal_params_child)

# Add block child (method body)
block_child = MockNode('block', b'{ return x; }', start_point=(1, 0))
node.children.append(block_child)

# Sample Java code with method definition
java_code = """public class Example {
    public int exampleMethod(int x, String y) {
        int result = x + 1;
        return result;
    }
}"""

ARGS = {
    'node': node,
    'java_code': java_code
}
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 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
filter_nodes Ran
ran on a synthesized input
microsoft/repoclassbench/repoclassbench/evaluator/java_evaluator.py
code served (permissive licence) · get_code("4b3e5e9f9e7d2f72")
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.

class MockNode:
    def __init__(self, node_type, children=None):
        self.type = node_type
        self.children = children if children is not None else []

# Build a small tree structure
leaf1 = MockNode("FunctionDef")
leaf2 = MockNode("ClassDef")
leaf3 = MockNode("VarDecl")

branch1 = MockNode("Block", children=[leaf1, leaf2])
branch2 = MockNode("Module", children=[leaf3])

root = MockNode("Root", children=[branch1, branch2])

node_types = ["FunctionDef", "ClassDef"]

ARGS = {
    "root_node": root,
    "node_types": node_types
}
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
get_method_body Ran
ran on a synthesized input
microsoft/repoclassbench/repoclassbench/evaluator/java_evaluator.py
code served (permissive licence) · get_code("881ab4691b2595de")
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

# Analyzing the function get_method_body:
# - method_name: string (method name to find)
# - line: integer (starting line number)
# - file_content: string (the file content to search through)
# 
# The function searches for a method definition and extracts its body by:
# 1. Decoding method_name if it's bytes
# 2. Starting from a given line in file_content
# 3. Finding the method_name in the text
# 4. Tracking braces to find the complete method body
# 5. Handling quoted strings to avoid counting braces inside strings

# Create sample file content with a method definition
file_content = '''public class Example {
    public void myMethod() {
        int x = 5;
        String s = "test}";
        if (true) {
            x = 10;
        }
    }
    
    public void anotherMethod() {
        return;
    }
}'''

# method_name to search for
method_name = "myMethod"

# line number to start from (1-indexed)
line = 2

ARGS = {
    "method_name": method_name,
    "line": line,
    "file_content": file_content
}
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

Also present in other papers' code

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

LLMs have demonstrated significant potential in code generation tasks, achieving promising results at the function or statement level across various benchmarks. However, the complexities associated with creating code artifacts like classes, particularly within the context of real-world software repositories, remain underexplored. Prior research treats class-level generation as an isolated task, neglecting the intricate dependencies & interactions that characterize real-world software environments. To address this gap, we introduce RepoClassBench, a comprehensive benchmark designed to rigorously evaluate LLMs in generating complex, class-level code within real-world repositories. RepoClassBench includes "Natural Language to Class generation" tasks across Java, Python & C# from a selection of repositories. We ensure that each class in our dataset not only has cross-file dependencies within the repository but also includes corresponding test cases to verify its functionality. We find that current models struggle with the realistic challenges posed by our benchmark, primarily due to their limited exposure to relevant repository contexts. To address this shortcoming, we introduce Retrieve-Repotools-Reflect (RRR), a novel approach that equips LLMs with static analysis tools to iteratively navigate & reason about repository-level context in an agent-based framework. Our experiments demonstrate that RRR significantly outperforms existing baselines on RepoClassBench, showcasing its effectiveness across programming languages & under various settings. Our findings emphasize the critical need for code-generation benchmarks to incorporate repo-level dependencies to more accurately reflect the complexities of software development. Our work shows the benefits of leveraging specialized tools to enhance LLMs' understanding of repository context. We plan to make our dataset & evaluation harness public.

For agents

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

get_harvested_code_for_paper("2405.01573")
get_code_for_paper("2405.01573")
have("2405.01573")

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

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

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

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

Connect an agent — have() is free.