Papers › Large Language Models of Code Fail at Completing Code with Potential Bugs

Large Language Models of Code Fail at Completing Code with Potential Bugs

6 Jun 2023NeurIPS 2023 11arXiv:2306.03438archive 2025-07-28

Tuan Dinh, Jinman Zhao, Samson Tan, Renato Negrinho, Leonard Lausen, Sheng Zha, George Karypis

Large language models of code (Code-LLMs) have recently brought tremendous advances to code completion, a fundamental feature of programming assistance and code intelligence. However, most existing works ignore the possible presence of bugs in the code context for generation, which are inevitable in software development. Therefore, we introduce and study the buggy-code completion problem, inspired by the realistic scenario of real-time code suggestion where the code context contains potential bugs -- anti-patterns that can become bugs in the completed program. To systematically study the task, we introduce two datasets: one with synthetic bugs derived from semantics-altering operator changes (buggy-HumanEval) and one with realistic bugs derived from user submissions to coding problems (buggy-FixEval). We find that the presence of potential bugs significantly degrades the generation performance of the high-performing Code-LLMs. For instance, the passing rates of CODEGEN-2B-MONO on test cases of buggy-HumanEval drop more than 50% given a single potential bug in the context. Finally, we investigate several post-hoc methods for mitigating the adverse effect of potential bugs and find that there remains a significant gap in post-mitigation performance.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2306.03438")

Code

Syntology Ran 1 of 10 code samples harvested from 1 repository linked to this paper; 9 have no recorded run. Of those that ran: 1 ran · our draft was wrong.

By repository: official repository: 10 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

amazon-science/buggy-code-completion officialmentioned in papermentioned on GitHubApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

10 samples harvested; 1 ran; 0 honoured the contract we drafted; 9 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
9unverified

Licence: 0 of the 10 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from amazon-science/buggy-code-completion. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

make_sentinel amazon-science/buggy-code-completion/src/infiller/infill_ops.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · bd9a376893413836 · report
estimate_pass_at_k amazon-science/buggy-code-completion/src/metrics/evaluation.py official repository unverified Apache-2.0 (permissive) · af8375df02e6b247 · report
fix_bugs amazon-science/buggy-code-completion/src/baselines.py official repository unverified Apache-2.0 (permissive) · 7c23e2d4cbcc48a5 · report
generate_infill amazon-science/buggy-code-completion/src/infiller/infill_ops.py official repository unverified Apache-2.0 (permissive) · 950eb33619d6b1e2 · report
get_prefix amazon-science/buggy-code-completion/src/configs.py official repository unverified Apache-2.0 (permissive) · 2e44494d83f1b2ef · report
get_score amazon-science/buggy-code-completion/src/infiller/infill_line.py official repository unverified Apache-2.0 (permissive) · 5f28bf9a2c267875 · report
get_score_next_token amazon-science/buggy-code-completion/src/infiller/infill_line.py official repository unverified Apache-2.0 (permissive) · 0f6644c9346c9e3f · report
infill amazon-science/buggy-code-completion/src/infiller/infill_ops.py official repository unverified Apache-2.0 (permissive) · 04df553e86fc42e4 · report
predict_next amazon-science/buggy-code-completion/src/infiller/infill_line.py official repository unverified Apache-2.0 (permissive) · 071fba8594f05055 · report
remove_code amazon-science/buggy-code-completion/src/baselines.py official repository unverified Apache-2.0 (permissive) · a28c9b6d92999895 · report

Tasks

Code CompletionHumanEval

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections