mlsanityData to 7 Oct 2026

Measuring the Influence of Incorrect Code on Test Generation

arXiv 2409.09464 ↗First posted 14 Sep 2024cs.SE cs.CLcited by 9

Not on the map. Why?

Abstract (arXiv)

It is natural to suppose that a Large Language Model is more likely to generate correct test cases when prompted with correct code under test, compared to incorrect code under test. However, the size of this effect has never been previously measured, despite its obvious importance for both practicing software engineers and researchers. To answer the question, we conducted a comprehensive empirical study on 5 open source and 6 closed source language models, with 3 widely-used benchmark data sets together with 41 repo-level real-world examples from two different real-world data sets. Our results reveal that, when compared to incorrect code under test, LLMs prompted with correct code achieve improvements in test accuracy, code coverage, and bug detection of 57%, 12%, and 24% respectively. We further show that these scientific conclusions carry over from the three benchmark data sets to the real-world code, where tests generated for incorrect code experience a 47% worse bug detection rate. Finally, we report that improvements of +18% in accuracy, +4% coverage, and +34% in bug detection can be achieved by providing natural language code descriptions. These findings have actionable conclusions. For example, the 47% reduction in real-world bug detection is a clear concern. Fortunately, it is a concern for which our findings about the added value of descriptions offer an immediately actionable remedy.

Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Builds on 37 of its 76 references that are in the map. First posted on arXiv 14 Sep 2024.

Builds on

37 of 76 references.

References · 37

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2022Training language models to follow instructions with human feedbackcited by 15,712
  3. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  4. 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
  5. 2021Program Synthesis with Large Language Modelscited by 3,509
  6. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
  7. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
  8. 2023MetaGPT: Meta Programming for A Multi-Agent Collaborative Frameworkcited by 1,761
  9. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  10. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
  11. 2023Teaching Large Language Models to Self-Debugcited by 963
  12. 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agentscited by 956
25 more
  1. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  2. 2021Measuring Coding Challenge Competence With APPScited by 879
  3. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
  4. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
  5. 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
  6. 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 191
  7. 2022Few-shot training LLMs for project-specific code-summarizationcited by 128
  8. 2024Debug like a Human: A Large Language Model Debugger via Verifying Runtime Execution Step-by-stepcited by 123
  9. 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
  10. 2022Large Language Models are Zero-Shot Fuzzers: Fuzzing Deep-Learning Libraries via Large Language Modelscited by 102
  11. 2018Can Neural Machine Translation be Improved with User Feedback?cited by 71
  12. 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 62
  13. 2023CodeChain: Towards Modular Code Generation Through Chain of Self-revisions with Representative Sub-modulescited by 58
  14. 2023Bias Testing and Mitigation in LLM-based Code Generationcited by 53
  15. 2022Interactive Code Generation via Test-Driven User-Intent Formalizationcited by 50
  16. 2023ALGO: Synthesizing Algorithmic Programs with LLM-Generated Oracle Verifierscited by 41
  17. 2024BugsInPy: A Database of Existing Bugs in Python Programs to Enable Controlled Testing and Debugging Studiescited by 35
  18. 2024EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimizationcited by 28
  19. 2024Large Language Models as Test Case Generators: Performance Evaluation and Enhancementcited by 27
  20. 2024MHPP: Exploring the Capabilities and Limitations of Language Models Beyond Basic Code Generationcited by 25
  21. 2021CoDesc: A Large Code-Description Parallel Datasetcited by 23
  22. 2021Type4Py: Practical Deep Similarity Learning-Based Type Inference for Pythoncited by 19
  23. 2024On Evaluating the Efficiency of Source Code Generated by LLMscited by 19
  24. 2019An Experience Report On Applying Software Testing Academic Results In Industry: We Need Usable Automated Test Generationcited by 4
  25. 2023Prompting Code Interpreter to Write Better Unit Tests on Quixbugs Functionscited by 3

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 1; 2025: 3; 2026: 5.

9 papers.