Dynamic-Static Synergistic Selection Method for Candidate Code Solutions with Generated Test Cases
Renbiao Liu, Jiang-Tian Xue, Chao-Zeng Ma, Hui Sun, Xin-Ye Li, Ming Li
摘要
Large language models (LLMs) show significant improvement in code generation. A common practice is sampling multiple candidate codes to increase the likelihood of producing an accurate solution. However, effectively identifying the best candidate from the pool is a significant challenge. Although existing code consensus methods attempt to solve this issue, they suffer from a critical problem: relying on test cases generated by LLMs, which can be flawed or provide incomplete coverage. This problem can result in erroneous validations, causing correct code to fail flawed tests and preventing the detection of functional differences in candidate code solutions. To address these issues, we present the Dynamic-Static Synergistic Selection Method, a novel framework that combines two complementary analytical approaches. First, it uses the abstract syntax tree (AST) to detect and filter candidate solutions and test cases. Second, the method statically analyzes the quality of the solutions and then dynamically validates functional consistency based on the execution results of the extracted inputs, thereby neutralizing the impact of faulty tests. Extensive experiments demonstrate that this synergistic approach significantly outperforms existing methods, substantially enhancing the correctness of the selected code.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 1 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning 引用了 Language Models are Few-Shot Learners
- Self-Consistency Improves Chain of Thought Reasoning in Language Models 引用了 Language Models are Few-Shot Learners
- Random Selection Reveals Implicit Knowledge Consensus in Code Generation 引用了 Language Models are Few-Shot Learners
- Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation 引用了 Language Models are Few-Shot Learners
- Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation 引用了 WizardCoder: Empowering Code Large Language Models with Evol-Instruct
- WizardCoder: Empowering Code Large Language Models with Evol-Instruct 引用了 Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation
- WizardCoder: Empowering Code Large Language Models with Evol-Instruct 引用了 Language Models are Few-Shot Learners
引用它的顶会 Paper1
它引用的 Paper14
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code GenerationJiawei Liu, Chunqiu Steven Xia, Yuyao Wang, Lingming ZhangNeurIPS 2023 · 2,317 次引用
- WizardCoder: Empowering Code Large Language Models with Evol-InstructZiyang Luo, Can Xu, Pu Zhao, Qingfeng Sun 等ICLR 2024 · 945 次引用
- Self-Consistency Improves Chain of Thought Reasoning in Language ModelsXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V. Le 等ICLR 2023 · 681 次引用
- CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement LearningHung Le, Yue Wang, Akhilesh Deepak Gotmare, Silvio Savarese 等NeurIPS 2022 · 571 次引用
相关 Paper
- Oracle-Guided Program Selection from Large Language ModelsZhiyu Fan, Haifeng Ruan, Sergey Mechtaev, Abhik RoychoudhuryISSTA 2024 · 4 次引用
- B4: Towards Optimal Assessment of Plausible Code Solutions with Plausible TestsMouxiang Chen, Zhongxin Liu, He Tao, Yusu Hong 等ASE 2024 · 2 次引用
- CodeT: Code Generation with Generated TestsBei Chen, Fengji Zhang, Anh Nguyen, Daoguang Zan 等ICLR 2023 · 64 次引用
- DebateCoder: Towards Collective Intelligence of LLMs via Test Case Driven LLM Debate for Code GenerationJizheng Chen, Kounianhua Du, Xinyi Dai, Weiming Zhang 等ACL 2025
- Rethinking the Evaluation of Secure Code GenerationShih-Chieh Dai, Jun Xu, Guanhong TaoICSE 2026 · 1 次引用
