SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.06600 · ICML · 2021

Break-It-Fix-It: Unsupervised Learning for Program Repair

Percy Liang, Michihiro Yasunaga

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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 6 have no contract verdict; 0 failures of our instrument; 0 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/2106.06600.json · badge: /api/ran/2106.06600.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
michiyasunaga/bifi canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
check_ast_error Ran
ran on a synthesized input
michiyasunaga/bifi/utils/code_error_checker.py
code served (permissive licence) · get_code("7956f0c3ad623dc9")
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 dict. 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 ast
import sys
import traceback

def check_ast_error(codeString):
    try:
        tree = ast.parse(codeString, filename='NA')
    except SyntaxError:
        value = sys.exc_info()[1]
        tb_string = traceback.format_exc()
        msg = value.args[0]
        lineno, offset, text = (value.lineno, value.offset, value.text)
        if text is None:
            lines = codeString.splitlines()
            if len(lines) >= lineno:
                text = lines[lineno - 1]
                if sys.version_info >= (3,) and isinstance(text, bytes):
                    try:
                        text = text.decode('ascii')
                    except UnicodeDecodeError:
                        text = None
        offset -= 1
        if text is None:
            return 1
        else:
            line = text.splitlines()[-1]
            if offset is not None:
                if sys.version_info < (3, 8):
                    offset = offset - (len(text) - len(line)) + 1
            else:
                offset = 0
            err_obj = {'lineno': lineno, 'col': offset, 'line_content': line, 'msg': msg}
            return err_obj
    except Exception:
        return 1
    return 0

# Test case 1: Valid Python code (should return 0)
valid_code = "x = 5\ny = 10\nz = x + y"

# Test case 2: Invalid Python code with syntax error
invalid_code = "x = 5\nif x > 3\n    print(x)"

ARGS = {
    "codeString": invalid_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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
code_toks_to_code_string Ran
ran on a synthesized input
michiyasunaga/bifi/utils/code_utils.py
code served (permissive licence) · get_code("d31293eebb3f2fbb")
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.

from copy import deepcopy

ARGS = {
    "code_toks_joined": "def foo ( ) : <NEWLINE> <INDENT> x = <NUMBER> <NEWLINE> <DEDENT> return x",
    "anonymize_dict": {
        "foo": ["my_func"],
        "x": ["my_var", "my_var2"],
        "return": []
    }
}
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
detect_encoding Ran
ran on a synthesized input
michiyasunaga/bifi/utils/code_tokenizer.py
code served (permissive licence) · get_code("4e338ff6454175b7")
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 io

class MockFile:
    def __init__(self, lines):
        self.name = "test.py"
        self.lines = lines
        self.index = 0
    
    def readline(self):
        if self.index >= len(self.lines):
            raise StopIteration
        line = self.lines[self.index]
        self.index += 1
        return line

def create_readline_simple():
    """Create a readline function that returns lines with encoding cookie."""
    lines = [
        b"# -*- coding: utf-8 -*-\n",
        b"print('hello')\n"
    ]
    file_obj = MockFile(lines)
    return file_obj.readline

def create_readline_bom():
    """Create a readline function that starts with UTF-8 BOM."""
    lines = [
        BOM_UTF8 + b"# Some Python code\n",
        b"print('hello')\n"
    ]
    file_obj = MockFile(lines)
    return file_obj.readline

def create_readline_default():
    """Create a readline function with no encoding specification."""
    lines = [
        b"print('hello')\n",
        b"x = 42\n"
    ]
    file_obj = MockFile(lines)
    return file_obj.readline

def create_readline_latin1():
    """Create a readline function with latin-1 encoding cookie."""
    lines = [
        b"# coding: iso-8859-1\n",
        b"print('hello')\n"
    ]
    file_obj = MockFile(lines)
    return file_obj.readline

ARGS = {
    "readline": create_readline_simple()
}
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
fairseq_generate Ran
ran on a synthesized input
michiyasunaga/bifi/utils/fairseq_utils.py
code served (permissive licence) · get_code("24311a36d4c36789")
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 Popen. 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 subprocess
import tempfile
import os

ARGS = {
    'GPUs': '0',
    'preprocess_dir': '/tmp/fairseq_preprocess',
    'checkpoint_path': '/tmp/checkpoint.pt',
    'results_path': '/tmp/results.txt',
    'src': 'en',
    'tgt': 'de',
    'gen_subset': 'test',
    'beam': 5,
    'nbest': 1,
    'max_len_a': 1,
    'max_len_b': 50,
    'remove_bpe': 'sentencepiece',
    'user_dir': None,
    'use_Popen': True,
}
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 Popen — a Popen output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Popen 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
parse_fairseq_preds Ran
ran on a synthesized input
michiyasunaga/bifi/utils/fairseq_utils.py
code served (permissive licence) · get_code("0b5ffc297fbdf5da")
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.

import tempfile
import os

# Create a temporary file with fairseq-format predictions
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_path = temp_file.name

# Write sample fairseq format predictions
temp_file.write("S-0\tthe quick brown fox\n")
temp_file.write("H-0\t0.95\tle rapide brun renard\n")
temp_file.write("H-0\t0.85\tun rapide brun fox\n")
temp_file.write("S-1\tjumps over the lazy dog\n")
temp_file.write("H-1\t0.92\tsaute par-dessus le chien paresseux\n")
temp_file.close()

ARGS = {
    'pred_path': temp_path
}

# Cleanup will happen after function execution
# The file path is valid and contains properly formatted fairseq predictions
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
toks2lines Ran
ran on a synthesized input
michiyasunaga/bifi/utils/code_utils.py
code served (permissive licence) · get_code("1661aeef734f01a4")
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. 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

ARGS = {
    'code_toks_raw': [
        'def',
        'foo',
        '(',
        'x',
        ')',
        ':',
        '<NL>',
        'return',
        'x',
        '<NEWLINE>',
        'bar',
        '(',
        ')',
    ]
}
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 list — a list 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

Also present in other papers' code

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

We consider repair tasks: given a critic (e.g., compiler) that assesses the quality of an input, the goal is to train a fixer that converts a bad example (e.g., code with syntax errors) into a good one (e.g., code with no syntax errors). Existing works create training data consisting of (bad, good) pairs by corrupting good examples using heuristics (e.g., dropping tokens). However, fixers trained on this synthetically-generated data do not extrapolate well to the real distribution of bad inputs. To bridge this gap, we propose a new training approach, Break-It-Fix-It (BIFI), which has two key ideas: (i) we use the critic to check a fixer's output on real bad inputs and add good (fixed) outputs to the training data, and (ii) we train a breaker to generate realistic bad code from good code. Based on these ideas, we iteratively update the breaker and the fixer while using them in conjunction to generate more paired data. We evaluate BIFI on two code repair datasets: GitHub-Python, a new dataset we introduce where the goal is to repair Python code with AST parse errors; and DeepFix, where the goal is to repair C code with compiler errors. BIFI outperforms state-of-the-art methods, obtaining 90.5% repair accuracy on GitHub-Python (+28.5%) and 71.7% on DeepFix (+5.6%). Notably, BIFI does not require any labeled data; we hope it will be a strong starting point for unsupervised learning of various repair tasks.

For agents

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

get_harvested_code_for_paper("2106.06600")
get_code_for_paper("2106.06600")
have("2106.06600")

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

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

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

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

Connect an agent — have() is free.