论文标题
大型代码的存储库级提示生成
Repository-Level Prompt Generation for Large Language Models of Code
论文作者
论文摘要
随着大型语言模型(LLM)的成功及其用作代码助手(例如Github Copilot中使用的法典),在及时设计过程中引入特定领域知识的技术变得很重要。在这项工作中,我们提出了一个称为回复级提示生成器的框架,该框架学习使用提示提示生成示例特定的提示。提示提案从整个存储库中获取上下文,从而结合了存储库的结构和其他相关文件(例如导入,父类文件)的上下文。我们的技术不需要访问LLM的权重,因此在我们只能使用Black-Box访问LLM的情况下,它适用。我们使用从Google Code Archives获取的代码存储库进行了有关单线代码自动完成任务的实验。我们证明,根据我们的及时提案构建的甲骨文给出了36%的相对改善,比法典的相对改善,显示了这些建议的质量。此外,我们表明,当我们训练一个模型以预测迅速的建议时,我们可以在法典和其他基准方面取得显着的绩效提高。我们在:\ 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}.