HACS: An Enhancement Framework for Deep Code Search Benefiting from Hard Negative Samples (S)

Code search aims to retrieve relevant code snippets from large code repositories based on query, promoting code reuse and enhancing software development efficiency.Deep Learning is a powerful approach for code search, in which the hard negative samples within training batches critically impact model performance.However, most existing deep code search models only randomly sample negative samples, resulting in a paucity or complete lack of hard negative samples.To address this limitation, we introduce a novel enhancement framework named HACS to optimize the composition of negative samples within batches, thus enhancing the training effectiveness of deep code search models.The core idea is to increase the count of hard negative samples within the negative samples corresponding to each query in the training batch.Specifically, HACS utilizes deep reinforcement learning techniques for sampling hard negative samples and implements vector-level mixed data augmentation strategy to generate hard negative samples.We evaluated our framework on a public dataset covering six programming languages.Experimental results reveal that HACS significantly improves the code search performance of existing models.

Authors

Institutions

Publication Details

Journal
Proceedings/Proceedings of the ... International Conference on Software Engineering and Knowledge Engineering
Published
2024-10-28
DOI
https://doi.org/10.18293/seke2024-104
Primary Topic
Machine Learning and Data Classification
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

HACS: An Enhancement Framework for Deep Code Search Benefiting from Hard Negative Samples (S)

Haize Hu, Jianxun Liu, Qihong Song
Proceedings/Proceedings of the ... International Conference on Software Engineering and Knowledge Engineering
Machine Learning and Data Classification
article

HACS: An Enhancement Framework for Deep Code Search Benefiting from Hard Negative Samples (S)

Haize Hu, Jianxun Liu, Qihong Song
article en

Abstract

Code search aims to retrieve relevant code snippets from large code repositories based on query, promoting code reuse and enhancing software development efficiency.Deep Learning is a powerful approach for code search, in which the hard negative samples within training batches critically impact model performance.However, most existing deep code search models only randomly sample negative samples, resulting in a paucity or complete lack of hard negative samples.To address this limitation, we introduce a novel enhancement framework named HACS to optimize the composition of negative samples within batches, thus enhancing the training effectiveness of deep code search models.The core idea is to increase the count of hard negative samples within the negative samples corresponding to each query in the training batch.Specifically, HACS utilizes deep reinforcement learning techniques for sampling hard negative samples and implements vector-level mixed data augmentation strategy to generate hard negative samples.We evaluated our framework on a public dataset covering six programming languages.Experimental results reveal that HACS significantly improves the code search performance of existing models.

Proceedings/Proceedings of the ... International Conference on Software Engineering and Knowledge EngineeringVol. 2024
Hunan University of Science and Technology (CN)
Reduced inequalities
Openalex Percentile: Top 77%
Machine Learning and Data Classification
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.