• Home
  • Search
  • Evaluating few-shot and contrastive learning methods for code clone detection
  • Cite Icon7
  • https://doi.org/10.1007/s10664-024-10441-zCopy DOI Icon

Evaluating few-shot and contrastive learning methods for code clone detection

Show More
  • Abstract
  • Literature Map
  • References
  • Citations
  • Similar Papers
Abstract

Code Clone Detection (CCD) is a software engineering task that is used for plagiarism detection, code search, and code comprehension. Recently, deep learning-based models have achieved an F1-Score (a metric used to assess classifiers) of $$\sim $$ 95% on the CodeXGLUE benchmark. These models require many training data, mainly fine-tuned on Java or C++ datasets. However, no previous study evaluates the generalizability of these models where a limited amount of annotated data is available. The main objective of this research is to assess the ability of the CCD models as well as few-shot learning algorithms for unseen programming problems and new languages (i.e., the model is not trained on these problems/languages). We assess the generalizability of the state-of-the-art models for CCD in few-shot settings (i.e., only a few samples are available for fine-tuning) by setting three scenarios: i) unseen problems, ii) unseen languages, iii) combination of new languages and new problems. We choose CodeNet and conduct our experiments on Java, C++, and Ruby languages. Then, we employ Model Agnostic Meta-learning (MAML), where the model learns a meta-learner capable of extracting transferable knowledge from the train set; so that the model can be fine-tuned using a few samples. Finally, we combine contrastive learning with MAML to further study whether it can improve the results of MAML. Our results show that the performance of the models drops $$\sim 50\%$$ for Java and $$\sim 20\%$$ for C++ and Ruby for unseen problems, which are then boosted by $$13\%$$ to $$24\%$$ F1 scores for Java and C++/Ruby, respectively when MAML is used. Similar observations are found for unseen languages and the third scenario. Though in case of third scenario (i.e., unseen problems and unseen languages) the scores are lower. Integrating contrastive learning with MAML did not help in boosting the performance more than what we could achieve with MAML. Our results open new avenues of research and the need to develop robust models for clone detection, in the settings we investigated here.

Similar Papers
  • Research Article

Global and Local Attention-Based Multiscale Prototypical Network for Few-Shot Learning

  • Aug 25, 2025
  • IEEE Transactions on Emerging Topics in Computational Intelligence
  • Qianhao Yu +1
  • Research Article
  • Citations24

Dataset Bias in Few-Shot Image Recognition.

  • Jan 01, 2023
  • IEEE Transactions on Pattern Analysis and Machine Intelligence
  • Shuqiang Jiang +5
  • Research Article
  • Citations48

Multi-Learner Based Deep Meta-Learning for Few-Shot Medical Image Classification.

  • Jan 01, 2023
  • IEEE Journal of Biomedical and Health Informatics
  • Hongyang Jiang +5
  • Research Article

Comparative Study of GPT-4Vision and Convolutional Neural Networks in Histopathological Image Analysis

  • Oct 15, 2024
  • American Journal of Clinical Pathology
  • S Koga +2
  • PDF
  • Research Article
  • Citations7

Robust Compare Network for Few-Shot Learning

  • Jan 01, 2020
  • IEEE Access
  • Yixin Yang +4
  • Conference Article
  • Citations6

Generally Boosting Few-Shot Learning with HandCrafted Features

  • Oct 17, 2021
  • Yi Zhang +2
  • Conference Article
  • Citations130

Exploring Complementary Strengths of Invariant and Equivariant Representations for Few-Shot Learning

  • Jun 01, 2021
  • Mamshad Nayeem Rizve +3
  • PDF
  • Research Article
  • Citations1

Cross-Domain Few-Shot Learning Based on Data Corruption and Dual Attention Mechanism

  • Apr 12, 2025
  • Neural Processing Letters
  • Shih-Hsiung Lee +2
  • Conference Article
  • Citations67

Rethinking Class Relations: Absolute-relative Supervised and Unsupervised Few-shot Learning

  • Jun 01, 2021
  • Hongguang Zhang +4
  • Book Chapter
  • Citations40

Exploiting the Matching Information in the Support Set for Few Shot Event Classification

  • Jan 01, 2020
  • Advances in Knowledge Discovery and Data Mining
  • Viet Dac Lai +2
  • PDF
  • Research Article
  • Citations28

WiGR: A Practical Wi-Fi-Based Gesture Recognition System with a Lightweight Few-Shot Network

  • Apr 07, 2021
  • Applied Sciences
  • Pengli Hu +3
  • PDF
  • Research Article
  • Citations23

Efficient Feature Learning Approach for Raw Industrial Vibration Data Using Two-Stage Learning Framework

  • Jun 25, 2022
  • Sensors (Basel, Switzerland)
  • Mohamed-Ali Tnani +2
  • Conference Article
  • Citations9

From Human Days to Machine Seconds: Automatically Answering and Generating Machine Learning Final Exams

  • Aug 04, 2023
  • Iddo Drori +15
  • PDF
  • Research Article
  • Citations37

Multi-task learning for few-shot biomedical relation extraction

  • Apr 19, 2023
  • Artificial Intelligence Review
  • Vincenzo Moscato +3
  • Research Article
  • Citations43

Personalized Federated Few-Shot Learning.

  • Feb 01, 2024
  • IEEE Transactions on Neural Networks and Learning Systems
  • Yunfeng Zhao +6
Cactus Communications logo

Copyright 2026 Cactus Communications. All rights reserved.