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

使用中间语言评估代码生成

Assessing Code Generation with Intermediate Languages

Xun Deng, Sicheng Zhong, Honghua Dong, Jingyu Hu, Sidi Mohamed Beillahi, Xujie Si, Fan Long

AI总结:

本文系统评估了中间语言(编程语言、自然语言、伪代码)对十一个LLMs代码生成的影响,发现自然语言最有效,且提升主要来自思维链效应而非语言迁移。

摘要:

诸如思维链(COT)之类的中间步骤方法已被证明能够有效提升大型语言模型(LLMs)在代码生成上的表现。本研究探索了中间语言的利用方式,包括多种编程语言、自然语言解决方案和伪代码,并系统评估了它们对LLMs在代码生成任务中表现的影响。我们的实验涵盖了CodeLlama、GPT和Mistral系列中的十一个模型,以及新发布的较小模型。研究结果表明,中间语言通常在尚未达到最先进性能的较大模型中表现出更高的有效性。自然语言在所有目标语言中始终是最有效的中间表示形式。然而,我们未观察到在不同模型和目标语言之间普遍有效的中间形式语言。此外,我们发现中间解决方案的正确性与最终生成之间的相关性较弱,这表明性能提升可能源于思维链效应,而非特定语言的迁移。有趣的是,我们发现对于GPT系列模型,在没有明确自我修正指令的情况下多次提示,在所研究的语言中都能带来性能提升。

英文摘要:

Intermediate step methodologies like chain of thoughts (COT) have demonstrated effectiveness in enhancing the performance of Large Language Models (LLMs) on code generation. This study explores the utilization of intermediate languages, including various programming languages, natural language solutions, and pseudo-code, and systematically evaluates their impact on the performance of LLMs in code generation tasks. Our experiments encompass eleven models across the CodeLlama, GPT, and Mistral families, as well as newly released smaller models. Our findings reveal that intermediate languages generally exhibit greater efficacy in larger models that have not yet achieved state-of-the-art performance. Natural language consistently emerges as the most effective intermediate representation across all target languages. However, we observe no universally effective intermediate formal language across different models and target languages. Furthermore, we uncover a weak correlation between the correctness of intermediate solutions and final generation, suggesting that improvements may stem from the chain-of-thought effect rather than language-specific transfer. Interestingly, we discover that for GPT family models, prompting multiple times without explicit self-correction instructions yields performance gains across the studied languages.

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

↑