Papers
arxiv:2607.12463

Function-Aware Fill-in-the-Middle as Mid-Training for Coding Agent Foundation Models

Published on Jul 14
· Submitted by
Yubo Wang
on Jul 15
#1 Paper of the day
Authors:
,
,
,
,
,
,
,

Abstract

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.

Community

Paper submitter

We introduce function-aware fill-in-the-middle (FIM) mid-training for coding agent foundation models. We argue that, rather than relying solely on scaling synthetic agent trajectories during post-training, one should exploit the structure already present in ordinary code: a function call site (call → return → downstream usage) is structurally isomorphic to a coding agent step (action → observation → continuation), making source code an internet-scale supply of agent-relevant training signal. Mid-training on functions selected via program dependency graph analysis consistently improves SWE-Bench across model sizes and post-training pipelines, and recovers the general coding and tool-use capabilities that agentic post-training otherwise erodes. We provide the full 968-repository decontaminated corpus (400K FIM samples, 2.6B tokens), the function selection pipeline, and all mid-trained checkpoints.

This is an automated message from the Librarian Bot. I found the following papers similar to this paper.

The following papers were recommended by the Semantic Scholar API

Please give a thumbs up to this comment if you found it helpful!

If you want recommendations for any Paper on Hugging Face checkout this Space

You can directly ask Librarian Bot for paper recommendations by tagging it in a comment: @librarian-bot recommend

👍👍👍

Sign up or log in to comment

Get this paper in your agent:

hf papers read 2607.12463
Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash

Models citing this paper 6

Browse 6 models citing this paper

Datasets citing this paper 1

Spaces citing this paper 0

No Space linking this paper

Cite arxiv.org/abs/2607.12463 in a Space README.md to link it from this page.

Collections including this paper 1