EffiPair: Improving the Efficiency of LLM-generated Code with Differential Execution Feedback
cs.PL, cs.AI, cs.CL, cs.LG, cs.SE
Submitted: 2026-04-06
Updated: 2026-09-26
License: http://creativecommons.org/licenses/by/4.0/
The gist: Large language models (LLMs) can generate functionally correct programs that differ substantially in execution efficiency.
Terminology
Abstract
Large language models (LLMs) can generate functionally correct programs that differ substantially in execution efficiency. Existing inference-time optimization methods typically refine each candidate using pointwise runtime or profiling feedback, which identifies how costly an implementation is or where the cost arises, but offers limited guidance on how the computation should change. We introduce DIFFERENTIAL EXECUTION FEEDBACK (DEF), which compares implementations that are nearby in structural program space but separated in performance, turning their execution and implementation differences into directional optimization evidence. We demonstrate DEF in EffiPair, a training-free, test-time framework that pairs structurally similar programs with different efficiencies, distills their relative execution behavior into compact feedback, and iteratively refines a candidate pool. Across EvalPerf, Mercury, and ENAMEL, using GPT-4o mini, DeepSeek-V4.1 Flash, and GPT-5 mini, EffiPair achieves the highest value on each benchmark's official efficiency metric in all nine model-benchmark settings under matched evaluation conditions. Moreover, two contrastive refinement rounds improve efficiency over the selected initial draft in every setting while preserving or improving Pass@1. These results demonstrate the effectiveness of relational execution feedback as a lightweight signal for test-time code optimization.
Sources
- DeepSeek-V3.2: Pushing the Frontier of Open Large Language Models
- EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimization
- EffiBench: Benchmarking the Efficiency of Automatically Generated Code
- SWE-bench: Can Language Models Resolve Real-World GitHub Issues?
- PerfCodeGen: Improving Performance of LLM Generated Code with Execution Feedback
- How Efficient is LLM-Generated Code? A Rigorous & High-Standard Benchmark
- ECCO: Can We Improve Model-Generated Code Efficiency Without Sacrificing Functional Correctness?
- LLM4EFFI: Leveraging Large Language Models to Enhance Code Efficiency and Correctness
Related papers
- Language-Based Agent Control
- ANEForge: Python for direct computation on the Apple Neural Engine
- Volition Elicitation: Operational Semantics for People and Their Machines
- Griotte: Verified Compartmentalisation via Capabilities
- GraphMend: Code Transformations for Fixing Graph Breaks in PyTorch 2
- Two Birds One Stone: Effective Static Detection of Resource and Communication Deadlocks in Rust Programs