Cost-Aware Python Code Repair via Budget-Threshold LLM Optimization

Repeated test feedback can increase token consumption during large language model (LLM) code repair, particularly for difficult tasks. This study examines whether fixed feedback compression and observable progress signals can control this overhead without changing model parameters. The cost_aware strategy combines feedback filtering, budget-threshold and no-progress stopping, reset prompts, and a final rewrite opportunity. Five strategies were evaluated on 30 QuixBugs-derived Python tasks over three independent API runs. Public tests guided repair, whereas hidden tests were reserved for final evaluation. cost_aware fully passed 27 tasks in every run, averaging 90.0%, and consumed 47.5% fewer tokens than full_loop. Maximum per-task usage dropped substantially from 29,498 to 4,185 tokens, demonstrating effective tail suppression; while conservative multiplicity-adjusted inference reflects the limited sample size (N=30), the observed effect sizes highlight substantial practical utility. A single exploratory DeepSeek run showed a smaller reduction in the same direction. These observations warrant further evaluation of transparent invocation control, with conclusions limited to the tested tasks, models, and sampling conditions.

Authors

Institutions

Publication Details

Journal
Applied and Computational Engineering
Published
2026-10-27
DOI
https://doi.org/10.54254/2755-2721/2026.38363
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Cost-Aware Python Code Repair via Budget-Threshold LLM Optimization

Kaiqi Qu
3 links
Applied and Computational Engineering
Software Engineering Research
article

Cost-Aware Python Code Repair via Budget-Threshold LLM Optimization

Kaiqi Qu
article en

Abstract

Repeated test feedback can increase token consumption during large language model (LLM) code repair, particularly for difficult tasks. This study examines whether fixed feedback compression and observable progress signals can control this overhead without changing model parameters. The cost_aware strategy combines feedback filtering, budget-threshold and no-progress stopping, reset prompts, and a final rewrite opportunity. Five strategies were evaluated on 30 QuixBugs-derived Python tasks over three independent API runs. Public tests guided repair, whereas hidden tests were reserved for final evaluation. cost_aware fully passed 27 tasks in every run, averaging 90.0%, and consumed 47.5% fewer tokens than full_loop. Maximum per-task usage dropped substantially from 29,498 to 4,185 tokens, demonstrating effective tail suppression; while conservative multiplicity-adjusted inference reflects the limited sample size (N=30), the observed effect sizes highlight substantial practical utility. A single exploratory DeepSeek run showed a smaller reduction in the same direction. These observations warrant further evaluation of transparent invocation control, with conclusions limited to the tested tasks, models, and sampling conditions.

Applied and Computational EngineeringVol. 264(1)
Jilin University (CN)
Openalex Percentile: Top 6%
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon