Skip to main content
QUICK REVIEW

[논문 리뷰] CORE: Automating Review Recommendation for Code Changes

Jingkai Siow, Cuiyun Gao|arXiv (Cornell University)|2019. 12. 20.
Software Engineering Research참고 문헌 49인용 수 5
한 줄 요약

이 논문은 전체 소스 코드에 접근하지 않고도 코드 변경 사항과 이력 리뷰만을 사용하여 관련 코드 리뷰를 추천하는 딥러닝 모델 CORE를 제안한다. 단어 수준와 문자 수준의 임베딩을 주의 메커니즘과 결합함으로써, CORE는 19개의 자바 프로젝트에서 최신 기술 모델인 DeepMem 대비 Recall@10에서 131.03% 향상되고, 평균 역수 순위(MRR)에서 150.69% 향상되었다.

ABSTRACT

Code review is a common process that is used by developers, in which a reviewer provides useful comments or points out defects in the submitted source code changes via pull request. Code review has been widely used for both industry and open-source projects due to its capacity in early defect identification, project maintenance, and code improvement. With rapid updates on project developments, code review becomes a non-trivial and labor-intensive task for reviewers. Thus, an automated code review engine can be beneficial and useful for project development in practice. Although there exist prior studies on automating the code review process by adopting static analysis tools or deep learning techniques, they often require external sources such as partial or full source code for accurate review suggestion. In this paper, we aim at automating the code review process only based on code changes and the corresponding reviews but with better performance. The hinge of accurate code review suggestion is to learn good representations for both code changes and reviews. To achieve this with limited source, we design a multi-level embedding (i.e., word embedding and character embedding) approach to represent the semantics provided by code changes and reviews. The embeddings are then well trained through a proposed attentional deep learning model, as a whole named CORE. We evaluate the effectiveness of CORE on code changes and reviews collected from 19 popular Java projects hosted on Github. Experimental results show that our model CORE can achieve significantly better performance than the state-of-the-art model (DeepMem), with an increase of 131.03% in terms of Recall@10 and 150.69% in terms of Mean Reciprocal Rank. Qualitative general word analysis among project developers also demonstrates the performance of CORE in automating code review.

연구 동기 및 목표

  • 전체 소스 코드에 의존하지 않고도 수작업 리뷰 부담을 줄이기 위해 코드 리뷰 추천을 자동화하는 것.
  • 코드 변경 사항과 리뷰의 더 나은 의미 표현을 학습함으로써 코드 리뷰 추천의 정확도를 향상시키는 것.
  • 코드에서의 OOV(Out-of-vocabulary) 단어 문제를 해결하기 위해 단어 수준과 문자 수준의 임베딩을 조합하는 것.
  • 코드 변경 사항과 리뷰 쌍만을 사용하여 변경 사항과 리뷰 간의 관련성 학습을 위한 모델 개발.
  • 정량적 평가와 경험이 풍부한 개발자들의 정성적 피드백을 통해 모델의 효과성을 검증하는 것.

제안 방법

  • CORE는 코드 변경 사항과 리뷰를 표현하기 위해 단어 수준과 문자 수준의 임베딩을 조합하는 다수준 임베딩 전략을 사용한다.
  • 모델은 주의 메커니즘을 활용하여 코드 변경 사항과 리뷰 간의 관련성 점수를 계산하며, 의미적으로 중요한 부분에 집중한다.
  • 단어 임베딩은 코드 토큰에서 학습되며, 문자 임베딩은 희귀하거나 알 수 없는 토큰을 처리하기 위해 부분 단어 패턴을 캡처한다.
  • 주의 메커니즘은 예측 과정에서 코드 변경 사항과 리뷰의 중요한 토큰에 대해 동적으로 가중치를 할당한다.
  • 모델은 외부 코드 컨텍스트 없이 GitHub 리포지토리에서의 코드 변경-리뷰 쌍을 엔드 투 엔드로 훈련한다.
  • 계층적 주의 메커니즘을 통해 모델은 동시에 관련 있는 코드 섹션과 리뷰 댓글에 집중할 수 있다.

실험 결과

연구 질문

  • RQ1전체 소스 코드에 접근하지 않고도 코드 변경 사항과 이력 리뷰만을 사용하여 관련 코드 리뷰를 추천할 수 있는 딥러닝 모델이 존재하는가?
  • RQ2단어 수준과 문자 수준의 다수준 임베딩 접근법이 코드 변경 사항과 리뷰의 의미를 얼마나 잘 포착하는가?
  • RQ3기본 모델 대비 주의 메커니즘이 코드 변경 사항과 리뷰 간의 관련성 예측에 얼마나 향상되는가?
  • RQ4실제 코드 리뷰 데이터에서 CORE는 DeepMem과 같은 최신 기술 모델 대비 검색 성능에서 어떻게 비교되는가?
  • RQ5경험이 풍부한 개발자들이 추천된 리뷰를 얼마나 실용적이고 관련성이 있다고 평가하는가?

주요 결과

  • CORE는 19개의 인기 있는 자바 프로젝트에서 최신 기술 모델인 DeepMem 대비 Recall@10에서 131.03% 향상되었다.
  • CORE는 평균 역수 순위(MRR)에서 DeepMem 대비 150.69% 향상되어 관련 리뷰의 순위가 더 우수함을 시사한다.
  • 경험이 풍부한 개발자들과의 정성적 분석을 통해 CORE가 생성한 추천이 실무에서 관련성 있고 유용함을 확인하였다.
  • 단어 수준과 문자 수준의 임베딩 조합은 특히 희귀하거나 OOV 토큰이 많은 코드에서 표현 학습을 크게 향상시킨다.
  • 주의 메커니즘이 핵심 코드 요소와 리뷰 문구를 효과적으로 강조하여 예측 정확도를 향상시켰다.
  • 모델는 전체 소스 코드에 접근하지 못하는 상황에서도 잘 작동하여, 풀 리퀘스트 시스템에 실질적으로 구현 가능한 것으로 나타났다.

더 나은 연구,지금 바로 시작하세요

논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.

카드 등록 없음 · 무료 플랜 제공

이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.