Automatic Validation of LLM-Generated Code with Prompt Paraphrasing
作者
Xiaoyin Wang,Dakai K. Zhu
出处
期刊:Proceedings日期:2026-04-12卷期号:: 51-55被引量:1
标识
DOI:10.1145/3786582.3786809
摘要
Large Language Models (LLMs) have been widely used for code generation. However, the quality of generated code is still questionable, and code validation remains a challenging problem. In this paper, we propose a novel solution called paraphrase prompt testing. Our intuitive observation is that intrinsic consistency always exists among correct code pieces but may not exist among flawed code pieces, so we can detect flaws in the code by detecting inconsistencies. Therefore, we can vary a given prompt to multiple prompts with paraphrasing, and to ask the LLM to acquire multiple versions of generated code, so that we can validate whether the semantic relations still hold in the acquired code through cross-validation. Our initial evaluation on HumanEval shows that paraphrase prompt testing is able to detect 70.6% of the erroneous programs generated by GPT-4o, with a false positive rate of 6.1%.