InstructCoder: Instruction Tuning Large Language Models for Code Editing

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Li, Kaixin, Hu, Qisheng, Zhao, Xu, Chen, Hui, Xie, Yuxi, Liu, Tiedong, Xie, Qizhe, He, Junxian
Format: Preprint
Published: 2023
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866929258566254592
author Li, Kaixin
Hu, Qisheng
Zhao, Xu
Chen, Hui
Xie, Yuxi
Liu, Tiedong
Xie, Qizhe
He, Junxian
author_facet Li, Kaixin
Hu, Qisheng
Zhao, Xu
Chen, Hui
Xie, Yuxi
Liu, Tiedong
Xie, Qizhe
He, Junxian
contents Code editing encompasses a variety of pragmatic tasks that developers deal with daily. Despite its relevance and practical usefulness, automatic code editing remains an underexplored area in the evolution of deep learning models, partly due to data scarcity. In this work, we explore the use of Large Language Models (LLMs) to edit code based on user instructions. Evaluated on a novel human-written execution-based benchmark dubbed EditEval, we found current models often struggle to fulfill the instructions. In light of this, we contribute InstructCoder, the first instruction-tuning dataset designed to adapt LLMs for general-purpose code editing, containing high-diversity code-editing tasks such as comment insertion, code optimization, and code refactoring. It consists of over 114,000 instruction-input-output triplets and covers multiple distinct code editing scenarios. The collection process starts with filtered commit data sourced from GitHub Python repositories as seeds. Subsequently, the dataset is systematically expanded through an iterative process, where both seed and generated tasks are used to prompt ChatGPT for more data. Our findings reveal that open-source LLMs fine-tuned on InstructCoder can significantly enhance the accuracy of code edits, exhibiting superior code-editing performance matching advanced proprietary LLMs. The datasets and the source code are publicly available at https://github.com/qishenghu/CodeInstruct.
format Preprint
id arxiv_https___arxiv_org_abs_2310_20329
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle InstructCoder: Instruction Tuning Large Language Models for Code Editing
Li, Kaixin
Hu, Qisheng
Zhao, Xu
Chen, Hui
Xie, Yuxi
Liu, Tiedong
Xie, Qizhe
He, Junxian
Computation and Language
Software Engineering
Code editing encompasses a variety of pragmatic tasks that developers deal with daily. Despite its relevance and practical usefulness, automatic code editing remains an underexplored area in the evolution of deep learning models, partly due to data scarcity. In this work, we explore the use of Large Language Models (LLMs) to edit code based on user instructions. Evaluated on a novel human-written execution-based benchmark dubbed EditEval, we found current models often struggle to fulfill the instructions. In light of this, we contribute InstructCoder, the first instruction-tuning dataset designed to adapt LLMs for general-purpose code editing, containing high-diversity code-editing tasks such as comment insertion, code optimization, and code refactoring. It consists of over 114,000 instruction-input-output triplets and covers multiple distinct code editing scenarios. The collection process starts with filtered commit data sourced from GitHub Python repositories as seeds. Subsequently, the dataset is systematically expanded through an iterative process, where both seed and generated tasks are used to prompt ChatGPT for more data. Our findings reveal that open-source LLMs fine-tuned on InstructCoder can significantly enhance the accuracy of code edits, exhibiting superior code-editing performance matching advanced proprietary LLMs. The datasets and the source code are publicly available at https://github.com/qishenghu/CodeInstruct.
title InstructCoder: Instruction Tuning Large Language Models for Code Editing
topic Computation and Language
Software Engineering
url https://arxiv.org/abs/2310.20329