Repository-Level Prompt Generation for Large Language Models of Code

By Disha Shrivastava, Hugo Larochelle, Daniel Tarlow. 2022

193 citations recorded by the source corpus.

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}.

Subfields: Artificial Intelligence, Information Systems, Information Systems and Management, Large Language Models, Code Generation & Program Synthesis

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Graham Neubig
  2. Yiming Yang
  3. Weizhu Chen
  4. Julian McAuley
  5. Uri Alon
  6. Canwen Xu
  7. Aman Madaan
  8. Jianfeng Gao

In Information Systems

  1. Uri Alon
  2. Yiming Yang
  3. Aman Madaan
  4. Graham Neubig
  5. Armando Solar-Lezama
  6. Bei Chen
  7. Koushik Sen
  8. Naman Jain

In Information Systems and Management

  1. Armando Solar-Lezama
  2. Koushik Sen
  3. Graham Neubig
  4. Weizhu Chen
  5. Tianyang Liu
  6. Ion Stoica
  7. Julian McAuley
  8. Canwen Xu

In Large Language Models

  1. Graham Neubig
  2. Canwen Xu
  3. Weizhu Chen
  4. Julian McAuley
  5. Jian-Guang Lou
  6. Armando Solar-Lezama
  7. Yi Mao
  8. Naman Jain

In Code Generation & Program Synthesis

  1. Jian-Guang Lou
  2. Armando Solar-Lezama
  3. Koushik Sen
  4. Graham Neubig
  5. Tianyang Liu
  6. Julian McAuley
  7. Uri Alon
  8. Canwen Xu

Citations in the corpus