LoRACode: コード埋め込みのためのLoRAアダプター
LoRACode: LoRA Adapters for Code Embeddings
March 7, 2025
著者: Saumya Chaturvedi, Aman Chadha, Laurent Bindschaedler
cs.AI
要旨
コード埋め込みはセマンティックコード検索において不可欠であるが、現在のアプローチではコードに内在する正確な構文や文脈のニュアンスを捉えるのに苦戦することが多い。CodeBERTやUniXcoderなどのオープンソースモデルは、スケーラビリティと効率性に制限があり、高性能なプロプライエタリシステムは多大な計算コストを課す。本論文では、Low-Rank Adaptation(LoRA)に基づくパラメータ効率の良いファインチューニング手法を導入し、コード検索のためのタスク特化型アダプターを構築する。このアプローチにより、学習可能なパラメータ数をベースモデルの2%未満に削減し、大規模なコードコーパス(2H100 GPU上で200万サンプルを25分)での迅速なファインチューニングを可能にする。実験では、Code2Code検索において最大9.1%、Text2Code検索タスクでは最大86.69%のMean Reciprocal Rank(MRR)の向上を複数のプログラミング言語で実証した。タスクごとと言語ごとの適応の違いを分析することで、構文と言語的バリエーションに対するコード検索の感度を探ることができる。
English
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.Summary
AI-Generated Summary