EffiPair: Improving the Efficiency of LLM-generated Code with Relative Contrastive Feedback
Samira Hajizadeh, Suman Jana

TL;DR
EffiPair is a test-time framework that enhances LLM-generated code efficiency through pairwise contrastive feedback, improving runtime and memory usage without model fine-tuning.
Contribution
It introduces Relative Contrastive Feedback (RCF) and EffiPair, enabling iterative, inference-time code refinement based on efficiency comparisons.
Findings
Achieves up to 1.5x speedup over baseline without additional training.
Reduces token usage by over 90% compared to previous methods.
Consistently improves code efficiency on benchmarks.
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
