PerfAgent: Profiler-Guided Iterative Refinement for Repository-Level Code Optimization

· Source: Artificial Intelligence · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Expert, quick

Summary

PerfAgent is a novel profiler-guided, verifier-in-the-loop workflow. It enhances large language model (LLM) agents' capability for repository-level code optimization. While LLM agents perform well on correctness tasks like SWE-Bench, they struggle with improving runtime performance while preserving code behavior. PerfAgent provides an off-the-shelf coding agent with feedback. This feedback helps identify real hotspots, move beyond initial shallow speedups, and use profiler evidence for optimization decisions. This prevents agents from missing bottlenecks or silently breaking edge cases. On the GSO benchmark, PerfAgent more than doubles expert-matching patches, improving from 19.6% to 39.2% with OpenHands and GPT-5.1. On SWE-fficiency-Lite, it boosts performance from 26% to 74%, surpassing an oracle best-of-five baseline at lower cost.

Key takeaway

For AI Engineers developing LLM agents for code optimization, you should integrate profiler-guided, verifier-in-the-loop workflows. This approach significantly improves optimization success rates and patch quality. It helps your agents move beyond shallow speedups and avoid silently breaking code. Implement iterative refinement steps, using profiler data to guide subsequent optimization efforts. This strategy can more than double expert-matching patches, as demonstrated by PerfAgent's results.

Key insights

PerfAgent uses profiler-guided, verifier-in-the-loop feedback to significantly improve LLM agent code optimization performance.

Principles

Method

PerfAgent employs a profiler-guided, verifier-in-the-loop workflow. It provides an off-the-shelf coding agent with feedback to find hotspots, improve beyond initial patches, and use profiler evidence for optimization.

In practice

Topics

Best for: Machine Learning Engineer, Research Scientist, AI Scientist, AI Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Artificial Intelligence.