arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2604.24703cs.SEcs.AI
收藏

基于大语言模型的代码生成中的缺陷任务描述:检测与分析

Defective Task Descriptions in LLM-Based Code Generation: Detection and Analysis

University of Luxembourg(卢森堡大学)

Amal Akli, Mike Papadakis, Maxime Cordy, Yves Le Traon

AI总结:

本文提出SpecValidator,通过轻量级模型检测任务描述缺陷,结果显示其在检测准确性与鲁棒性上优于其他模型,揭示了任务描述结构对LLM性能的影响。

摘要:

大型语言模型被广泛用于代码生成,但隐含假设任务描述足够详细且正确。然而,用户可能提供缺陷描述,影响代码正确性。为此,我们开发了SpecValidator,基于小模型高效微调,自动检测任务描述缺陷。我们在三个基准上评估三种缺陷类型:词汇模糊、不足说明和语法格式问题。结果表明,SpecValidator在F1=0.804和MCC=0.745上显著优于GPT-5-mini和Claude Sonnet 4。分析表明,SpecValidator能泛化到未见问题并检测未知不足说明缺陷。结果还显示,LLM在任务描述缺陷中的鲁棒性主要取决于缺陷类型和任务描述特征,而非模型容量。不足说明缺陷最为严重。此外,具有更丰富上下文基础的基准如LiveCodeBench表现出更强的抗性,突显了结构化任务描述对可靠LLM代码生成的重要性。

英文摘要:

Large language models are widely used for code generation, yet they rely on an implicit assumption that the task descriptions are sufficiently detailed and well-formed. However, in practice, users may provide defective descriptions, which can have a strong effect on code correctness. To address this issue, we develop SpecValidator, a lightweight classifier based on a small model that has been parameter-efficiently finetuned, to automatically detect task description defects. We evaluate SpecValidator on three types of defects, Lexical Vagueness, Under-Specification and Syntax-Formatting on 3 benchmarks with task descriptions of varying structure and complexity. Our results show that SpecValidator achieves defect detection of F1 = 0.804 and MCC = 0.745, significantly outperforming GPT-5-mini (F1 = 0.469 and MCC = 0.281) and Claude Sonnet 4 (F1 = 0.518 and MCC = 0.359). Perhaps more importantly, our analysis indicates that SpecValidator can generalize to unseen issues and detect unknown Under-Specification defects in the original (real) descriptions of the benchmarks used. Our results also show that the robustness of LLMs in task description defects depends primarily on the type of defect and the characteristics of the task description, rather than the capacity of the model, with Under-Specification defects being the most severe. We further found that benchmarks with richer contextual grounding, such as LiveCodeBench, exhibit substantially greater resilience, highlighting the importance of structured task descriptions for reliable LLM-based code generation.

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

↑