Large Language Models of Code Fail at Completing Code with Potential Bugs
Not on the map. Why?
Abstract (arXiv)
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.
Key facts. Cited by 28 papers in the map (data through 7 Oct 2026). Builds on 43 of its 75 references that are in the map. First posted on arXiv 6 Jun 2023.
Builds on
43 of 75 references.
References · 43
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2018Threat of Adversarial Attacks on Deep Learning in Computer Vision: A Surveycited by 459
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
31 more
- 2017Learning to Represent Programs with Graphscited by 219
- 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 199
- 2018SequenceR: Sequence-to-Sequence Learning for End-to-End Program Repaircited by 144
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 117
- 2018An Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translationcited by 106
- 2022Productivity Assessment of Neural Code Completioncited by 97
- 2020Graph-based, Self-Supervised Program Repair from Diagnostic Feedbackcited by 93
- 2020PyMT5: multi-mode translation of natural language and Python code with transformerscited by 80
- 2020Opportunities and Challenges in Deep Learning Adversarial Robustness: A Surveycited by 71
- 2021Break-It-Fix-It: Unsupervised Learning for Program Repaircited by 71
- 2020Code Prediction by Feeding Trees to Transformerscited by 70
- 2018Generative Code Modeling with Graphscited by 59
- 2021Self-Supervised Bug Detection and Repaircited by 59
- 2020Multi-task Learning based Pre-trained Language Model for Code Completioncited by 58
- 2020Deep Learning for Source Code Modeling and Generation: Models, Applications and Challengescited by 55
- 2017Code Completion with Neural Attention and Pointer Networkscited by 49
- 2020Semantic Robustness of Models of Source Codecited by 43
- 2019Neural Program Repair by Jointly Learning to Localize and Repaircited by 39
- 2019How Often Do Single-Statement Bugs Occur? The ManySStuBs4J Datasetcited by 35
- 2019Learning and Evaluating Contextual Embedding of Source Codecited by 33
- 2020Backdoors in Neural Models of Source Codecited by 27
- 2021Learning to Complete Code with Sketchescited by 23
- 2014Mining Idioms from Source Codecited by 19
- 2020Learning Autocompletion from Real-World Datasetscited by 19
- 2022On Distribution Shift in Learning-based Bug Detectorscited by 15
- 2023Better Context Makes Better Code Language Models: A Case Study on Function Call Argument Completioncited by 14
- 2018Learning How to Mutate Source Code from Bug-Fixescited by 13
- 2020Review4Repair: Code Review Aided Automatic Program Repairingcited by 13
- 2022HEAT: Hyperedge Attention Networkscited by 13
- 2022Can we learn from developer mistakes? Learning to localize and repair real bugs from real bug fixescited by 4
- 2021Learning to Extend Program Graphs to Work-in-Progress Codecited by 3
Built on by
Citing papers per year: 2023: 3; 2024: 9; 2025: 8; 2026: 8.
28 papers.
Sort:
By area:
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2024The RealHumanEval: Evaluating Large Language Models' Abilities to Support Programmerscited by 28
- 2024CodeMirage: Hallucinations in Code Generated by Large Language Modelscited by 23
- 2024IRCoder: Intermediate Representations Make Language Models Robust Multilingual Code Generatorscited by 21
- 2024The Counterfeit Conundrum: Can Code Language Models Grasp the Nuances of Their Incorrect Generations?cited by 20
- 2026Large Language Model Reasoning Failurescited by 20
- 2025Improving Chain-of-Thought Reasoning via Quasi-Symbolic Abstractionscited by 17
- 2023Machine-assisted quantitizing designs: augmenting humanities and social sciences with artificial intelligencecited by 13
- 2024LLMs with Industrial Lens: Deciphering the Challenges and Prospects -- A Surveycited by 12
- 2024FVEval: Understanding Language Model Capabilities in Formal Verification of Digital Hardwarecited by 9
- 2025Intuition to Evidence: Measuring AI's True Impact on Developer Productivitycited by 5
16 more
- 2024Deploying Foundation Model Powered Agent Services: A Surveycited by 4
- 2024No Size Fits All: The Perils and Pitfalls of Leveraging LLMs Vary with Company Sizecited by 3
- 2025PerfCoder: Large Language Models for Interpretable Code Performance Optimizationcited by 3
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Modelscited by 3
- 2024Envisioning the Next-Generation AI Coding Assistants: Insights & Proposalscited by 2
- 2025SOK: Exploring Hallucinations and Security Risks in AI-Assisted Software Development with Insights for LLM Deploymentcited by 2
- 2025Program Semantic Inequivalence Game with Large Language Modelscited by 1
- 2026VeriInteresting: An Empirical Study of Model Prompt Interactions in Verilog Code Generationcited by 1
- 2026Belief-Guided Inference Control for Large Language Model Services via Verifiable Observationscited by 1
- 2026ARIADNE: Agentic Reward-Informed Adaptive Decision Exploration via Blackboard-Driven MCTS for Competitive Program Generationcited by 1
- 2026On the Robustness of LLMs' Internal Representation of Code Correctnesscited by 1
- 2025LLM Based Long Code Translation using Identifier Replacementcited by 0
- 2025Learning Bug Context for PyTorch-to-JAX Translation with LLMscited by 0
- 2025DebugTA: An LLM-Based Agent for Simplifying Debugging and Teaching in Programming Educationcited by 0
- 2026Tricky2: Towards a Benchmark for Evaluating Human and LLM Error Interactionscited by 0
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Qualitycited by 0
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Quality22 Sep 2026
- 2026On the Robustness of LLMs' Internal Representation of Code Correctness8 Aug 2026
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Models30 Jun 2026
- 2026ARIADNE: Agentic Reward-Informed Adaptive Decision Exploration via Blackboard-Driven MCTS for Competitive Program Generation4 May 2026
- 2026Belief-Guided Inference Control for Large Language Model Services via Verifiable Observations30 Apr 2026
- 2026Large Language Model Reasoning Failures5 Feb 2026
- 2026VeriInteresting: An Empirical Study of Model Prompt Interactions in Verilog Code Generation4 Feb 2026
- 2026Tricky2: Towards a Benchmark for Evaluating Human and LLM Error Interactions26 Jan 2026
- 2025PerfCoder: Large Language Models for Interpretable Code Performance Optimization16 Dec 2025
- 2025DebugTA: An LLM-Based Agent for Simplifying Debugging and Teaching in Programming Education13 Oct 2025
- 2025Learning Bug Context for PyTorch-to-JAX Translation with LLMs10 Oct 2025
- 2025LLM Based Long Code Translation using Identifier Replacement10 Oct 2025
16 more
- 2025Intuition to Evidence: Measuring AI's True Impact on Developer Productivity24 Sep 2025
- 2025Program Semantic Inequivalence Game with Large Language Models2 May 2025
- 2025Improving Chain-of-Thought Reasoning via Quasi-Symbolic Abstractions18 Feb 2025
- 2025SOK: Exploring Hallucinations and Security Risks in AI-Assisted Software Development with Insights for LLM Deployment31 Jan 2025
- 2024Deploying Foundation Model Powered Agent Services: A Survey18 Dec 2024
- 2024FVEval: Understanding Language Model Capabilities in Formal Verification of Digital Hardware15 Oct 2024
- 2024CodeMirage: Hallucinations in Code Generated by Large Language Models14 Aug 2024
- 2024No Size Fits All: The Perils and Pitfalls of Leveraging LLMs Vary with Company Size21 Jul 2024
- 2024The RealHumanEval: Evaluating Large Language Models' Abilities to Support Programmers3 Apr 2024
- 2024Envisioning the Next-Generation AI Coding Assistants: Insights & Proposals21 Mar 2024
- 2024IRCoder: Intermediate Representations Make Language Models Robust Multilingual Code Generators6 Mar 2024
- 2024The Counterfeit Conundrum: Can Code Language Models Grasp the Nuances of Their Incorrect Generations?29 Feb 2024
- 2024LLMs with Industrial Lens: Deciphering the Challenges and Prospects -- A Survey22 Feb 2024
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?10 Oct 2023
- 2023Machine-assisted quantitizing designs: augmenting humanities and social sciences with artificial intelligence24 Sep 2023
- 2023Large Language Models for Software Engineering: A Systematic Literature Review21 Aug 2023
- 2024Deploying Foundation Model Powered Agent Services: A Surveycited by 4
- 2026ARIADNE: Agentic Reward-Informed Adaptive Decision Exploration via Blackboard-Driven MCTS for Competitive Program Generationcited by 1
- 2025DebugTA: An LLM-Based Agent for Simplifying Debugging and Teaching in Programming Educationcited by 0
- 2026ARIADNE: Agentic Reward-Informed Adaptive Decision Exploration via Blackboard-Driven MCTS for Competitive Program Generation4 May 2026
- 2025DebugTA: An LLM-Based Agent for Simplifying Debugging and Teaching in Programming Education13 Oct 2025
- 2024Deploying Foundation Model Powered Agent Services: A Survey18 Dec 2024
- 2026Large Language Model Reasoning Failurescited by 20
- 2025Improving Chain-of-Thought Reasoning via Quasi-Symbolic Abstractionscited by 17
- 2026Large Language Model Reasoning Failures5 Feb 2026
- 2025Improving Chain-of-Thought Reasoning via Quasi-Symbolic Abstractions18 Feb 2025
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
- 2024The RealHumanEval: Evaluating Large Language Models' Abilities to Support Programmerscited by 28
- 2024CodeMirage: Hallucinations in Code Generated by Large Language Modelscited by 23
- 2024IRCoder: Intermediate Representations Make Language Models Robust Multilingual Code Generatorscited by 21
- 2024The Counterfeit Conundrum: Can Code Language Models Grasp the Nuances of Their Incorrect Generations?cited by 20
- 2023Machine-assisted quantitizing designs: augmenting humanities and social sciences with artificial intelligencecited by 13
- 2024LLMs with Industrial Lens: Deciphering the Challenges and Prospects -- A Surveycited by 12
- 2024FVEval: Understanding Language Model Capabilities in Formal Verification of Digital Hardwarecited by 9
- 2025Intuition to Evidence: Measuring AI's True Impact on Developer Productivitycited by 5
- 2024No Size Fits All: The Perils and Pitfalls of Leveraging LLMs Vary with Company Sizecited by 3
- 2025PerfCoder: Large Language Models for Interpretable Code Performance Optimizationcited by 3
12 most cited of 23 All 23 (JSON)
- 2026On the Lexical Superstition of Large Language Models for Code Comprehension: Re-evaluation on Code of Low Lexical Quality22 Sep 2026
- 2026On the Robustness of LLMs' Internal Representation of Code Correctness8 Aug 2026
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Models30 Jun 2026
- 2026Belief-Guided Inference Control for Large Language Model Services via Verifiable Observations30 Apr 2026
- 2026VeriInteresting: An Empirical Study of Model Prompt Interactions in Verilog Code Generation4 Feb 2026
- 2026Tricky2: Towards a Benchmark for Evaluating Human and LLM Error Interactions26 Jan 2026
- 2025PerfCoder: Large Language Models for Interpretable Code Performance Optimization16 Dec 2025
- 2025Learning Bug Context for PyTorch-to-JAX Translation with LLMs10 Oct 2025
- 2025LLM Based Long Code Translation using Identifier Replacement10 Oct 2025
- 2025Intuition to Evidence: Measuring AI's True Impact on Developer Productivity24 Sep 2025
- 2025Program Semantic Inequivalence Game with Large Language Models2 May 2025
- 2025SOK: Exploring Hallucinations and Security Risks in AI-Assisted Software Development with Insights for LLM Deployment31 Jan 2025
12 newest of 23 All 23 (JSON)