Towards A Generalist Code Embedding Model Based On Massive Data Synthesis

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Li, Chaofan, Chen, Jianlyu, Shao, Yingxia, Lian, Defu, Liu, Zheng
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866915291961753600
author Li, Chaofan
Chen, Jianlyu
Shao, Yingxia
Lian, Defu
Liu, Zheng
author_facet Li, Chaofan
Chen, Jianlyu
Shao, Yingxia
Lian, Defu
Liu, Zheng
contents Code embedding models attract increasing attention due to the widespread popularity of retrieval-augmented generation (RAG) in software development. These models are expected to capture the rich semantic relationships inherent to code, which differ significantly from those found in text. However, existing models remain severely limited due to the scarcity of high-quality training data. In this work, we introduce \textbf{CodeR} (\underline{Code} \underline{R}etrieval), a state-of-the-art embedding model for general-purpose code retrieval. The superior performance of CodeR is built upon CodeR-Pile, a large-scale synthetic dataset constructed under the DRU (Diversity, Reliability, Usability) principle via a novel data synthesis pipeline. To optimize training effectiveness, we propose Annealing, a curriculum learning strategy that enables effective knowledge transfer across heterogeneous sources of data. We evaluate CodeR based on 16 diverse code retrieval tasks, where it significantly outperforms existing baselines and exhibits strong out-of-domain generalization performance. We have publicly released our code and the well-trained model to facilitate further research in this critical area. https://github.com/FlagOpen/FlagEmbedding/tree/master/research/BGE_Coder.
format Preprint
id arxiv_https___arxiv_org_abs_2505_12697
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Towards A Generalist Code Embedding Model Based On Massive Data Synthesis
Li, Chaofan
Chen, Jianlyu
Shao, Yingxia
Lian, Defu
Liu, Zheng
Information Retrieval
Code embedding models attract increasing attention due to the widespread popularity of retrieval-augmented generation (RAG) in software development. These models are expected to capture the rich semantic relationships inherent to code, which differ significantly from those found in text. However, existing models remain severely limited due to the scarcity of high-quality training data. In this work, we introduce \textbf{CodeR} (\underline{Code} \underline{R}etrieval), a state-of-the-art embedding model for general-purpose code retrieval. The superior performance of CodeR is built upon CodeR-Pile, a large-scale synthetic dataset constructed under the DRU (Diversity, Reliability, Usability) principle via a novel data synthesis pipeline. To optimize training effectiveness, we propose Annealing, a curriculum learning strategy that enables effective knowledge transfer across heterogeneous sources of data. We evaluate CodeR based on 16 diverse code retrieval tasks, where it significantly outperforms existing baselines and exhibits strong out-of-domain generalization performance. We have publicly released our code and the well-trained model to facilitate further research in this critical area. https://github.com/FlagOpen/FlagEmbedding/tree/master/research/BGE_Coder.
title Towards A Generalist Code Embedding Model Based On Massive Data Synthesis
topic Information Retrieval
url https://arxiv.org/abs/2505.12697