# Repository-Level Prompt Generation for Large Language Models of Code

**Authors:** Disha Shrivastava, Hugo Larochelle, Daniel Tarlow  
**arXiv:** [2206.12839](https://arxiv.org/abs/2206.12839)  
**Date:** 2022-06-26  
**Summary page:** https://www.summarizepaper.com/en/paper/2206.12839v3/

## Key points

- Authors address the importance of incorporating domain-specific knowledge in prompt design for large language models (LLMs) of code
- Introduce a framework called Repo-Level Prompt Generator that generates example-specific prompts using prompt proposals
- Proposals consider context from the entire repository, including structure and relevant files
- Technique does not require access to LLM weights, making it applicable with black-box access only
- Experiments on single-line code-autocompletion using Google Code archives show remarkable relative improvement of 36% over Codex with oracle constructed from prompt proposals
- Trained model to predict prompt proposals shows significant performance gains compared to Codex and other baselines
- Presents a novel approach to generating prompts for LLMs of code by leveraging repository-level context
- Authors provide code, data, and trained checkpoints for further exploration and potential applications in other domains.

## Summary

In their paper titled "Repository-Level Prompt Generation for Large Language Models of Code," authors Disha Shrivastava, Hugo Larochelle, and Daniel Tarlow address the importance of incorporating domain-specific knowledge in the prompt design process for large language models (LLMs) of code. They introduce a framework called Repo-Level Prompt Generator that generates example-specific prompts using prompt proposals. These proposals consider the context from the entire repository, including the structure of the repository and relevant files such as imports and parent class files. Notably, their technique does not require access to the weights of the LLM, making it applicable even when only black-box access is available. The authors conduct experiments on single-line code-autocompletion using code repositories obtained from Google Code archives. They demonstrate that an oracle constructed from their prompt proposals achieves a remarkable relative improvement of 36% over Codex, highlighting the quality of these proposals. Additionally, they train a model to predict prompt proposals and show significant performance gains compared to Codex and other baselines. Overall, this work presents a novel approach to generating prompts for LLMs of code by leveraging repository-level context. The authors provide their code, data, and trained checkpoints for further exploration which can be used to investigate potential applications in other domains as well.
