AI Pulse
📄 论文解读

让AI学会“填函数”:编程智能体变强的新路子

编程智能体需要一边推理一边调用外部工具,但传统AI训练只教它从左到右读代码。研究者发现,智能体的“行动-观察-继续”循环,本质上和代码里的函数调用一模一样:调用者传参,被调用者返回结果,后续代码接着用。于是他们设计了一个自监督训练方法——函数感知的中间填充(FIM),通过分析代码依赖图,专门挑出那些有复杂度和可推断性的函数,让AI练习“填空”。在7B和14B模型上,这个中间训练让SWE-Bench成绩提升了2.8到5.4个百分点,而且不仅没让AI忘记写普通代码,反而缓解了智能体训练带来的能力退化。它不是你明天就能直接用的工具,但给了一条新思路:用代码本身的结构来教AI学会工具调用。

📄 原文摘要(英文)

Coding agents must integrate external tool returns into ongoing reasoning - a capability that standard left-to-right pretraining on code exposes only in its forward direction. We observe that the action-observation-continuation loop of a coding agent is structurally isomorphic to a function call site, where a caller binds arguments, a callee returns a value computed elsewhere, and downstream code consumes that value. This conditioning structure exists at internet scale in ordinary code. We exploit it through function-aware fill-in-the-middle (FIM) mid-training: a self-supervised objective that masks functions selected via program dependency graph analysis and a complexity-inferability double criterion. We mid-train Qwen2.5-Coder-Instruct (7B/14B) and Qwen3-8B on a 2.6B-token decontaminated corpus drawn from 968 GitHub repositories, then apply existing agentic post-training pipelines. Mid-training improves SWE-Bench-Verified by +2.8/+3.0 at 7B/14B and by +3.2 on Qwen3-8B; SWE-Bench-Lite gains are +3.7/+4.0/+5.4 on the same models. The improvement holds across two post-training pipelines (R2E-Gym, SWE-Smith) and on a non-Qwen2.5 base (Qwen3-8B with SWE-Lego). Beyond in-domain gains, mid-training also mitigates the capability erosion that agentic post-training otherwise inflicts on non-agent coding (e.g., LiveCodeBench) and non-coding tool-use benchmarks (tau-bench, BFCL): although the mid-training corpus contains Python code only, the function-call inductive bias survives post-training and yields consistent gains.

arXiv 原文

订阅 AI Pulse

每天 08:00 · 12:30 · 18:30 · 23:50 更新