创意与正确:向AI基础模型请求多样化的代码解决方案
Creative and Correct: Requesting Diverse Code Solutions from AI Foundation Models
AI总结:
本研究通过HumanEval实验,系统探究AI基础模型生成代码时多样性与正确性的权衡,识别出帕累托最优的参数与策略组合,为软件工程师提供实用指导。
摘要:
AI基础模型具备对单一提示生成多种响应的能力,这一特性在软件工程中对于生成多样化的代码解决方案非常有益。然而,这一优势也带来了多样性与正确性之间的显著权衡。在软件工程任务中,多样性是探索设计空间和激发创造力的关键,但这些解决方案的实际价值在很大程度上取决于其正确性。我们的研究通过使用HumanEval任务的实验,系统性地调查了这一权衡,探索了各种参数设置和提示策略。我们使用代码克隆社区中的相似度度量来评估代码解决方案的多样性。该研究识别出了能够在多样性与正确性之间达到最佳平衡的参数和策略组合,这些组合位于该权衡空间的帕累托前沿上。这些发现为软件工程师提供了宝贵的见解,帮助他们了解如何有效地使用AI基础模型来生成既多样又准确的代码解决方案。
英文摘要:
AI foundation models have the capability to produce a wide array of responses to a single prompt, a feature that is highly beneficial in software engineering to generate diverse code solutions. However, this advantage introduces a significant trade-off between diversity and correctness. In software engineering tasks, diversity is key to exploring design spaces and fostering creativity, but the practical value of these solutions is heavily dependent on their correctness. Our study systematically investigates this trade-off using experiments with HumanEval tasks, exploring various parameter settings and prompting strategies. We assess the diversity of code solutions using similarity metrics from the code clone community. The study identifies combinations of parameters and strategies that strike an optimal balance between diversity and correctness, situated on the Pareto front of this trade-off space. These findings offer valuable insights for software engineers on how to effectively use AI foundation models to generate code solutions that are diverse and accurate.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。