arXiv:2601.21649cs.LGcs.AI2026-01

用仓库为中心学习训练小模型,让代码助手更懂特定项目。

SWE-Spot: Building Small Repo-Experts with Repository-Centric Learning

  • 以单个代码库深度学习替代多任务泛化,提升模型对具体项目的理解能力。
  • SWE-Spot-4B在多个编程任务上超越更大规模开源模型和高效商用模型。
  • 适合需要私密性、低资源的代码生成与维护场景,如企业内部工具开发。

在隐私敏感和资源受限环境中部署代码智能体,推动对具备开放权重的小型语言模型(SLMs)的需求。然而,这些模型存在根本性能力差距:与前沿大模型不同,它们缺乏推理时处理复杂、陌生代码库的强泛化能力。我们发现,当前主流的任务中心学习(TCL)范式通过跨多个仓库广泛暴露数据,无法解决这一问题。为此,我们提出仓库中心学习(RCL),一种范式转变——优先关注单个仓库的纵向深度,而非横向任务广度。该方法主张小模型应通过参数化知识获取,内化目标软件环境的“内在规律”,而非依赖昂贵的推理时搜索来恢复。基于此,我们设计四单元仓库中心体验,将静态代码库转化为交互式学习信号,训练出SWE-Spot-4B系列高度紧凑的模型。这些模型作为专精于特定仓库的专家,打破既有的缩放规律,在多个软件工程任务中表现优于更大的开源模型(如Meta的CWM、Qwen3-Coder-30B),并超越或匹配效率导向的商业模型(如GPT-4.1-mini、GPT-5-nano)。进一步分析表明,RCL具有更高的训练样本效率和更低的推理成本,强调对于构建高效智能体,掌握仓库特性是与通用编码能力相辅相成的关键维度。

原文摘要 · Abstract (English)

The deployment of coding agents in privacy-sensitive and resource-constrained environments drives the demand for capable open-weight Small Language Models (SLMs). However, they suffer from a fundamental capability gap: unlike frontier large models, they lack the inference-time strong generalization to work with complicated, unfamiliar codebases. We identify that the prevailing Task-Centric Learning (TCL) paradigm, which scales exposure across disparate repositories, fails to address this limitation. In response, we propose Repository-Centric Learning (RCL), a paradigm shift that prioritizes vertical repository depth over horizontal task breadth, suggesting SLMs must internalize the "physics" of a target software environment through parametric knowledge acquisition, rather than attempting to recover it via costly inference-time search. Following this new paradigm, we design a four-unit Repository-Centric Experience, transforming static codebases into interactive learning signals, to train SWE-Spot-4B, a family of highly compact models built as repo-specialized experts that breaks established scaling trends, outperforming open-weight models up to larger (e.g., CWM by Meta, Qwen3-Coder-30B) and surpassing/matching efficiency-focused commercial models (e.g., GPT-4.1-mini, GPT-5-nano) across multiple SWE tasks. Further analysis reveals that RCL yields higher training sample efficiency and lower inference costs, emphasizing that for building efficient intelligence, repository mastery is a distinct and necessary dimension that complements general coding capability.

小模型代码生成仓库学习

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