arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.00865cs.SEcs.AIcs.CL
收藏

Demo-Craft:利用上下文学习改进大语言模型的代码生成

Demo-Craft: Using In-Context Learning to Improve Code Generation in Large Language Models

Indian Institute of Technology Kanpur(印度理工学院坎普尔分校);Indian Institute of Technology Guwahati(印度理工学院古瓦哈提分校)

Nirmal Joshua Kapu, Mihit Sreejith

AI总结:

针对大语言模型代码生成的语义歧义等问题,提出结合上下文学习、示例选择与潜在概念学习的DemoCraft系统,在MBPP、HumanEval数据集上pass@k提升约2倍,新提出的correctness@k等指标提升近3倍。

摘要:

使用大语言模型(LLMs)从自然语言指令生成可执行代码面临语义歧义、任务特定上下文理解等挑战。为解决这些问题,我们提出名为DemoCraft的系统,通过结合上下文学习、示例选择与潜在概念学习来增强代码生成效果。潜在概念学习引入额外的概念token,它们是可训练的嵌入向量,用于捕捉任务特定知识。我们在MBPP和HumanEval两个主流数据集上测试了该系统。实验结果表明,与基线模型相比,所提系统的pass@k指标提升约2倍。此外,我们提出了两个新的评估指标:correctness@k和similarity@k。实证研究显示,我们的系统在这些指标上也实现了近3倍的提升。

英文摘要:

Generating executable code from natural language instructions using Large Language Models (LLMs) poses challenges such as semantic ambiguity and understanding taskspecific contexts. To address these issues, we propose a system called DemoCraft, which enhances code generation by leveraging in-context learning and demonstration selection, combined with latent concept learning. Latent concept learning introduces additional concept tokens, which are trainable embeddings that capture task-specific knowledge. We then test our system on two major datasets: MBPP and Humaneval. Our experimental results demonstrate that the proposed system achieves an approximate 2x increase in the pass@k metric compared to baseline models. Furthermore, we introduce two novel evaluation metrics: correctness@k and similarity@k. Our empirical studies indicate that our system attains nearly a 3x improvement in these metrics as well.

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

↑