arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2312.05562cs.SE
收藏

神经代码生成中的思维链:源于并面向轻量级语言模型

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

Nanjing University of Aeronautics and Astronautics(南京航空航天大学);Nantong University(南通大学);Monash University(蒙纳士大学);CSIRO’s Data61(CSIRO数据61);Birkbeck, University of London(伦敦大学伯贝克学院)

Guang Yang, Yu Zhou, Xiang Chen, Xiangyu Zhang, Terry Yue Zhuo, Taolue Chen

AI总结:

针对轻量级语言模型难以自行生成高质量思维链的问题,提出 COTTON 自动生成代码生成 CoT,并证明其效果可超过千亿级模型、接近 gpt-3.5-turbo。

摘要:

大语言模型(LLMs)在代码生成中展现出显著潜力。整合思维链(Chain of Thought,CoT)推理可进一步提升其性能。然而,当前 CoT 方法通常需要人工编写,或由参数规模超过1000亿的 LLM 生成,这阻碍了其在资源受限场景中的适用性。本研究考察轻量级语言模型(lLMs),其定义为参数少于100亿的模型。实验中我们发现,多数 lLM 在少样本提示下无法生成高质量 CoT,但能够利用在别处生成的高质量 CoT 来提升代码生成性能。基于这些发现,我们设计了新颖方法 COTTON,可利用 lLM 自动生成用于代码生成的 CoT。我们合成了新数据集,并在多个基准上进行大量实验。结果表明,COTTON 生成的 CoT 在自动评估指标和人工评估指标上均优于基线。尤其值得注意的是,COTTON 生成的 CoT 推动多种 lLM 获得比 ChatGLM(130B)等 LLM 所生成 CoT 更高的性能提升,并与 gpt-3.5-turbo(175B)生成的 CoT 具有竞争力。本研究还展示了 lLM 在软件工程应用中的潜力。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑