Back to Main Conference 2024
LREC-COLING 2024main

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

Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)

DOI:10.63317/55z6pyuui3ij

Abstract

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.

Details

Paper ID
lrec2024-main-0305
Pages
pp. 3433-3445
BibKey
ding-etal-2024-cocomic
Editor
N/A
Publisher
European Language Resources Association (ELRA) and ICCL
ISSN
2522-2686
ISBN
979-10-95546-34-4
Conference
Joint International Conference on Computational Linguistics, Language Resources and Evaluation
Location
Turin, Italy
Date
20 May 2024 25 May 2024

Authors

  • YD

    Yangruibo Ding

  • ZW

    Zijian Wang

  • WA

    Wasi Ahmad

  • MR

    Murali Krishna Ramanathan

  • RN

    Ramesh Nallapati

  • PB

    Parminder Bhatia

  • DR

    Dan Roth

  • BX

    Bing Xiang

Links