Skip to main content
CenXiv.org
此网站处于试运行阶段,支持我们!
我们衷心感谢所有贡献者的支持。
贡献
赞助
cenxiv logo > cs > arXiv:2508.00546

帮助 | 高级搜索

计算机科学 > 软件工程

arXiv:2508.00546 (cs)
[提交于 2025年8月1日 ]

标题: SPENCER:用于高效代码检索的自适应模型蒸馏

标题: SPENCER: Self-Adaptive Model Distillation for Efficient Code Retrieval

Authors:Wenchao Gu, Zongyi Lyu, Yanlin Wang, Hongyu Zhang, Cuiyun Gao, Michael R. Lyu
摘要: 代码检索旨在根据用户的自然语言查询为用户提供所需的代码片段。 随着深度学习技术的发展,采用预训练模型进行此任务已成为主流。 考虑到检索效率,大多数先前的方法为此任务采用双编码器,分别将描述和代码片段编码为表示向量。 然而,双编码器的模型结构往往会限制模型的性能,因为在训练过程中,模型底层缺乏代码片段和描述之间的交互。 为了在保持效率的同时提高模型的有效性,我们提出了一种框架,该框架采用自适应模型蒸馏用于高效代码检索,命名为SPENCER。 SPENCER首先采用双编码器缩小搜索空间,然后采用交叉编码器提高准确性。 为了提高SPENCER的效率,我们提出了一种新颖的模型蒸馏技术,可以在保持整体性能的同时大幅减少双编码器的推理时间。 我们还为模型蒸馏提出了一个教学助手选择策略,该策略可以在模型蒸馏过程中自适应地为不同的预训练模型选择合适的教学助手模型,以确保模型性能。 大量实验表明,与仅基于双编码器的模型相比,双编码器和交叉编码器的结合提高了整体性能。 此外,我们的模型蒸馏技术在将双编码器的推理时间减少70%的同时,保留了超过98%的整体性能。
摘要: Code retrieval aims to provide users with desired code snippets based on users' natural language queries. With the development of deep learning technologies, adopting pre-trained models for this task has become mainstream. Considering the retrieval efficiency, most of the previous approaches adopt a dual-encoder for this task, which encodes the description and code snippet into representation vectors, respectively. However, the model structure of the dual-encoder tends to limit the model's performance, since it lacks the interaction between the code snippet and description at the bottom layer of the model during training. To improve the model's effectiveness while preserving its efficiency, we propose a framework, which adopts Self-AdaPtive Model Distillation for Efficient CodE Retrieval, named SPENCER. SPENCER first adopts the dual-encoder to narrow the search space and then adopts the cross-encoder to improve accuracy. To improve the efficiency of SPENCER, we propose a novel model distillation technique, which can greatly reduce the inference time of the dual-encoder while maintaining the overall performance. We also propose a teaching assistant selection strategy for our model distillation, which can adaptively select the suitable teaching assistant models for different pre-trained models during the model distillation to ensure the model performance. Extensive experiments demonstrate that the combination of dual-encoder and cross-encoder improves overall performance compared to solely dual-encoder-based models for code retrieval. Besides, our model distillation technique retains over 98% of the overall performance while reducing the inference time of the dual-encoder by 70%.
主题: 软件工程 (cs.SE) ; 人工智能 (cs.AI)
引用方式: arXiv:2508.00546 [cs.SE]
  (或者 arXiv:2508.00546v1 [cs.SE] 对于此版本)
  https://doi.org/10.48550/arXiv.2508.00546
通过 DataCite 发表的 arXiv DOI(待注册)

提交历史

来自: Wenchao Gu [查看电子邮件]
[v1] 星期五, 2025 年 8 月 1 日 11:39:32 UTC (1,212 KB)
全文链接:

获取论文:

    查看标题为《》的 PDF
  • 查看中文 PDF
  • 查看 PDF
  • HTML(实验性)
  • TeX 源代码
  • 其他格式
许可图标 查看许可
当前浏览上下文:
cs.SE
< 上一篇   |   下一篇 >
新的 | 最近的 | 2025-08
切换浏览方式为:
cs
cs.AI

参考文献与引用

  • NASA ADS
  • 谷歌学术搜索
  • 语义学者
a 导出 BibTeX 引用 加载中...

BibTeX 格式的引用

×
数据由提供:

收藏

BibSonomy logo Reddit logo

文献和引用工具

文献资源探索 (什么是资源探索?)
连接的论文 (什么是连接的论文?)
Litmaps (什么是 Litmaps?)
scite 智能引用 (什么是智能引用?)

与本文相关的代码,数据和媒体

alphaXiv (什么是 alphaXiv?)
CatalyzeX 代码查找器 (什么是 CatalyzeX?)
DagsHub (什么是 DagsHub?)
Gotit.pub (什么是 GotitPub?)
Hugging Face (什么是 Huggingface?)
带有代码的论文 (什么是带有代码的论文?)
ScienceCast (什么是 ScienceCast?)

演示

复制 (什么是复制?)
Hugging Face Spaces (什么是 Spaces?)
TXYZ.AI (什么是 TXYZ.AI?)

推荐器和搜索工具

影响之花 (什么是影响之花?)
核心推荐器 (什么是核心?)
IArxiv 推荐器 (什么是 IArxiv?)
  • 作者
  • 地点
  • 机构
  • 主题

arXivLabs:与社区合作伙伴的实验项目

arXivLabs 是一个框架,允许合作伙伴直接在我们的网站上开发和分享新的 arXiv 特性。

与 arXivLabs 合作的个人和组织都接受了我们的价值观,即开放、社区、卓越和用户数据隐私。arXiv 承诺这些价值观,并且只与遵守这些价值观的合作伙伴合作。

有一个为 arXiv 社区增加价值的项目想法吗? 了解更多关于 arXivLabs 的信息.

这篇论文的哪些作者是支持者? | 禁用 MathJax (什么是 MathJax?)
  • 关于
  • 帮助
  • contact arXivClick here to contact arXiv 联系
  • 订阅 arXiv 邮件列表点击这里订阅 订阅
  • 版权
  • 隐私政策
  • 网络无障碍帮助
  • arXiv 运营状态
    通过...获取状态通知 email 或者 slack

京ICP备2025123034号