arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2206.12839cs.LGcs.AIcs.PLcs.SE
收藏

代码大型语言模型的仓库级提示生成

Repository-Level Prompt Generation for Large Language Models of Code

Mila(米拉研究所);Université de Montréal(蒙特利尔大学);Google(谷歌);McGill University(麦吉尔大学)

Disha Shrivastava, Hugo Larochelle, Daniel Tarlow

AI总结:

提出Repo-Level Prompt Generator框架,利用仓库级上下文生成示例特定提示,无需访问模型权重,在代码自动补全任务上相对Codex提升36%。

摘要:

随着代码大型语言模型(LLM)的成功及其作为代码助手的应用(例如GitHub Copilot中使用的Codex),在提示设计过程中引入领域特定知识的技术变得重要。在这项工作中,我们提出了一个名为Repo-Level Prompt Generator的框架,该框架学习使用提示提议生成特定于示例的提示。提示提议从整个仓库中获取上下文,从而结合了仓库的结构和其他相关文件(例如导入、父类文件)的上下文。我们的技术不需要访问LLM的权重,使其适用于仅能黑盒访问LLM的情况。我们使用从Google Code档案中获取的代码仓库,在单行代码自动补全任务上进行了实验。我们证明,由我们的提示提议构建的oracle相对于Codex实现了高达36%的相对改进,显示了这些提议的质量。此外,我们表明,当我们训练一个模型来预测提示提议时,我们可以获得相对于Codex和其他基线的显著性能提升。我们在以下网址发布我们的代码、数据和训练好的检查点:\url{https://github.com/shrivastavadisha/repo_level_prompt_generation}。

英文摘要:

With the success of large language models (LLMs) of code and their use as code assistants (e.g. Codex used in GitHub Copilot), techniques for introducing domain-specific knowledge in the prompt design process become important. In this work, we propose a framework called Repo-Level Prompt Generator that learns to generate example-specific prompts using prompt proposals. The prompt proposals take context from the entire repository, thereby incorporating both the structure of the repository and the context from other relevant files (e.g. imports, parent class files). Our technique doesn't require any access to the weights of the LLM, making it applicable in cases where we only have black-box access to the LLM. We conduct experiments on the task of single-line code-autocompletion using code repositories taken from Google Code archives. We demonstrate that an oracle constructed from our prompt proposals gives a remarkably high relative improvement of 36% over Codex, showing the quality of these proposals. Further, we show that when we train a model to predict a prompt proposal, we can achieve significant performance gains over Codex and other baselines. We release our code, data, and trained checkpoints at: \url{https://github.com/shrivastavadisha/repo_level_prompt_generation}.

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

↑