AI
New Method Lets Code Completion Models Follow Developer Instructions Better
Researchers introduce Instruction-aware Fill-In-the-Middle to help code completion models understand natural language directives without losing existing performance.
Code completion tools often struggle when developers haven't spelled out exactly what they want. To bridge this gap, many programmers add natural language comments explaining their goals—but current models tend to overlook these instructions, treating them as just another part of the surrounding code context.
The Problem#
Today's code completion systems rely on a training method called Fill-In-the-Middle (FIM), which learns to complete code fragments by predicting what should go in the middle when both prefix and suffix are provided. The trouble is that developer intent—expressed through comments and instructions—gets lost in this approach. Natural language directives end up buried in the noisy prefix alongside regular code, so the model doesn't prioritize them.
Adding to this difficulty, training data for FIM models typically comes from open-source repositories, which contain very few instruction-to-code pairs that actually reflect how developers work in real editing scenarios.
The Solution#
A team of researchers has proposed Instruction-aware Fill-In-the-Middle (IFIM), a fine-tuning method that extends the standard FIM structure with a dedicated, structurally separated instruction section. By giving instructions their own space in the model's input, IFIM teaches code completion systems to treat developer directives as first-class information rather than background noise.
Performance and Compatibility#
The method shows promising results across the board. Testing on an in-the-wild benchmark of 100 real instructions written by developers demonstrates improved adherence to developer intent. Crucially, IFIM maintains infilling performance when no instruction is provided—meaning existing functionality stays intact. The gains hold steady across model sizes ranging from 1.5 billion to 7 billion parameters.
Since IFIM is designed as a backward-compatible upgrade for existing FIM-based code completion systems, it can be integrated at modest training cost without disrupting current workflows.

