Lode

Stand on the shoulders of giants.

Open the curator →
Source
arXiv
Published
Runtime
0:00
Snippets
4

A conversation between

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

Waveform of the source interview with highlighted segments per snippet.
0:00 0:00

§02

Snippets

  1. Function-aware fill-in-the-middle mid-training masks functions via program dependency graphs, exposing agents to the action-observation-continuation loop structure that mirrors function calls.

    This self-supervised objective directly trains the conditioning structure agents need, improving SWE-Bench-Verified by +2.8–+3.2 across models.

  2. The action-observation-continuation loop of a coding agent is structurally isomorphic to a function call site; this conditioning pattern exists at internet scale in ordinary code repositories.

    This insight shows that agents can reuse a natural inductive bias already present in code without requiring synthetic agent data.

  3. Mid-training mitigates capability erosion on non-agent tasks (LiveCodeBench, tau-bench, BFCL), with gains persisting even though the corpus contains Python code only.

    The function-call inductive bias acts as a regularizer, letting agents improve without sacrificing general coding or tool-use skills.

  4. Selection uses program dependency graph analysis and a complexity-inferability double criterion to choose functions whose masking is both meaningful and learnable.

    Smart masking avoids noise and focuses training signal on the conditioning patterns agents genuinely need.

§03

Synthesis

The Core Insight

Coding agents need to handle a specific problem that standard language model pretraining barely addresses: integrating tool outputs mid-reasoning. When an agent calls a tool (like running code or querying a database), it gets back a result and must continue from there. The authors noticed this mirrors a universal structure in code itself—function calls. A function receives arguments, returns a computed value, and the caller uses that result downstream. Since this pattern saturates real codebases, the authors propose exploiting it through targeted pretraining.

How Function-Aware Fill-in-the-Middle Works

Standard fill-in-the-middle training masks random code spans and trains models to predict them. The authors' variant is selective: instead of random masking, they use program dependency graphs (which track how data flows through code) to identify functions worth masking, then apply a "complexity-inferability" filter. This double criterion means they target functions that are complex enough to be non-trivial but whose outputs are inferable from context—mirroring the agent scenario where tool outputs are often predictable from what you asked the tool to do.

They mid-trained existing Qwen models (7B, 14B variants, and Qwen3-8B) on 2.6 billion tokens of decontaminated Python code from 968 GitHub repositories. This sits between pretraining and post-training in the pipeline—hence "mid-training."

Why This Matters

The results are consistent and substantial. On SWE-Bench-Verified (a benchmark for software engineering agents), mid-training gave +2.8 to +3.2 point improvements depending on model size. SWE-Bench-Lite saw larger gains: +3.7 to +5.4 points. Importantly, these gains persisted across two different post-training pipelines (R2E-Gym and SWE-Smith), suggesting the effect is robust.

But the deeper payoff emerges elsewhere. Agentic post-training typically degrades performance on non-agent tasks—the model optimizes for tool-use and loses general coding ability. Mid-training mitigated this erosion on LiveCodeBench (general coding), tau-bench and BFCL (tool-use without agents). This happened even though the mid-training corpus was Python-only, suggesting the function-call inductive bias generalizes.

The contribution is methodologically lean: no architectural changes, no new objectives beyond selective masking, and no external data beyond GitHub. It's a mid-training stage that makes agent-style reasoning more natural by pre-exposing models to the structural pattern they'll encounter. For practitioners building coding agents, this is a straightforward win—insert a 2.6B-token training phase and gain 3–5 points on standard benchmarks while protecting non-agent capabilities.

Mine your own.

Lode is a workbench, not a feed. Paste a YouTube URL. The model proposes a transcript, a set of quote-grounded snippets, a synthesis essay, and the fan-out. You decide what stays.

Open the curator