SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.08699 · ICML · 2024

Unsupervised Evaluation of Code LLMs with Round-Trip Correctness

Pengcheng Yin, Miltiadis Allamanis, Sheena Panthaplackel

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 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 1 has no contract verdict; 2 failures of our instrument; 1 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.08699.json · badge: /api/ran/2402.08699.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
codelion/optillm community
Papers with Code archive
2 ran · 0 no recorded run
google-deepmind/icml2024-roundtrip-correctness community (classifier label)
classifier basis not recorded on the link
1 ran · 1 no recorded run
FunctionStatusWhere it lives
extract_code_from_prompt Ran
ran; our contract draft was wrong, not the code
codelion/optillm/optillm/rto.py
code served (permissive licence) · get_code("7f36d35da5765481")
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 re
import logging

logger = logging.getLogger(__name__)

def extract_code_from_prompt(text):
    pattern = '```(?:[\\w-]+)?\\n(.*?)```'
    match = re.search(pattern, text, re.DOTALL)
    if match:
        return match.group(1).strip()
    else:
        logger.warning('Could not extract code from prompt. Returning original text.')
        return text

# Test case 1: text with code block
test_text_with_code = """
Here is some code:

print('hello world')
x = 42

That was the code.
"""

ARGS = {
    'text': test_text_with_code
}
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 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
get_span_with_context Ran
ran on a synthesized input
google-deepmind/icml2024-roundtrip-correctness/text_utils.py
code served (permissive licence) · get_code("f916ca93760b9f83")
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 SpanWithContext. 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 dataclasses

@dataclasses.dataclass(frozen=True)
class SpanWithContext:
    """A span with context."""
    left_context: str
    span: str
    right_context: str

# Create test file content
file_content = """Line 1: Introduction
Line 2: This is the target span location
Line 3: More content here
Line 4: Additional lines for context"""

file_bytes = file_content.encode('utf-8')

# Find positions for a span in the middle
# We want to span across "target span"
start_pos = file_bytes.find(b"target")
end_pos = file_bytes.find(b"location") + len(b"location")

ARGS = {
    "file_bytes": file_bytes,
    "start_pos": start_pos,
    "end_pos": end_pos,
    "context_chars": 50,
    "truncation_delimiter": "..."
}
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 SpanWithContext — a SpanWithContext output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SpanWithContext 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
round_trip_optimization Ran
ran; our contract draft was wrong, not the code
codelion/optillm/optillm/rto.py
code served (permissive licence) · get_code("b37b4c70bebbb0f3")
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) 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 logging
from unittest.mock import Mock, MagicMock

# Set up logging
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)

# Create a mock client that simulates OpenAI-like API responses
class MockChoice:
    def __init__(self, content, finish_reason='stop'):
        self.message = Mock()
        self.message.content = content
        self.finish_reason = finish_reason

class MockUsage:
    def __init__(self, completion_tokens=100):
        self.completion_tokens = completion_tokens

class MockResponse:
    def __init__(self, content, completion_tokens=100, finish_reason='stop'):
        self.choices = [MockChoice(content, finish_reason)]
        self.usage = MockUsage(completion_tokens)
    
    def model_dump(self):
        return {
            'choices': [{'message': {'content': self.choices[0].message.content}}],
            'usage': {'completion_tokens': self.usage.completion_tokens}
        }

class MockChatCompletion:
    def __init__(self):
        self.call_count = 0
    
    def create(self, **kwargs):
        self.call_count += 1
        if self.call_count == 1:
            # First response (C1)
            return MockResponse("```python\ndef hello():\n    return 'world'\n```", 50)
        elif self.call_count == 2:
            # Second response (Q2 - description)
            return MockResponse("Create a function that returns the string 'world'", 30)
        elif self.call_count == 3:
            # Third response (C2)
            return MockResponse("```python\ndef hello():\n    return 'world'\n```", 50)
        else:
            # Fourth response (C3 - if needed)
            return MockResponse("```python\ndef hello():\n    return 'world'\n```", 50)

class MockClient:
    def __init__(self):
        self.chat = Mock()
        self.chat.completions = MockChatCompletion()

# Create mock optillm module
class MockOptillm:
    conversation_logger = None

import sys
sys.modules['optillm'] = MockOptillm()

ARGS = {
    'system_prompt': 'You are a helpful code generation assistant.',
    'initial_query': 'Write a Python function that returns the string "world".',
    'client': MockClient(),
    'model': 'gpt-4',
    'request_config': {'max_tokens': 2048},
    'request_id': 'test-request-123'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
truncate_to_stop_token Not yet run
unverified (harvested, no recorded run)
google-deepmind/icml2024-roundtrip-correctness/llm_interface.py
code served (permissive licence) · get_code("ad751d2ae89bc365")
How it ran

no invocation recorded.

Also present in other papers' code

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

To evaluate large language models of code, research has relied on a few small manually curated benchmarks, such as HumanEval and MBPP, which represent a narrow part of the real-world software domains. In this work, we introduce round-trip correctness (RTC) as an alternative evaluation method. RTC allows Code LLM evaluation on a broader spectrum of real-world software domains without the need for costly human curation. RTC rests on the idea that we can ask a model to make a prediction (e.g., describe some code using natural language), feed that prediction back (e.g., synthesize code from the predicted description), and check if this round-trip leads to code that is semantically equivalent to the original input. We show how to employ RTC to evaluate code synthesis and editing. We find that RTC strongly correlates with model performance on existing narrow-domain code synthesis benchmarks while allowing us to expand to a much broader set of domains and tasks which was not previously possible without costly human annotations.

For agents

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

get_harvested_code_for_paper("2402.08699")
get_code_for_paper("2402.08699")
have("2402.08699")

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

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

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

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

Connect an agent — have() is free.