[2604.05137] EffiPair: Improving the Efficiency of LLM-generated Code with Relative Contrastive Feedback
About this article
Abstract page for arXiv paper 2604.05137: EffiPair: Improving the Efficiency of LLM-generated Code with Relative Contrastive Feedback
Computer Science > Programming Languages arXiv:2604.05137 (cs) [Submitted on 6 Apr 2026] Title:EffiPair: Improving the Efficiency of LLM-generated Code with Relative Contrastive Feedback Authors:Samira Hajizadeh, Suman Jana View a PDF of the paper titled EffiPair: Improving the Efficiency of LLM-generated Code with Relative Contrastive Feedback, by Samira Hajizadeh and 1 other authors View PDF HTML (experimental) Abstract:Large language models (LLMs) often generate code that is functionally correct but inefficient in runtime and memory. Prior approaches to improving code efficiency typically rely on absolute execution feedback, such as profiling a single program's runtime or memory usage, which is costly and provides weak guidance for refinement. We propose Relative Contrastive Feedback (RCF), an inference-time feedback mechanism that requires no model fine-tuning or parameter updates. RCF compares two structurally similar programs for the same task and highlights the differences associated with better efficiency. Building on this idea, we introduce EffiPair, an inference-time iterative refinement framework that operates entirely at test time by generating multiple candidate solutions, identifying informative program pairs with large efficiency gaps, summarizing their execution differences into lightweight feedback, and using this signal to produce more efficient solutions. By replacing isolated scalar feedback with pairwise contrastive comparisons, EffiPair provides more ...