arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2602.20213cs.SEcs.AIcs.CR
收藏

CodeHacker: 用于检测竞赛编程解决方案漏洞的自动化测试用例生成

CodeHacker: Automated Test Case Generation for Detecting Vulnerabilities in Competitive Programming Solutions

Shanghai University of Finance and Economics(上海金融学院);Northwestern Polytechnical University(西北工业大学);Meituan(美团);University of Toronto(多伦多大学)

Jingwei Shi, Xinxiang Yin, Jing Huang, Jinman Zhao, Shengyu Tao

AI总结:

提出CodeHacker框架,通过多策略对抗测试用例生成(压力测试、反哈希攻击、逻辑特定攻击)和校准阶段,有效暴露程序漏洞,提升测试集真负率并增强RL训练模型性能。

摘要:

大型语言模型(LLM)在代码生成方面的评估很大程度上依赖于测试用例的质量和鲁棒性。然而,现有的基准测试往往缺乏对微妙边界情况的覆盖,导致错误的解决方案通过测试。为弥补这一差距,我们提出了CodeHacker,一个自动化的智能体框架,专门用于生成有针对性的对抗性测试用例,以暴露程序提交中的潜在漏洞。模仿竞赛编程中的黑客机制,CodeHacker采用多策略方法,包括压力测试、反哈希攻击和逻辑特定攻击,以破解特定的代码提交。为确保这些攻击的有效性和可靠性,我们引入了一个校准阶段,在该阶段中,智能体在评估参赛者代码之前,通过自生成的对抗性探测迭代地完善自己的验证器和检查器。实验表明,CodeHacker显著提高了现有数据集上的真负率(TNR),有效过滤了先前被接受的错误解决方案。此外,生成的对抗性案例被证明是优越的训练数据,提升了在LiveCodeBench等基准测试上经过强化学习训练的模型的性能。

英文摘要:

The evaluation of Large Language Models (LLMs) for code generation relies heavily on the quality and robustness of test cases. However, existing benchmarks often lack coverage for subtle corner cases, allowing incorrect solutions to pass. To bridge this gap, we propose CodeHacker, an automated agent framework dedicated to generating targeted adversarial test cases that expose latent vulnerabilities in program submissions. Mimicking the hack mechanism in competitive programming, CodeHacker employs a multi-strategy approach, including stress testing, anti-hash attacks, and logic-specific targeting to break specific code submissions. To ensure the validity and reliability of these attacks, we introduce a Calibration Phase, where the agent iteratively refines its own Validator and Checker via self-generated adversarial probes before evaluating contestant code.Experiments demonstrate that CodeHacker significantly improves the True Negative Rate (TNR) of existing datasets, effectively filtering out incorrect solutions that were previously accepted. Furthermore, generated adversarial cases prove to be superior training data, boosting the performance of RL-trained models on benchmarks like LiveCodeBench.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑