Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Models

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Yang, Guang, Zhou, Yu, Chen, Xiang, Zhang, Xiangyu, Zhuo, Terry Yue, Chen, Taolue
Format: Preprint
Published: 2023
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911975956545536
author Yang, Guang
Zhou, Yu
Chen, Xiang
Zhang, Xiangyu
Zhuo, Terry Yue
Chen, Taolue
author_facet Yang, Guang
Zhou, Yu
Chen, Xiang
Zhang, Xiangyu
Zhuo, Terry Yue
Chen, Taolue
contents Large Language Models (LLMs) have demonstrated remarkable potential in code generation. The integration of Chain of Thought (CoT) reasoning can further boost their performance. However, current CoT methods often require manual writing or LLMs with over 100 billion parameters to generate, impeding their applicability in resource-constrained scenarios. In this study, we investigate lightweight Language Models (lLMs), which are defined to have fewer than 10 billion parameters. Empirically, we find that most lLMs cannot generate high-quality CoTs when prompted by the few-shot method, but can take advantage of high-quality CoTs generated elsewhere to improve their performance in code generation. Based on these findings, we design a novel approach COTTON which can leverage lLMs to automatically generate CoTs for code generation. We synthesize new datasets and conduct extensive experiments on various benchmarks. The results show that the CoTs generated by COTTON outperform the baselines in terms of automated and human evaluation metrics. In particular, the CoTs generated by COTTON boost various lLMs to achieve higher performance gains than those generated by LLMs such as ChatGLM (130B), and are competitive with those generated by gpt-3.5-turbo (175B). Our study also showcases the potential of lLMs in software engineering applications.
format Preprint
id arxiv_https___arxiv_org_abs_2312_05562
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Models
Yang, Guang
Zhou, Yu
Chen, Xiang
Zhang, Xiangyu
Zhuo, Terry Yue
Chen, Taolue
Software Engineering
Large Language Models (LLMs) have demonstrated remarkable potential in code generation. The integration of Chain of Thought (CoT) reasoning can further boost their performance. However, current CoT methods often require manual writing or LLMs with over 100 billion parameters to generate, impeding their applicability in resource-constrained scenarios. In this study, we investigate lightweight Language Models (lLMs), which are defined to have fewer than 10 billion parameters. Empirically, we find that most lLMs cannot generate high-quality CoTs when prompted by the few-shot method, but can take advantage of high-quality CoTs generated elsewhere to improve their performance in code generation. Based on these findings, we design a novel approach COTTON which can leverage lLMs to automatically generate CoTs for code generation. We synthesize new datasets and conduct extensive experiments on various benchmarks. The results show that the CoTs generated by COTTON outperform the baselines in terms of automated and human evaluation metrics. In particular, the CoTs generated by COTTON boost various lLMs to achieve higher performance gains than those generated by LLMs such as ChatGLM (130B), and are competitive with those generated by gpt-3.5-turbo (175B). Our study also showcases the potential of lLMs in software engineering applications.
title Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Models
topic Software Engineering
url https://arxiv.org/abs/2312.05562