Paper · 2306.03203 · ACL · 2023
A Static Evaluation of Code Completion by Large Language Models
Dan Roth, Sudipta Sengupta, Bing Xiang, Zijian Wang, Hantian Ding, Parminder Bhatia, Baishakhi Ray, Varun Kumar, Xiaopeng Li, Yuchen Tian, Krishna Ramanathan, Rob Kwiatkowski
arXiv · PDF · Open in the Atlas
Code that ran
4 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 4 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.
- 4 ran with no instrument failure
0 honoured the contract we drafted, 0 violated it, 4 have no contract verdict
- 0 ran where Syntology's instrument failed
failures of Syntology's instrument, not of the code: 0 where our contract draft was wrong, 0 where the contract check could not run
- 0 have no recorded run
- 0 of those that ran constructed an object rather than computing a result
an executed sample whose run returned an instance of its own class (fixture_out_type equals the entry name): the run built an object and did not compute a result
- 0 are pointer only: the body is not served under this paper's link
"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/2306.03203.json · badge: /api/ran/2306.03203.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.
| Repository | Role | Ran |
|---|
| PyCQA/pyflakes |
canonical (classifier label) classifier basis: census |
4 ran · 0 no recorded run |
| Function | Status | Where it lives |
|---|
| getAlternatives |
Ran ran on a synthesized input |
PyCQA/pyflakes/pyflakes/checker.py code served (permissive licence) · get_code("109b85aa8d938931") How it ranRan 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 2, 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 ast
# Create test AST nodes for the function
# Test case 1: ast.If node
if_node = ast.If(
test=ast.Constant(value=True),
body=[ast.Pass()],
orelse=[]
)
# Test case 2: ast.Try node
try_node = ast.Try(
body=[ast.Pass()],
handlers=[
ast.ExceptHandler(
type=ast.Name(id='Exception', ctx=ast.Load()),
name=None,
body=[ast.Pass()]
)
],
orelse=[ast.Pass()],
finalbody=[]
)
# Test case 3: ast.Match node (Python 3.10+)
match_node = ast.Match(
subject=ast.Constant(value=1),
cases=[
ast.match_case(
pattern=ast.MatchValue(value=ast.Constant(value=1)),
body=[ast.Pass()]
),
ast.match_case(
pattern=ast.MatchValue(value=ast.Constant(value=2)),
body=[ast.Pass()]
)
]
)
ARGS = {
"n": if_node
}
- 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 2, 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
|
| isPythonFile |
Ran ran on a synthesized input |
PyCQA/pyflakes/pyflakes/api.py code served (permissive licence) · get_code("7734738799f6eb2f") How it ranRan 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 tempfile
import os
# Create a temporary Python file with a valid shebang
temp_dir = tempfile.mkdtemp()
python_file = os.path.join(temp_dir, 'test_script.py')
with open(python_file, 'wb') as f:
f.write(b'#!/usr/bin/python3\nprint("hello")\n')
# Create a .py file
py_file = os.path.join(temp_dir, 'test.py')
with open(py_file, 'wb') as f:
f.write(b'print("test")\n')
# Create a backup file (should return False)
backup_file = os.path.join(temp_dir, 'test.txt~')
with open(backup_file, 'wb') as f:
f.write(b'some content\n')
# Create a file with valid Python shebang
shebang_file = os.path.join(temp_dir, 'executable_script')
with open(shebang_file, 'wb') as f:
f.write(b'#!/usr/bin/python3.9\nprint("test")\n')
ARGS = {
'filename': python_file
}
- 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 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
|
| iter_dict_children |
Ran ran on a synthesized input |
PyCQA/pyflakes/pyflakes/checker.py code served (permissive licence) · get_code("e1fac60c214ab3fa") How it ranRan 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 zip. 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
# Create a valid ast.Dict node
# ast.Dict has 'keys' and 'values' attributes that are lists
dict_node = ast.Dict(
keys=[ast.Constant(value='a'), ast.Constant(value='b')],
values=[ast.Constant(value=1), ast.Constant(value=2)]
)
ARGS = {
'node': dict_node
}
- 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 zip — a zip output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a zip 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_percent_format |
Ran ran on a synthesized input |
PyCQA/pyflakes/pyflakes/checker.py code served (permissive licence) · get_code("99718e5044230670") How it ranRan 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 re
import string
MAPPING_KEY_RE = re.compile('\\(([^()]*)\\)')
CONVERSION_FLAG_RE = re.compile('[#0+ -]*')
WIDTH_RE = re.compile('(?:\\*|\\d*)')
PRECISION_RE = re.compile('(?:\\.(?:\\*|\\d*))?')
LENGTH_RE = re.compile('[hlL]?')
def _must_match(regex, string, pos):
match = regex.match(string, pos)
assert match is not None
return match
def parse_percent_format(s):
"""Parses the string component of a `'...' % ...` format call
Copied from https://github.com/asottile/pyupgrade at v1.20.1
"""
def _parse_inner():
string_start = 0
string_end = 0
in_fmt = False
i = 0
while i < len(s):
if not in_fmt:
try:
i = s.index('%', i)
except ValueError:
yield (s[string_start:], None)
return
else:
string_end = i
i += 1
in_fmt = True
else:
key_match = MAPPING_KEY_RE.match(s, i)
if key_match:
key = key_match.group(1)
i = key_match.end()
else:
key = None
conversion_flag_match = _must_match(CONVERSION_FLAG_RE, s, i)
conversion_flag = conversion_flag_match.group() or None
i = conversion_flag_match.end()
width_match = _must_match(WIDTH_RE, s, i)
width = width_match.group() or None
i = width_match.end()
precision_match = _must_match(PRECISION_RE, s, i)
precision = precision_match.group() or None
i = precision_match.end()
i = _must_match(LENGTH_RE, s, i).end()
try:
conversion = s[i]
except IndexError:
raise ValueError('end-of-string while parsing format')
i += 1
fmt = (key, conversion_flag, width, precision, conversion)
yield (s[string_start:string_end], fmt)
in_fmt = False
string_start = i
if in_fmt:
raise ValueError('end-of-string while parsing format')
return tuple(_parse_inner())
ARGS = {
's': 'Hello %s world'
}
- 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
|
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-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
Large language models trained on code have shown great potential to increase productivity of software developers. Several executionbased benchmarks have been proposed to evaluate functional correctness of model-generated code on simple programming problems. Nevertheless, it is expensive to perform the same evaluation on complex real-world projects considering the execution cost. On the contrary, static analysis tools such as linters, which can detect errors without running the program, haven't been well explored for evaluating code generation models. In this work, we propose a static evaluation framework to quantify static errors in Python code completions, by leveraging Abstract Syntax Trees. Compared with executionbased evaluation, our method is not only more efficient, but also applicable to code in the wild. For experiments, we collect code context from open source repos to generate one million function bodies using public models. Our static analysis reveals that Undefined Name and Unused Variable are the most common errors among others made by language models. Through extensive studies, we also show the impact of sampling temperature, model size, and context on static errors in code completions.
For agents
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2306.03203")
get_code_for_paper("2306.03203")
have("2306.03203")
The run record, dated, one paper per request, free:
curl https://syntology.ai/api/ran/2306.03203.json
A badge for a README (the split and the date, never a ratio):
[](https://syntology.ai/paper/2306.03203)
Connect an agent — have() is free.