LoRACode: LoRA Adapters for Code Embeddings

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Chaturvedi, Saumya, Chadha, Aman, Bindschaedler, Laurent
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866913869326188544
author Chaturvedi, Saumya
Chadha, Aman
Bindschaedler, Laurent
author_facet Chaturvedi, Saumya
Chadha, Aman
Bindschaedler, Laurent
contents Code embeddings are essential for semantic code search; however, current approaches often struggle to capture the precise syntactic and contextual nuances inherent in code. Open-source models such as CodeBERT and UniXcoder exhibit limitations in scalability and efficiency, while high-performing proprietary systems impose substantial computational costs. We introduce a parameter-efficient fine-tuning method based on Low-Rank Adaptation (LoRA) to construct task-specific adapters for code retrieval. Our approach reduces the number of trainable parameters to less than two percent of the base model, enabling rapid fine-tuning on extensive code corpora (2 million samples in 25 minutes on two H100 GPUs). Experiments demonstrate an increase of up to 9.1% in Mean Reciprocal Rank (MRR) for Code2Code search, and up to 86.69% for Text2Code search tasks across multiple programming languages. Distinction in task-wise and language-wise adaptation helps explore the sensitivity of code retrieval for syntactical and linguistic variations. To foster research in this area, we make our code and pre-trained models publicly available.
format Preprint
id arxiv_https___arxiv_org_abs_2503_05315
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle LoRACode: LoRA Adapters for Code Embeddings
Chaturvedi, Saumya
Chadha, Aman
Bindschaedler, Laurent
Machine Learning
Information Retrieval
Software Engineering
Code embeddings are essential for semantic code search; however, current approaches often struggle to capture the precise syntactic and contextual nuances inherent in code. Open-source models such as CodeBERT and UniXcoder exhibit limitations in scalability and efficiency, while high-performing proprietary systems impose substantial computational costs. We introduce a parameter-efficient fine-tuning method based on Low-Rank Adaptation (LoRA) to construct task-specific adapters for code retrieval. Our approach reduces the number of trainable parameters to less than two percent of the base model, enabling rapid fine-tuning on extensive code corpora (2 million samples in 25 minutes on two H100 GPUs). Experiments demonstrate an increase of up to 9.1% in Mean Reciprocal Rank (MRR) for Code2Code search, and up to 86.69% for Text2Code search tasks across multiple programming languages. Distinction in task-wise and language-wise adaptation helps explore the sensitivity of code retrieval for syntactical and linguistic variations. To foster research in this area, we make our code and pre-trained models publicly available.
title LoRACode: LoRA Adapters for Code Embeddings
topic Machine Learning
Information Retrieval
Software Engineering
url https://arxiv.org/abs/2503.05315