用性格特征引导大模型写代码,准确率最高提升12.9%
Personality-Guided Code Generation Using Large Language Models
- 根据任务特点模拟相应性格特征来指导代码生成
- 28组测试中23组准确率提升,最高达12.9%
- 可与其它提示策略结合,适合提升编程效率的研究者
代码生成是指从自然语言描述自动生成源代码,因其有望简化软件开发而备受关注。受任务-性格匹配影响开发成效的研究启发,我们开展了一项基于大语言模型(LLMs)的性格引导代码生成实证研究,探索模拟与编码任务相匹配的性格特质对模型性能的影响。我们在四个代表性数据集上,对七种广泛使用的LLMs进行了全面评估。结果表明,性格引导显著提升了代码生成准确性,在28组LLM-数据集组合中,有23组通过率提高;其中11组提升超过5%,5组超过10%,最高提升达12.9%。此外,性格引导可轻松与其他提示策略结合,进一步提升性能。代码与数据已开源:https://github.com/IanWalls/Persona-Code。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。