mlsanityData to 13 Oct 2026

Chain of Targeted Verification Questions to Improve the Reliability of Code Generated by LLMs

arXiv 2405.13932 ↗First posted 22 May 2024cs.SE cs.AIcited by 3

Not on the map. Why?

Abstract (arXiv)

LLM-based assistants, such as GitHub Copilot and ChatGPT, have the potential to generate code that fulfills a programming task described in a natural language description, referred to as a prompt. The widespread accessibility of these assistants enables users with diverse backgrounds to generate code and integrate it into software projects. However, studies show that code generated by LLMs is prone to bugs and may miss various corner cases in task specifications. Presenting such buggy code to users can impact their reliability and trust in LLM-based assistants. Moreover, significant efforts are required by the user to detect and repair any bug present in the code, especially if no test cases are available. In this study, we propose a self-refinement method aimed at improving the reliability of code generated by LLMs by minimizing the number of bugs before execution, without human intervention, and in the absence of test cases. Our approach is based on targeted Verification Questions (VQs) to identify potential bugs within the initial code. These VQs target various nodes within the Abstract Syntax Tree (AST) of the initial code, which have the potential to trigger specific types of bug patterns commonly found in LLM-generated code. Finally, our method attempts to repair these potential bugs by re-prompting the LLM with the targeted VQs and the initial code. Our evaluation, based on programming tasks in the CoderEval dataset, demonstrates that our proposed method outperforms state-of-the-art methods by decreasing the number of targeted errors in the code between 21% to 62% and improving the number of executable code instances to 13%.

Key facts. Cited by 3 papers in the map (data through 13 Oct 2026). Builds on 21 of its 44 references that are in the map. First posted on arXiv 22 May 2024.

Builds on

21 of 44 references.

References · 21

  1. 2021Program Synthesis with Large Language Modelscited by 3,573
  2. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,362
  3. 2023State of What Art? A Call for Multi-Prompt LLM Evaluationcited by 305
  4. 2022GitHub Copilot AI pair programmer: Asset or Liability?cited by 152
  5. 2023InferFix: End-to-End Program Repair with LLMscited by 114
  6. 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 79
  7. 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMscited by 68
  8. 2023On the Robustness of Code Generation Techniques: An Empirical Study on GitHub Copilotcited by 64
  9. 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 60
  10. 2023How Novices Use LLM-Based Code Generators to Solve CS1 Coding Tasks in a Self-Paced Learning Environmentcited by 56
  11. 2023Effective Test Generation Using Pre-trained Large Language Models and Mutation Testingcited by 51
  12. 2023Fully Autonomous Programming with Large Language Modelscited by 31
9 more
  1. 2023Better patching using LLM prompting, via Self-Consistencycited by 29
  2. 2023A Critical Review of Large Language Model on Software Engineering: An Example from ChatGPT and Automated Program Repaircited by 29
  3. 2022Repairing Bugs in Python Assignments Using Large Language Modelscited by 28
  4. 2024Unveiling ChatGPT's Usage in Open Source Projects: A Mining-based Studycited by 16
  5. 2024Copilot Evaluation Harness: Evaluating LLM-Guided Software Programmingcited by 13
  6. 2023Fixing Rust Compilation Errors using LLMscited by 7
  7. 2023Large Language Models Should Ask Clarifying Questions to Increase Confidence in Generated Codecited by 5
  8. 2023COCO: Testing Code Generation Systems via Concretized Instructionscited by 4
  9. 2021Understanding Code Smell Detection via Code Review: A Study of the OpenStack Communitycited by 2

Built on by

Cited by year (2026 to 13 Oct)

Citing papers per year: 2025: 2; 2026: 1.

3 papers.