[논문 리뷰] On the Feasibility of Transfer-learning Code Smells using Deep Learning
이 논문은 C# 및 자바에서 코드 냄새를 탐지하기 위해 딥러닝(특히 CNN 및 RNN)과 전이학습을 조합하는 것이 가능한지 조사한다. 전이학습을 통해 언어 간에 효과적인 냄새 탐지가 가능하며, 특히 실행 구현 냄새의 경우 직접 학습과 비교해도 성능이 유사함을 입증한다.
Context: A substantial amount of work has been done to detect smells in source code using metrics-based and heuristics-based methods. Machine learning methods have been recently applied to detect source code smells; however, the current practices are considered far from mature. Objective: First, explore the feasibility of applying deep learning models to detect smells without extensive feature engineering, just by feeding the source code in tokenized form. Second, investigate the possibility of applying transfer-learning in the context of deep learning models for smell detection. Method: We use existing metric-based state-of-the-art methods for detecting three implementation smells and one design smell in C# code. Using these results as the annotated gold standard, we train smell detection models on three different deep learning architectures. These architectures use Convolution Neural Networks (CNNs) of one or two dimensions, or Recurrent Neural Networks (RNNs) as their principal hidden layers. For the first objective of our study, we perform training and evaluation on C# samples, whereas for the second objective, we train the models from C# code and evaluate the models over Java code samples. We perform the experiments with various combinations of hyper-parameters for each model. Results: We find it feasible to detect smells using deep learning methods. Our comparative experiments find that there is no clearly superior method between CNN-1D and CNN-2D. We also observe that performance of the deep learning models is smell-specific. Our transfer-learning experiments show that transfer-learning is definitely feasible for implementation smells with performance comparable to that of direct-learning. This work opens up a new paradigm to detect code smells by transfer-learning especially for the programming languages where the comprehensive code smell detection tools are not available.
연구 동기 및 목표
- 딥러닝 모델이 광범위한 수동 특징 공학 없이도 코드 냄새를 탐지할 수 있는지 평가하는 것.
- 다른 프로그래밍 언어 간에 전이학습이 코드 냄새 탐지에 효과적으로 적용될 수 있는지 조사하는 것.
- 딥러닝 모델(CNN 및 RNN)이 C# 및 자바에서 다양한 종류의 코드 냄새에 대해 어떻게 성능을 발휘하는지 평가하는 것.
- 다른 도구가 잘 갖춰지지 않은 언어에서 냄새 탐지에 전이학습의 잠재력을 탐색하는 것.
- 딥러닝을 활용한 확장 가능하고 언어에 종속되지 않는 코드 냄새 탐지 기반을 마련하는 것.
제안 방법
- C# 및 자바의 코드 샘플을 기반으로 1D 및 2D 컨volutional 신경망(CNNs)과 순환 신경망(RNNs)을 학습시켰다.
- 소스 코드를 수치 시퀀스로 변환하기 위해 토큰화를 사용하여 C# 및 자바 간의 언어 구조 등가성을 유지했다.
- 냄새 탐지의 기준으로 Designite 및 DesigniteJava를 사용하여 일관된 메트릭과 임계값을 확보했다.
- 다른 언어 간 학습 및 평가를 수행: C#에서 학습하고 자바에서 평가하거나, 그 반대로 수행하여 이식 가능성 평가를 수행했다.
- 체계적 하이퍼파라미터 튜닝을 통해 모델의 민감도와 성능 변동성을 평가했다.
- 모델을 한 언어에서 초기화하고 다른 언어에서 미세조정함으로써 공유된 학습 표현을 활용하는 전이학습을 적용했다.
실험 결과
연구 질문
- RQ1딥러닝 모델이 수동으로 설계된 특징에 의존하지 않고도 코드 냄새를 효과적으로 탐지할 수 있는가?
- RQ2다양한 종류의 코드 냄새에서 1D-CNN, 2D-CNN, RNN 등의 다양한 딥러닝 아키텍처는 어떻게 성능을 발휘하는가?
- RQ3한 언어에서 학습하고 다른 언어에서 평가할 때 전이학습이 코드 냄새 탐지에 가능할 수 있는가?
- RQ4전이학습이 대상 언어에서 직접 학습한 성능과 유사한 성능을 달성할 수 있는가?
- RQ5교차 언어 환경에서 어떤 종류의 코드 냄새가 전이학습으로 가장 많이 혜택을 보는가?
주요 결과
- 특히 RNN이 수동 특징 공학 없이도 경쟁적인 성능을 발휘하며 코드 냄새를 탐지한다.
- 1D-CNN는 빈 catch 블록 및 다면적 추상화 냄새 탐지에서 2D-CNN보다 뛰어난 성능을 보였고, 2D-CNN는 복잡한 메서드 및 마법의 숫자 냄새 탐지에서 더 우수한 성능을 보였다.
- RNN은 빈 catch 블록 및 마법의 숫자 냄새 탐지에서 CNN보다 유의미하게 높은 성능을 보였다.
- 전이학습은 실행 구현 냄새 탐지에 대해 실현 가능했으며, 대상 언어에서 직접 학습한 성능과 유사한 성능을 달성했다.
- 연구 결과는 전이학습이 전용 탐지 도구가 없는 프로그래밍 언어에서 코드 냄새 탐지에 실질적인 대안가능성을 확인한다.
- 이 접근법은 프로그래밍 언어에 종속되지 않으며, 적절한 도구와 데이터가 확보된다면 다른 언어로도 확장 가능하다.
이 논문 읽기
누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.
누빈트에서 이 논문 읽기이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.