CrossCodeEval: 크로스 파일 코드 완성을 위한 다양하고 다국어 벤치마크
CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completion
October 17, 2023
저자: Yangruibo Ding, Zijian Wang, Wasi Uddin Ahmad, Hantian Ding, Ming Tan, Nihal Jain, Murali Krishna Ramanathan, Ramesh Nallapati, Parminder Bhatia, Dan Roth, Bing Xiang
cs.AI
초록
코드 완성 모델은 최근 몇 년 동안 상당한 발전을 이루었지만, 현재 널리 사용되는 평가 데이터셋인 HumanEval과 MBPP는 주로 단일 파일 내의 코드 완성 작업에 초점을 맞추고 있습니다. 이러한 지나치게 단순화된 설정은 여러 파일로 구성되고 수많은 파일 간 의존성을 가지며, 코드를 정확히 완성하기 위해 파일 간 문맥에 접근하고 이해하는 것이 필요한 실제 소프트웨어 개발 시나리오를 충분히 반영하지 못합니다.
이러한 격차를 메우기 위해, 우리는 파일 간 문맥을 깊이 있게 이해해야만 코드를 정확히 완성할 수 있는 다양하고 다국어적인 코드 완성 벤치마크인 CrossCodeEval을 제안합니다. CrossCodeEval은 Python, Java, TypeScript, C#이라는 네 가지 인기 프로그래밍 언어로 작성된 다양한 실제 오픈 소스, 허가된 라이선스의 저장소들을 기반으로 구축되었습니다. 정확한 완성을 위해 파일 간 문맥이 엄격히 필요한 예제를 생성하기 위해, 우리는 현재 파일 내에서 파일 간 문맥의 사용을 정확히 찾아내는 간단하면서도 효율적인 정적 분석 기반 접근 방식을 제안합니다.
CodeGen과 StarCoder와 같은 최첨단 코드 언어 모델에 대한 광범위한 실험을 통해, CrossCodeEval은 관련 파일 간 문맥이 없을 때 매우 도전적임을 보여주며, 이러한 문맥을 프롬프트에 추가할 때 명확한 개선이 관찰됩니다. 그러나 이러한 개선에도 불구하고, 가장 성능이 뛰어난 모델을 사용하더라도 최고 성능에 도달하지 못함을 보여주며, 이는 CrossCodeEval이 광범위한 문맥을 활용하여 더 나은 코드 완성을 수행하는 모델의 능력을 평가할 수 있음을 나타냅니다. 마지막으로, 우리는 파일 간 문맥을 검색하는 다양한 방법을 벤치마킹하고, CrossCodeEval이 코드 검색기의 능력을 측정하는 데에도 사용될 수 있음을 보여줍니다.
English
Code completion models have made significant progress in recent years, yet
current popular evaluation datasets, such as HumanEval and MBPP, predominantly
focus on code completion tasks within a single file. This over-simplified
setting falls short of representing the real-world software development
scenario where repositories span multiple files with numerous cross-file
dependencies, and accessing and understanding cross-file context is often
required to complete the code correctly.
To fill in this gap, we propose CrossCodeEval, a diverse and multilingual
code completion benchmark that necessitates an in-depth cross-file contextual
understanding to complete the code accurately. CrossCodeEval is built on a
diverse set of real-world, open-sourced, permissively-licensed repositories in
four popular programming languages: Python, Java, TypeScript, and C#. To create
examples that strictly require cross-file context for accurate completion, we
propose a straightforward yet efficient static-analysis-based approach to
pinpoint the use of cross-file context within the current file.
Extensive experiments on state-of-the-art code language models like CodeGen
and StarCoder demonstrate that CrossCodeEval is extremely challenging when the
relevant cross-file context is absent, and we see clear improvements when
adding these context into the prompt. However, despite such improvements, the
pinnacle of performance remains notably unattained even with the
highest-performing model, indicating that CrossCodeEval is also capable of
assessing model's capability in leveraging extensive context to make better
code completion. Finally, we benchmarked various methods in retrieving
cross-file context, and show that CrossCodeEval can also be used to measure the
capability of code retrievers.