CoCoMIC: Code Completion by Jointly Modeling In-file and Cross-file Context

By Yangruibo Ding, Zijian Wang, Wasi Uddin Ahmad, Murali Krishna Ramanathan, Ramesh Nallapati, Parminder Bhatia, Dan Roth, Bing Xiang. 2022

111 citations recorded by the source corpus.

While pre-trained language models (LM) for code have achieved great success in code completion, they generate code conditioned only on the contents within the file, i.e., in-file context, but ignore the rich semantics in other files within the same project, i.e., project-level cross-file context, a critical source of information that is especially useful in modern modular software development. Such overlooking constrains code LMs’ capacity in code completion, leading to unexpected behaviors such as generating hallucinated class member functions or function calls with unexpected arguments. In this work, we propose CoCoMIC, a novel framework that jointly learns the in-file and cross-file context on top of code LMs. To empower CoCoMIC, we develop CCFinder, a static-analysis-based tool that locates and retrieves the most relevant project-level cross-file context for code completion. CoCoMIC successfully improves the existing code LM with a 33.94% relative increase in exact match and 28.69% in identifier matching for code completion when the cross-file context is provided. Finally, we perform a series of ablation studies and share valuable insights for future research on integrating cross-file context into code LMs.

Subfields: Computer Networks and Communications, Information Systems, 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 Computer Networks and Communications

  1. Armando Solar-Lezama
  2. Koushik Sen
  3. Anima Anandkumar
  4. Ion Stoica
  5. Julian McAuley
  6. Jian-Guang Lou
  7. Scott Shenker
  8. Mosharaf Chowdhury

In Information Systems

  1. Armando Solar-Lezama
  2. Bei Chen
  3. Koushik Sen
  4. Naman Jain
  5. Tianjun Zhang
  6. Anima Anandkumar
  7. Weizhu Chen
  8. Tianyang Liu

In Code Generation & Program Synthesis

  1. Armando Solar-Lezama
  2. Koushik Sen
  3. Tianyang Liu
  4. Kaiyu Yang
  5. Julian McAuley
  6. Jian-Guang Lou
  7. Canwen Xu
  8. Rishabh Singh

Citations in the corpus