arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.00006cs.SEcs.AI

使用大语言模型的个性引导代码生成

Personality-Guided Code Generation Using Large Language Models

Peking University(北京大学);Nanyang Technological University(南洋理工大学);King’s College London(伦敦大学国王学院)

Yaoqi Guo, Zhenpeng Chen, Jie M. Zhang, Yang Liu, Yun Ma

AI总结:

本文实证研究了个性引导对大语言模型代码生成性能的影响,通过模拟适合编码任务的个性特征,在7个模型和4个数据集上显著提升了代码准确率,并能与其他提示策略集成。

摘要:

代码生成,即根据自然语言描述自动创建源代码,因有望简化软件开发而备受关注。受将任务与个性匹配以改善开发成果的研究启发,我们使用大语言模型(LLMs)对个性引导的代码生成进行了实证研究。具体而言,我们探究了模拟适合编码任务的个性特征如何影响LLM的性能。我们使用7个广泛采用的LLMs在4个代表性数据集上对该方法进行了广泛评估。结果显示,个性引导显著提升了代码生成准确率,在28个LLM-数据集组合中有23个的通过率得到提高。值得注意的是,在11个案例中提升超过5%,在5个案例中超过10%,最高增益达12.9%。此外,个性引导可与其他提示策略轻松集成以进一步提升性能。我们在https://github.com/IanWalls/Persona-Code开源了代码和数据。

英文摘要:

Code generation, the automatic creation of source code from natural language descriptions, has garnered significant attention due to its potential to streamline software development. Inspired by research that links task-personality alignment with improved development outcomes, we conduct an empirical study on personality-guided code generation using large language models (LLMs). Specifically, we investigate how emulating personality traits appropriate to the coding tasks affects LLM performance. We extensively evaluate this approach using seven widely adopted LLMs across four representative datasets. Our results show that personality guidance significantly enhances code generation accuracy, with improved pass rates in 23 out of 28 LLM-dataset combinations. Notably, in 11 cases, the improvement exceeds 5%, and in 5 instances, it surpasses 10%, with the highest gain reaching 12.9%. Additionally, personality guidance can be easily integrated with other prompting strategies to further boost performance. We open-source our code and data at https://github.com/IanWalls/Persona-Code.

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

↑