Personality-Guided Code Generation Using Large Language Models

Yaoqi Guo, Zhenpeng Chen, Jie M. Zhang, Yang Liu, Yun Ma
10/16/2024
10 citations
cs.SEcs.AI

Official code: IanWalls/Persona-Code (4 stars, Python, last commit 2025-01-22).

Abstract

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).

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

43Python, PowerShellJan 22, 20251 years ago

Similar Papers

Cite this paper

@article{guo2024personalityguided,
  title  = {Personality-Guided Code Generation Using Large Language Models},
  author = {Yaoqi Guo and Zhenpeng Chen and Jie M. Zhang and Yang Liu and Yun Ma},
  year   = {2024},
  eprint = {2411.00006},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.00006v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2411.00006.svg)](https://codeofpaper.com/paper/2411.00006)

Discussion