ReCatcher可系统检测代码生成大模型更新后的退化问题。
ReCatcher: Towards LLMs Regression Testing for Code Generation
- 对比新旧模型在逻辑正确性、代码质量和执行性能三方面差异。
- 发现模型更新后语法错误最高升12%,缺失导入问题恶化达50%。
- 适合关注模型迭代质量的开发者与研究者使用。
用于代码生成的大语言模型通过微调、合并或新版本发布快速演进,但这些更新可能引入回归问题,不仅影响正确性,还影响代码质量与性能。为此,我们提出 ReCatcher,一个针对 Python 代码生成的系统性回归测试框架。该框架从逻辑正确性、静态代码质量与执行性能三个维度,系统比较当前模型与候选更新版本(如 CodeLlama、DeepSeek-Coder、GPT-4o)。评估覆盖微调、合并与模型发布三种场景:跨语言数据微调使语法错误最多增加12%;与 Llama2 合并导致正确性下降最高达18%;GPT-4o 在处理缺失导入时相比 GPT-3.5-turbo 退化高达50%;GPT-4o-mini 执行时间比 GPT-4o 慢最多80%。整体来看,逻辑正确性、性能及错误处理(如语法错误、缺失导入)是最易出现退化的环节。相较于基线方法,ReCatcher 在逻辑与性能判断上表现更优且更一致。结果凸显了在采纳新模型前进行系统性回归评估的重要性,助力研究人员与实践者做出更明智的更新决策。
原文摘要 · Abstract (English)
Large Language Models (LLMs) for code generation evolve rapidly through fine-tuning, merging, or new model releases. However, such updates can introduce regressions, not only in correctness but also in code quality and performance. To address this, we present ReCatcher, a regression testing framework for Python code generation. ReCatcher systematically compares two LLMs, typically a current model and a candidate update, across three dimensions: logical correctness, static code quality, and execution performance. We apply ReCatcher to assess regressions across three update scenarios, fine-tuning, merging, and model release, using CodeLlama, DeepSeek-Coder, and GPT-4o. Our evaluation shows that fine-tuning with cross-language datasets increases syntax errors by up to 12%. Merging with general-purpose models like Llama2 leads to regressions in correctness by up to 18%. GPT-4o introduces regressions of up to 50% in handling missing imports compared to GPT-3.5-turbo, while GPT-4o-mini suffers up to 80% performance degradation in execution time versus GPT-4o. Overall, logical correctness, performance, and error handling (e.g., syntax errors and missing imports) are the most regression-prone areas. Comparing ReCatcher with baseline solutions, it presents better and consistent accuracy across logical and performance aspects. ReCatcher highlights the importance of systematic regression evaluation before adopting new models, while assisting researchers and practitioners in making more informed update decisions.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。