Why AI Coding Agents Fail: The Critical Gap Between Files and Lines
While AI coding agents are increasingly capable of resolving software bugs, a new study reveals they suffer from a significant "localization" problem. They can navigate to the correct file within a massive codebase, but they frequently fail to identify the specific lines of code required to implement a fix.
Introducing SWE-Explore: Moving Beyond Repair Rates
Historically, the effectiveness of AI coding agents has been measured by a single, binary metric: did the agent fix the bug or not? This approach ignores the "why" behind a failure. A failed repair could mean the agent wrote a bad patch, or it could mean the agent never even looked at the relevant logic.
To address this blind spot, an international research team, including scientists from Shanghai Jiao Tong University, developed SWE-Explore. Unlike traditional benchmarks, SWE-Explore isolates the upstream search phase. It evaluates an agent's ability to take a bug description and return a ranked list of the specific code sections that are actually relevant to the problem. The dataset is extensive, drawing from 848 tasks across 203 open-source projects and ten programming languages, with Python being the most prominent (547 tasks).
The Precision Gap: File Success vs. Line Failure
The study’s most striking finding is the massive disparity between file-level and line-level accuracy. When tested against general-purpose agents like Claude Code, Codex, and OpenHands, the results were telling:
- File-level accuracy: Agents perform well, successfully identifying the correct source files and ranking them highly.
- Line-level accuracy: Performance collapses. General coding agents covered only 14% to 19% of the actual lines of code that mattered for a fix.
Interestingly, simply upgrading the underlying Large Language Model (LLM) does not solve this. Whether using models from OpenAI, Anthropic, Google, Moonshot, or Zhipu, the pattern remains identical: high file hit rates but abysmal line coverage. The research noted that specialized systems like CoSIL outperformed general agents by treating code as a network of interconnected building blocks, suggesting that architectural changes are more important than raw model power.
The Threshold Effect: Why "Reading More" Matters
નિયંત્રિત એબ્લેશન પ્રયોગો દ્વારા, સંશોધકોએ સંદર્ભ (context) અંગે એક "સીમારેખા અસર" (threshold effect) શોધી કાઢી છે. મોડેલને પૂરા પાડવામાં આવતા મુખ્ય કોડના પ્રમાણમાં ફેરફાર કરીને (0% થી 100% સુધી), તેઓએ જોયું કે રિપેરિંગ રેખીય રીતે સુધરતું નથી.
સરળ કાર્યો માટે, એક સ્પષ્ટ નિર્ણાયક વળાંક છે: જો એજન્ટ જરૂરી મુખ્ય વિસ્તારોના 50% થી ઓછા ભાગને જુએ છે, તો રિપેરિંગ સફળતાનો દર શૂન્યની નજીક રહે છે. સફળ રિપેરિંગમાં નોંધપાત્ર વધારો ત્યારે જ થાય છે જ્યારે એજન્ટ પાસે જરૂરી સંદર્ભના 50% થી 75% સુધીની પહોંચ હોય. મહત્વની વાત એ છે કે, અભ્યાસમાં જાણવા મળ્યું છે કે બિનજરૂરી "નોઈઝ" (noise) કોડ આપવાથી કામગીરી પર એટલું નુકસાન થતું નથી જેટલું મહત્વપૂર્ણ લાઇન ગુમાવવાથી થાય છે. ડેવલપર્સ માટે મુખ્ય બોધ સ્પષ્ટ છે: AI એજન્ટ્સના યુગમાં, આવશ્યક વિગતો ફિલ્ટર કરવાનું જોખમ લેવા કરતાં વધુ સંદર્ભ આપવો વધુ સારો છે.
મુખ્ય તારણો
- સ્થાન નિર્ધારણ (Localization) એ અવરોધ છે: AI એજન્ટ્સ સાચી ફાઇલ શોધવામાં કુશળ છે પરંતુ ફિક્સ માટે જરૂરી કોડની ચોક્કસ લાઇન શોધવામાં તેમને નોંધપાત્ર મુશ્કેલી પડે છે.
- મોડેલ સ્કેલિંગ એ સંપૂર્ણ ઉકેલ નથી: વધુ શક્તિશાળી LLMs માં અપગ્રેડ કરવાથી લાઇન-લેવલની ચોકસાઈનો તફાવત દૂર થતો નથી; CoSIL જેવા વિશિષ્ટ આર્કિટેક્ચરલ અભિગમો વધુ અસરકારક છે.
- 50% સંદર્ભનો નિયમ: AI રિપેરિંગની સફળતા એક થ્રેશોલ્ડ પેટર્ન અનુસરે છે, જેમાં સફળ ફિક્સ સંભવિત બને તે પહેલાં ઓછામાં ઓછા 50-75% સંબંધિત કોડ સંદર્ભ દેખાવો જરૂરી છે.