Using a Nearest-Neighbour, BERT-Based Approach for Scalable Clone Detection

09/05/2023
by   Muslim Chochlov, et al.
0

Code clones can detrimentally impact software maintenance and manually detecting them in very large codebases is impractical. Additionally, automated approaches find detection of Type 3 and Type 4 (inexact) clones very challenging. While the most recent artificial deep neural networks (for example BERT-based artificial neural networks) seem to be highly effective in detecting such clones, their pairwise comparison of every code pair in the target system(s) is inefficient and scales poorly on large codebases. We therefore introduce SSCD, a BERT-based clone detection approach that targets high recall of Type 3 and Type 4 clones at scale (in line with our industrial partner's requirements). It does so by computing a representative embedding for each code fragment and finding similar fragments using a nearest neighbour search. SSCD thus avoids the pairwise-comparison bottleneck of other Neural Network approaches while also using parallel, GPU-accelerated search to tackle scalability. This paper details the approach and an empirical assessment towards configuring and evaluating that approach in industrial setting. The configuration analysis suggests that shorter input lengths and text-only based neural network models demonstrate better efficiency in SSCD, while only slightly decreasing effectiveness. The evaluation results suggest that SSCD is more effective than state-of-the-art approaches like SAGA and SourcererCC. It is also highly efficient: in its optimal setting, SSCD effectively locates clones in the entire 320 million LOC BigCloneBench (a standard clone detection benchmark) in just under three hours.

READ FULL TEXT
research
06/01/2023

Feature Engineering-Based Detection of Buffer Overflow Vulnerability in Source Code Using Neural Networks

One of the most significant challenges in the field of software code aud...
research
09/12/2019

Human-Machine Collaborative Design for Accelerated Design of Compact Deep Neural Networks for Autonomous Driving

An effective deep learning development process is critical for widesprea...
research
05/11/2021

Integrating extracted information from bert and multiple embedding methods with the deep neural network for humour detection

Humour detection from sentences has been an interesting and challenging ...
research
09/10/2020

Globally-scalable Automated Target Recognition (GATR)

GATR (Globally-scalable Automated Target Recognition) is a Lockheed Mart...
research
08/27/2019

Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks

BERT (Devlin et al., 2018) and RoBERTa (Liu et al., 2019) has set a new ...
research
09/14/2021

Semantic Answer Type Prediction using BERT: IAI at the ISWC SMART Task 2020

This paper summarizes our participation in the SMART Task of the ISWC 20...
research
05/26/2020

How to Grow a (Product) Tree: Personalized Category Suggestions for eCommerce Type-Ahead

In an attempt to balance precision and recall in the search page, leadin...

Please sign up or login with your details

Forgot password? Click here to reset