Personality-Guided Code Generation Using Large Language Models

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Guo, Yaoqi, Chen, Zhenpeng, Zhang, Jie M., Liu, Yang, Ma, Yun
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866912401569349632
author Guo, Yaoqi
Chen, Zhenpeng
Zhang, Jie M.
Liu, Yang
Ma, Yun
author_facet Guo, Yaoqi
Chen, Zhenpeng
Zhang, Jie M.
Liu, Yang
Ma, Yun
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2411_00006
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Personality-Guided Code Generation Using Large Language Models
Guo, Yaoqi
Chen, Zhenpeng
Zhang, Jie M.
Liu, Yang
Ma, Yun
Software Engineering
Artificial Intelligence
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.
title Personality-Guided Code Generation Using Large Language Models
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2411.00006