NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code Editing

Xiaoxue Ren, Jun Wan, Yun Peng, Zhongxin Liu, Ming Liang, Dajun Chen, Wei Jiang, Yong Li · DOI

Abstract

Large Language Models (LLMs) have demonstrated significant proficiency in code generation; however, optimizing existing codebases for efficiency remains a complex challenge, particularly at the project level. Traditional approaches often treat functions in isolation, neglecting the intricate dependencies within multi-file projects. This paper presents PEACE (Project-level Efficiency optimization through Automatic Code Editing), a hybrid framework designed to address these limitations. PEACE integrates dependency-aware sequence construction with an agent-based filtering mechanism for historical edits and a specialized fine-tuned optimizer. Experimental results on the newly introduced PEACEXEC benchmark show that PEACE achieves a 69.2% correctness rate and a 0.840 speedup relative to human-expert patches, significantly outperforming state-of-the-art models like GPT-4o.

1. Introduction

While LLMs excel at writing code from scratch, enhancing the execution speed of existing software—especially in complex, multi-file environments—is a significant hurdle. Real-world software development involves deeply interconnected functions where an optimization in one component may necessitate adjustments in its callers or callees. Most current automated tools perform "localized surgery" on single functions, failing to account for these project-wide dependencies.

2. Challenges in Project-Level Optimization

The authors identify two primary obstacles to effective project-level optimization:

  1. Interference from Invalid Edits: When models leverage a project's version history for context, they frequently encounter "noisy" or irrelevant changes. These can lead to functional errors if the model replicates historical edits that are not semantically relevant to the current optimization goal.
  2. Limited Optimization Knowledge: Codebases often contain repetitive suboptimal patterns. If a model relies solely on internal project context, it may simply propagate these inefficiencies. Introducing high-performance alternatives, such as specialized libraries (e.g., Numba) or optimized algorithms, requires external knowledge.
Figure 2: Historical edits can be misleading (e.g., 'Incorrect optimization edit'), requiring intelligent filtering to identify valid associated changes.

3. The PEACE Framework

PEACE employs a three-phase hybrid approach to navigate these challenges:

3.1 Dependency-Aware Sequence Construction

Rather than editing functions arbitrarily, PEACE constructs a call graph and utilizes a "bottom-up" strategy. Functions are ranked by relevance using models like CodeBERT and Roberta. This ensures that "callee" functions are optimized before the "caller" functions that depend on them, providing a stable and efficient context for higher-level optimizations.

3.2 Valid Associated Edits Identification

To mitigate the "noise" from historical data, PEACE utilizes an LLM-based agent. This agent acts as a filter, scanning historical commits to identify only those edits that are semantically relevant to the optimization task, providing a curated "cheat sheet" for the model.

3.3 Efficiency Optimization Editing Iteration

The core of PEACE is a hybrid editing process. It pairs a large-scale model (Llama-3.1-405B) for high-level reasoning and project integrity with a fine-tuned specialist model (Llama-3-8B). This smaller model is specifically trained on thousands of "slow-to-fast" code pairs, acting as a dedicated efficiency expert.

Figure 3: The three-phase PEACE framework overview, illustrating the flow from dependency analysis to iterative code editing.

4. Experimental Evaluation

The researchers introduced PEACEXEC, a benchmark comprising 146 real-world tasks from 47 high-impact Python projects. It includes 66 "multi-function" tasks where optimization requires editing interdependent functions.

PEACE was compared against baselines including GPT-4o, SBLLM, and CoEdPilot. Key results include:

  • Correctness: PEACE achieved a 69.2% pass@1 rate, surpassing the next best baseline (SBLLM) by 11%.
  • Optimization Rate: It demonstrated a +46.9% improvement over the standard GPT-4o baseline.
  • Speedup: PEACE reached a 0.840 speedup score, where 1.0 represents human-expert performance.

5. Conclusion and Future Work

PEACE represents a significant advancement in automated code optimization by moving from function-level to project-level analysis. Key insights include the effectiveness of "bottom-up" optimization and the superior performance of specialized small models over general-purpose giants for specific coding mechanics. Future work will focus on overcoming the limitations of static analysis by integrating dynamic analysis to provide real-time execution feedback during the optimization loop.

Summary updated

BibTeX
@misc{ren2025peace,
  author = {Xiaoxue Ren and Jun Wan and Yun Peng and Zhongxin Liu and Ming Liang and Dajun Chen and Wei Jiang and Yong Li},
  title = {{PEACE: Towards Efficient Project-Level Efficiency Optimization via Hybrid Code Editing}},
  year = {2025},
  eprint = {2510.17142},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.17142},
}
Figure