当提示出错时:评估代码模型对模糊、矛盾和不完整任务描述的鲁棒性
When Prompts Go Wrong: Evaluating Code Model Robustness to Ambiguous, Contradictory, and Incomplete Task Descriptions
AI总结:
本文通过引导式变异扩展 HumanEval 与 MBPP,实证评估多类代码 LLM 对模糊、不完整和矛盾任务描述的鲁棒性,揭示描述缺陷会显著降低正确性并诱发逻辑错误。
摘要:
大型语言模型(LLM)在任务描述清晰准确的理想化条件下,已在代码生成任务中展现出令人瞩目的性能。然而在实践中,任务描述经常存在歧义、不完整或内部矛盾。本文中,我们提出首个实证研究,考察最先进的代码生成模型面对此类不清晰任务描述时的鲁棒性。我们扩展了 HumanEval 和 MBPP 基准,通过引导式变异策略系统性地引入现实的任务描述缺陷,生成了一个反映非正式开发者指令混乱状况的数据集。我们评估了多个不同规模和架构的 LLM,分析它们在各类任务描述中的功能正确性和失败模式。研究发现,即使任务描述措辞中的微小瑕疵也会导致显著的性能下降,其中相互矛盾的任务描述会引发大量逻辑错误。此外,尽管较大的模型往往比较小的变体更具韧性,但它们也无法免受需求不清晰所带来挑战的影响。我们进一步分析了语义错误模式,并识别出描述清晰度、模型行为与错误类型之间的相关性。我们的结果强调,迫切需要开发不仅功能强大,而且对自然用户任务中固有缺陷具有鲁棒性的 LLM,同时凸显了改进模型训练策略、设计更现实的评估基准,以及确保在实际软件开发环境中可靠部署的重要考量。
英文摘要:
Large Language Models (LLMs) have demonstrated impressive performance in code generation tasks under idealized conditions, where task descriptions are clear and precise. However, in practice, task descriptions frequently exhibit ambiguity, incompleteness, or internal contradictions. In this paper, we present the first empirical study examining the robustness of state-of-the-art code generation models when faced with such unclear task descriptions. We extend the HumanEval and MBPP benchmarks by systematically introducing realistic task descriptions flaws through guided mutation strategies, producing a dataset that mirrors the messiness of informal developer instructions. We evaluate multiple LLMs of varying sizes and architectures, analyzing their functional correctness and failure modes across task descriptions categories. Our findings reveal that even minor imperfections in task description phrasing can cause significant performance degradation, with contradictory task descriptions resulting in numerous logical errors. Moreover, while larger models tend to be more resilient than smaller variants, they are not immune to the challenges posed by unclear requirements. We further analyze semantic error patterns and identify correlations between description clarity, model behavior, and error types. Our results underscore the critical need for developing LLMs that are not only powerful but also robust to the imperfections inherent in natural user tasks, highlighting important considerations for improving model training strategies, designing more realistic evaluation benchmarks, and ensuring reliable deployment in practical software development environments.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。