Funktionsbewusstes Fill-in-the-Middle als Mid-Training für Foundation-Modelle für Code-Agenten
Function-Aware Fill-in-the-Middle as Mid-Training for Coding Agent Foundation Models
July 14, 2026
Autoren: Yubo Wang, Jiarong Liang, Yuxuan Zhang, Xuye Liu, Cong Wei, Yuyu Zhang, Ping Nie, Wenhu Chen
cs.AI
Zusammenfassung
Coding Agents müssen externe Tool-Rückgaben in laufende Überlegungen integrieren – eine Fähigkeit, die das standardmäßige links-nach-rechts Pre-Training auf Code nur in seiner Vorwärtsrichtung offenbart. Wir beobachten, dass die Aktions-Beobachtungs-Fortsetzungsschleife eines Coding Agents strukturell isomorph zu einer Funktionsaufrufstelle ist, bei der ein Aufrufer Argumente bindet, eine aufgerufene Funktion einen anderswo berechneten Wert zurückgibt und nachgelagerter Code diesen Wert verbraucht. Diese Konditionierungsstruktur existiert in gewöhnlichem Code in Internetmaßstab. Wir nutzen sie durch funktionsbewusstes Fill-in-the-Middle (FIM) Mid-Training: ein selbstüberwachtes Ziel, das ausgewählte Funktionen mittels Programmabhängigkeitsgraph-Analyse und einem Doppelkriterium aus Komplexität und Inferabilität maskiert. Wir trainieren Qwen2.5-Coder-Instruct (7B/14B) und Qwen3-8B auf einem 2,6B-Token großen, dekontaminierten Korpus aus 968 GitHub-Repositories und wenden dann bestehende agentische Post-Training-Pipelines an. Mid-Training verbessert SWE-Bench-Verified um +2,8/+3,0 bei 7B/14B und um +3,2 bei Qwen3-8B; die Gewinne bei SWE-Bench-Lite betragen +3,7/+4,0/+5,4 für dieselben Modelle. Die Verbesserung bleibt über zwei Post-Training-Pipelines (R2E-Gym, SWE-Smith) und auf einer Nicht-Qwen2.5-Basis (Qwen3-8B mit SWE-Lego) bestehen. Über die domäneninternen Gewinne hinaus mildert Mid-Training auch die Fähigkeitserosion, die agentisches Post-Training sonst bei nicht-agentischem Codieren (z. B. LiveCodeBench) und nicht-codierenden Tool-Use-Benchmarks (tau-bench, BFCL) verursacht: Obwohl der Mid-Training-Korpus nur Python-Code enthält, überlebt die Funktionsaufruf-Induktionsvoreingenommenheit das Post-Training und erzielt konsistente Verbesserungen.
English
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.