arXiv:2509.25716cs.SEcs.AI2025-09

让代码补全更懂上下文,实时精准推荐所需API。

DeepCodeSeek: Real-Time API Retrieval for Context-Aware Code Generation

  • 构建新数据集,用真实企业代码训练模型识别模糊的API调用意图。
  • 顶40准确率达87.86%,0.6B小模型性能超8B大模型。
  • 适合需要低延迟、高精度的智能编码助手与企业级AI应用。

现有搜索技术仅适用于标准RAG查询-文档场景。本文提出一种新方法,扩展代码索引以预测所需API,直接支持高质量端到端代码生成,适用于自动补全和代理型AI应用。为解决当前代码-代码基准数据集中存在的API泄露问题,我们基于真实世界ServiceNow Script Includes构建了新数据集,捕捉代码中模糊的API使用意图挑战。评估显示,该方法在顶40检索准确率上达87.86%,有效获取下游代码生成所需关键上下文。为实现实时预测,我们设计了综合微调流程:通过合成数据生成、监督微调与强化学习优化一个0.6B参数的重排序器。该紧凑模型在性能上超越更大规模的8B模型,同时保持2.5倍更低延迟,有效应对企业代码特有复杂性而无需高昂计算开销。

原文摘要 · Abstract (English)

Current search techniques are limited to standard RAG query-document applications. In this paper, we propose a novel technique to expand the code and index for predicting the required APIs, directly enabling high-quality, end-to-end code generation for auto-completion and agentic AI applications. We address the problem of API leaks in current code-to-code benchmark datasets by introducing a new dataset built from real-world ServiceNow Script Includes that capture the challenge of unclear API usage intent in the code. Our evaluation metrics show that this method achieves 87.86% top-40 retrieval accuracy, allowing the critical context with APIs needed for successful downstream code generation. To enable real-time predictions, we develop a comprehensive post-training pipeline that optimizes a compact 0.6B reranker through synthetic dataset generation, supervised fine-tuning, and reinforcement learning. This approach enables our compact reranker to outperform a much larger 8B model while maintaining 2.5x reduced latency, effectively addressing the nuances of enterprise-specific code without the computational overhead of larger models.

代码生成API检索实时推理企业代码

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。