SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.04349 · 2023

RLTF: Reinforcement Learning from Unit Test Feedback

arXiv · PDF · Open in the Atlas

Code that ran

6 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 0 have no contract verdict; 6 failures of our instrument; 3 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/2307.04349.json · badge: /api/ran/2307.04349.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
zyq-scut/rltf canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
FunctionStatusWhere it lives
duplicate_interleave Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zyq-scut/rltf/trainers/modeling_codegen.py
pointer only (licence: BSD-3-Clause); the stored copy get_code serves, from Cranial-XIX/longhorn, is pointer only (licence: NONE) · get_code("03e99c761c545617")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (BSD-3-Clause), but get_code serves the stored copy, first harvested from Cranial-XIX/longhorn, 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.

find_position Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zyq-scut/rltf/program_feedback.py
code served (permissive licence) · get_code("711dec582ffd3403")
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 ndarray, ndim 1, dtype family float, shape (6,) 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 numpy as np

class MockTokenizer:
    """Minimal tokenizer stand-in that implements decode()"""
    def decode(self, tokens):
        # Simple mock: convert token ids to characters
        if isinstance(tokens, (int, np.integer)):
            return chr(ord('a') + (tokens % 26))
        if isinstance(tokens, list) or isinstance(tokens, np.ndarray):
            result = ""
            for token in tokens:
                if isinstance(token, (int, np.integer)):
                    if token == -100:
                        break
                    result += chr(ord('a') + (int(token) % 26))
            return result
        return ""

# Create tokenizer instance
tokenizer = MockTokenizer()

# Create text tokens - array of token ids
text_tokens = np.array([0, 1, 2, 3, 4, 5], dtype=np.int32)

# Target text to find
tgt_text = "abc"

# Reward type - one of 'ignore', 'whole', or 'line'
reward_type = "line"

# Debug flag
debug = False

ARGS = {
    "tokenizer": tokenizer,
    "text_tokens": text_tokens,
    "tgt_text": tgt_text,
    "reward_type": reward_type,
    "debug": debug
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (6,) — shape (6,) 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
fixed_pos_embedding Ran
ran; our contract draft was wrong, not the code
zyq-scut/rltf/trainers/modeling_codegen.py
code served (permissive licence) · get_code("7ea21b9da7ef5be6")
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 3, 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

torch.manual_seed(0)

# Create a small tensor with shape (batch=2, seq_len=3, dim=4)
# The function uses x.shape[-1] for dim and x.shape[seq_dim] for seq_len
x = torch.randn(2, 3, 4)

# seq_dim parameter - which dimension contains the sequence
seq_dim = 1

# seq_len parameter - can be None (will use x.shape[seq_dim]) or explicitly set
seq_len = None

ARGS = {
    "x": x,
    "seq_dim": seq_dim,
    "seq_len": seq_len,
}
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 tuple, ndim 3, 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
generate_prompt Ran
ran; our contract draft was wrong, not the code
zyq-scut/rltf/generate.py
code served (permissive licence) · get_code("6a5218b692e1a379")
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 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
import json
import os
import tempfile

torch.manual_seed(0)

# Create temporary directory and files for testing
temp_dir = tempfile.mkdtemp()

# Create a prompt file
prompt_path = os.path.join(temp_dir, "prompt.txt")
with open(prompt_path, 'w') as f:
    f.write("Write a function that solves the problem.")

# Create a test case file with fn_name
test_case_path = os.path.join(temp_dir, "test_cases.json")
with open(test_case_path, 'w') as f:
    json.dump({"fn_name": "solve", "cases": []}, f)

# Create a solutions file
solutions_path = os.path.join(temp_dir, "solutions.txt")
with open(solutions_path, 'w') as f:
    f.write("def solve():\n    pass")

# Create a starter file
starter_path = os.path.join(temp_dir, "starter.py")
with open(starter_path, 'w') as f:
    f.write("def solve():\n    # Your code here\n    pass")

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def __init__(self):
        self.vocab_size = 1000
    
    def encode(self, text):
        return [1, 2, 3]
    
    def decode(self, tokens):
        return "decoded text"

tokenizer = MinimalTokenizer()

# Create a minimal args object
class Args:
    def __init__(self):
        self.model_name = "test_model"
        self.max_length = 512

args = Args()

ARGS = {
    "args": args,
    "test_case_path": test_case_path,
    "prompt_path": prompt_path,
    "solutions_path": solutions_path,
    "tokenizer": tokenizer,
    "starter_path": starter_path,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
generate_prompt Ran
ran; our contract draft was wrong, not the code
zyq-scut/rltf/generate_codegen.py
code served (permissive licence) · get_code("458dc199427daade")
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. 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 os
import tempfile
import json

class MockTokenizer:
    def encode(self, text, verbose=False):
        # Simple mock: return a list of token ids based on text length
        return list(range(len(text.split())))

# Create temporary files with content
temp_dir = tempfile.mkdtemp()

# Create prompt file
prompt_path = os.path.join(temp_dir, "prompt.txt")
with open(prompt_path, 'w') as f:
    f.write("Write a function that adds two numbers.")

# Create test case file with fn_name (Call-Based format)
test_case_path = os.path.join(temp_dir, "test_cases.json")
with open(test_case_path, 'w') as f:
    json.dump({"fn_name": "add", "test_cases": [{"input": [1, 2], "output": 3}]}, f)

# Create starter code file
starter_path = os.path.join(temp_dir, "starter.py")
with open(starter_path, 'w') as f:
    f.write("def add(a, b):\n    pass")

# Create solutions file (not used in function but in args)
solutions_path = os.path.join(temp_dir, "solutions.py")
with open(solutions_path, 'w') as f:
    f.write("def add(a, b):\n    return a + b")

# Mock args object
class MockArgs:
    pass

args = MockArgs()
tokenizer = MockTokenizer()

ARGS = {
    "args": args,
    "test_case_path": test_case_path,
    "prompt_path": prompt_path,
    "solutions_path": solutions_path,
    "tokenizer": tokenizer,
    "starter_path": starter_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 — a tuple output has no array shape of its own; none is 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
rotate_every_two Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
zyq-scut/rltf/trainers/modeling_codegen.py
code served (permissive licence) · get_code("621a8a98538cd46d")
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 4, dtype family float, shape (2, 3, 4, 6) 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

torch.manual_seed(0)

def rotate_every_two(x):
    x1 = x[:, :, :, ::2]
    x2 = x[:, :, :, 1::2]
    x = torch.stack((-x2, x1), dim=-1)
    return x.flatten(-2)

# The function takes a single parameter 'x' which is a tensor
# It performs slicing on dimension -1 (last dimension), so we need at least 2 elements
# It uses stack and flatten operations
# Shape: (batch, dim1, dim2, even_last_dim) for proper slicing
x = torch.randn(2, 3, 4, 6)

ARGS = {
    "x": x
}
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 4, dtype family float, shape (2, 3, 4, 6) — shape (2, 3, 4, 6) 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
generate_critic_inputs Not yet run
unverified (harvested, no recorded run)
zyq-scut/rltf/generate.py
code served (permissive licence) · get_code("cac14045f55ab553")
How it ran

no invocation recorded.

generate_critic_inputs Not yet run
unverified (harvested, no recorded run)
zyq-scut/rltf/generate_codegen.py
code served (permissive licence) · get_code("494b00b7a9873d7d")
How it ran

no invocation recorded.

load_tf_weights_in_t5 Not yet run
unverified (harvested, no recorded run)
zyq-scut/rltf/trainers/modeling_t5.py
pointer only (licence: BSD-3-Clause); the stored copy get_code serves, from suntea233/DualLoRA, is pointer only (licence: NONE) · get_code("136abfa3e8ce028d")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (BSD-3-Clause), but get_code serves the stored copy, first harvested from suntea233/DualLoRA, 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. 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, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 1 the same month, 4 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.

FunctionAlso present inEarliest-datedOthers named
load_tf_weights_in_t5 20 other papers
6 dated earlier, 14 later
2201.05966 (2022-01)
UNIFIEDSKG: Unifying and Multi-Tasking Structured Knowledge Grounding with Text-to-Text Language Models
2204.07705 (2022-04)
SUPER-NATURALINSTRUCTIONS: Generalization via Declarative Instructions on 1600+ NLP Tasks
2205.06983 (2022-05)
RASAT: Integrating Relational Structures into Pretrained Seq2Seq Model for Text-to-SQL
and 17 more not named here
duplicate_interleave 7 other papers
1 dated earlier, 1 the same month, 5 later
2206.13517 (2022-06)
ProGen2: Exploring the Boundaries of Protein Language Models
2307.08621 (2023-07)
Retentive Network: A Successor to Transformer for Large Language Models
2308.10882 (2023-08)
Giraffe: Adventures in Expanding Context Lengths in LLMs
and 4 more not named here
rotate_every_two 5 other papers
1 dated earlier, 4 later
2206.13517 (2022-06)
ProGen2: Exploring the Boundaries of Protein Language Models
2308.10882 (2023-08)
Giraffe: Adventures in Expanding Context Lengths in LLMs
2403.00818 (2024-03)
DenseMamba: State Space Models with Dense Hidden Connection for Efficient Large Language Models
and 2 more not named here
fixed_pos_embedding 3 other papers
1 dated earlier, 2 later
2206.13517 (2022-06)
ProGen2: Exploring the Boundaries of Protein Language Models
2309.01327 (2023-09)
Can I Trust Your Answer? Visually Grounded Video Question Answering
2405.00218 (2024-05)
Constrained Decoding for Secure Code Generation
generate_prompt 1 other paper
1 dated earlier
2207.01780 (2022-07)
CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning

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

The goal of program synthesis, or code generation, is to generate executable code based on given descriptions. Recently, there has been an increasing number of studies employing reinforcement learning (RL) to improve the performance of large language models (LLMs) for code. However, current representative works either rely solely on offline frameworks, limiting the exploration of new sample spaces, or fall short in the utilization of unit test signals, not accounting for specific error locations within the code. To address these issues, we propose RLTF, i.e., Reinforcement Learning from Unit Test Feedback, a novel online RL framework with unit test feedback of multi-granularity for refining code LLMs. Our approach generates data in real-time during training and simultaneously utilizes fine-grained feedback signals to guide the model towards producing higher-quality code. Extensive experiments show that RLTF achieves state-of-the-art performance on the APPS and the MBPP benchmarks. Our code is available at: https://github.com/Zyq-scut/RLTF.

For agents

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

get_harvested_code_for_paper("2307.04349")
get_code_for_paper("2307.04349")
have("2307.04349")

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

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

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

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

Connect an agent — have() is free.