{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/large-language-models-of-code-fail-at","title":"Large Language Models of Code Fail at Completing Code with Potential Bugs","arxiv_id":"2306.03438","date":"2023-06-06","proceeding":"NeurIPS 2023 11","authors":["Tuan Dinh","Jinman Zhao","Samson Tan","Renato Negrinho","Leonard Lausen","Sheng Zha","George Karypis"],"abstract":"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.","url_abs":"https://arxiv.org/abs/2306.03438v2","url_pdf":"https://arxiv.org/pdf/2306.03438v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"large-language-models-of-code-fail-at","repo_url":"https://github.com/amazon-science/buggy-code-completion","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"code-completion","task_name":"Code Completion"},{"task_slug":"humaneval","task_name":"HumanEval"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2306.03438","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2306.03438"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"deterministic:regex_extraction","url":"https://github.com/amazon-science/buggy-code-completion","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_draft_wrong":1,"unverified":9},"by_repo_kind":{"official":{"samples":10,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"bd9a376893413836","entry":"make_sentinel","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/infiller/infill_ops.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/infiller/infill_ops.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bd9a376893413836"}},{"code_sha256_prefix":"af8375df02e6b247","entry":"estimate_pass_at_k","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/metrics/evaluation.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/metrics/evaluation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"af8375df02e6b247"}},{"code_sha256_prefix":"7c23e2d4cbcc48a5","entry":"fix_bugs","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/baselines.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/baselines.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"7c23e2d4cbcc48a5"}},{"code_sha256_prefix":"950eb33619d6b1e2","entry":"generate_infill","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/infiller/infill_ops.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/infiller/infill_ops.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"950eb33619d6b1e2"}},{"code_sha256_prefix":"2e44494d83f1b2ef","entry":"get_prefix","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/configs.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/configs.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2e44494d83f1b2ef"}},{"code_sha256_prefix":"5f28bf9a2c267875","entry":"get_score","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/infiller/infill_line.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/infiller/infill_line.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5f28bf9a2c267875"}},{"code_sha256_prefix":"0f6644c9346c9e3f","entry":"get_score_next_token","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/infiller/infill_line.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/infiller/infill_line.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0f6644c9346c9e3f"}},{"code_sha256_prefix":"04df553e86fc42e4","entry":"infill","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/infiller/infill_ops.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/infiller/infill_ops.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"04df553e86fc42e4"}},{"code_sha256_prefix":"071fba8594f05055","entry":"predict_next","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/infiller/infill_line.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/infiller/infill_line.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"071fba8594f05055"}},{"code_sha256_prefix":"a28c9b6d92999895","entry":"remove_code","repo":"amazon-science/buggy-code-completion","repo_kind":"official","path":"src/baselines.py","file_url":"https://github.com/amazon-science/buggy-code-completion/blob/HEAD/src/baselines.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"a28c9b6d92999895"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}