대규모 코드 표현 학습
Code Representation Learning At Scale
February 2, 2024
저자: Dejiao Zhang, Wasi Ahmad, Ming Tan, Hantian Ding, Ramesh Nallapati, Dan Roth, Xiaofei Ma, Bing Xiang
cs.AI
초록
최근 연구에 따르면, 대규모 코드 언어 모델은 코드 생성과 같은 다운스트림 작업에서 상당한 성능 향상을 보여주고 있습니다. 그러나 기존의 코드 표현 학습 연구 대부분은 매우 제한된 사전 학습 코퍼스를 사용하여 수억 개의 파라미터 규모로 모델을 학습시켰습니다. 본 연구에서는 두 단계의 사전 학습 방식을 통해 방대한 양의 코드 데이터를 활용하여 코드 표현 학습을 강화합니다. 먼저, 마스킹 언어 모델링의 무작위성과 프로그래밍 언어의 구조적 측면을 모두 활용한 혼합 방식으로 인코더를 학습시킵니다. 그런 다음, 비지도 방식으로 구성된 하드 네거티브와 하드 포지티브를 사용한 대조 학습을 통해 표현을 강화합니다. 이를 통해 다양한 다운스트림 작업에서 기존 모델을 큰 차이로 앞서는 범용 인코더 모델을 구축합니다. 성공적인 코드 표현 학습에 기여하는 요소를 이해하기 위해, 우리는 상세한 어블레이션 연구를 수행하고 다음과 같은 발견을 공유합니다: (i) 소스 코드를 위한 맞춤형 및 효과적인 토큰 수준 노이즈 제거 방식, (ii) 하드 네거티브와 하드 포지티브의 중요성, (iii) 제안된 이중 모드 대조 학습이 크로스-링구얼 의미 검색 성능을 어떻게 향상시키는지, (iv) 사전 학습 방식이 모델 크기에 따른 다운스트림 작업 성능 규모를 어떻게 결정하는지.
English
Recent studies have shown that code language models at scale demonstrate
significant performance gains on downstream tasks, i.e., code generation.
However, most of the existing works on code representation learning train
models at a hundred million parameter scale using very limited pretraining
corpora. In this work, we fuel code representation learning with a vast amount
of code data via a two-stage pretraining scheme. We first train the encoders
via a mix that leverages both randomness in masking language modeling and the
structure aspect of programming language. We then enhance the representations
via contrastive learning with hard negative and hard positive constructed in an
unsupervised manner. We establish an off-the-shelf encoder model that
persistently outperforms the existing models on a wide variety of downstream
tasks by large margins. To comprehend the factors contributing to successful
code representation learning, we conduct detailed ablations and share our
findings on (i) a customized and effective token-level denoising scheme for
source code; (ii) the importance of hard negatives and hard positives; (iii)
how the proposed bimodal contrastive learning boost the cross-lingual semantic
search performance; and (iv) how the pretraining schemes decide the downstream
task performance scales with the model size.