FMCS: Improving Code Search by Multi-Modal Representation Fusion and Momentum Contrastive Learning
Wenjie Liu, Gong Chen, Xiaoyuan Xie · 2024
Code search is a critical task in software engineering, which is to search relevant codes from the codebase based on the natural language query. Although existing code search methods based on multi-modal contrast learning have achieved advanced performance, these methods still have limitations in the representation learning of multi-modal data and do not sufficiently explore the role of functionally equivalent code pairs in representation learning. To address these limitations, we propose a code search framework based on multi-modal representation fusion and momentum contrastive learning, named FMCS. We effectively retain the semantic and structural information of the code by multi-modal representation fusion. We further learn the correlation between the relevant samples by the momentum contrastive learning between samples. The experimental results on the CodeSearchNet benchmark show the effectiveness of FMCS.