Function-Aware FIM Boosts Coding Agent Performance.

Yubo Wang, Jiarong Liang, Yuxuan Zhang, Xuye Liu, Cong Wei, Yuyu Zhang, Ping Nie, Wenhu Chen· July 15, 2026 View original

Summary

This paper introduces function-aware fill-in-the-middle (FIM) as a mid-training objective for coding agent foundation models, which significantly improves performance on benchmarks like SWE-Bench by aligning the agent's action-observation loop with function call structures in code. This method also mitigates capability erosion from agentic post-training.

Coding agents need to seamlessly integrate external tool outputs into their ongoing reasoning processes, a capability not fully developed by standard left-to-right code pretraining. This research identifies a structural similarity between a coding agent's action-observation-continuation loop and a function call site in code, where arguments are bound, a value is returned, and downstream code consumes it. Leveraging this insight, the authors propose function-aware fill-in-the-middle (FIM) as a mid-training objective. This self-supervised method masks functions selected via program dependency graph analysis and a complexity-inferability criterion. Applying this mid-training to models like Qwen2.5-Coder-Instruct and Qwen3-8B on a large decontaminated corpus resulted in significant performance gains on SWE-Bench-Verified (up to +3.2) and SWE-Bench-Lite (up to +5.4). Crucially, this approach also helps mitigate the common problem of capability erosion that agentic post-training often inflicts on non-agent coding tasks and other tool-use benchmarks, demonstrating a robust inductive bias even when trained only on Python code.

Why it matters

For professionals developing or utilizing AI coding agents, this research offers a powerful technique to significantly enhance agent performance on complex software engineering tasks and improve their ability to integrate external tools, leading to more capable and reliable automated development workflows.

How to implement this in your domain

  1. 1Consider incorporating function-aware fill-in-the-middle (FIM) mid-training into the development pipeline for custom coding agent foundation models.
  2. 2Evaluate existing coding agents for their ability to handle function calls and external tool integration, and look for models that have adopted similar training paradigms.
  3. 3Explore fine-tuning pre-trained LLMs with FIM-like objectives on domain-specific codebases to improve agentic capabilities.
  4. 4Design agentic workflows that explicitly leverage the function-call analogy, providing clear interfaces for tool interaction and result consumption.

Who benefits

Software DevelopmentAI DevelopmentDevOpsEdTech (for coding education tools)

Key takeaways

  • Coding agents benefit significantly from training that aligns with the structure of function calls and tool integration.
  • Function-aware fill-in-the-middle (FIM) mid-training improves agent performance on software engineering benchmarks.
  • This training method helps prevent the loss of general coding capabilities often seen after agentic post-training.
  • The approach provides a robust inductive bias for tool-use, even when trained on specific languages.

Original post by Yubo Wang, Jiarong Liang, Yuxuan Zhang, Xuye Liu, Cong Wei, Yuyu Zhang, Ping Nie, Wenhu Chen

"arXiv:2607.12463v1 Announce Type: new 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…"

View on X

Originally posted by Yubo Wang, Jiarong Liang, Yuxuan Zhang, Xuye Liu, Cong Wei, Yuyu Zhang, Ping Nie, Wenhu Chen on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses