CUTE: A Collaborative Fusion Representation-Based Fine-Tuning and Retrieval Framework for Code Search

Song, Qihong and Liu, Jianxun and Hu, Haize (2024) CUTE: A Collaborative Fusion Representation-Based Fine-Tuning and Retrieval Framework for Code Search. In: Collaborative Computing: Networking, Applications and Worksharing. 19th EAI International Conference, CollaborateCom 2023, Corfu Island, Greece, October 4-6, 2023, Proceedings, Part I.

[thumbnail of 75708.pdf] PDF
75708.pdf

Download (604kB)

Abstract

Code search aims at searching semantically related code snippets from the large-scale database based on a given natural descriptive query. Fine-tuning pre-trained models for code search tasks has recently emerged as a new trend. However, most studies fine-tune models merely using metric learning, overlooking the beneficial effect of the collaborative relationship between code and query. In this paper, we introduce an effective fine-tuning and retrieval framework called CUTE. In the fine-tuning component, we propose a Collaborative Fusion Representation (CFR) consisting of three stages: pre-representation, collaborative representation, and residual fusion. CFR enhances the representation of code and query, considering token-level collaborative features between code and query. Furthermore, we apply augmentation techniques to generate vector-level hard negative samples for training, which further improves the ability of the pre-trained model to distinguish and represent features during fine-tuning. In the retrieval component, we introduce a two-stage retrieval architecture that includes pre-retrieval and refined ranking, significantly reducing time and computational resource consumption. We evaluate CUTE with three advanced pre-trained models on CodeSearchNet consisting of six programming languages. Extensive experiments demonstrate the fine-tuning effectiveness and retrieval efficiency of CUTE.

Item Type: Conference or Workshop Item (UNSPECIFIED)
Uncontrolled Keywords: Code search, Collaborative fusion representation, Fine tuning, Hard negative sample, Data augmentation
Date Deposited: 04 Mar 2026 19:24
Last Modified: 20 Nov 2026 11:51
URI: https://eprints.eai.eu/id/eprint/56364

Actions (login required)

View Item
View Item