Papers

PatternBench 基准:评估 LLM 能否做出编译器做不到的代码优化

Pattern-Driven Evaluation of LLM Code Optimization: Isolating Compiler-Transcendent Semantic Reasoning

Why we picked it

arXiv 上的新论文 PatternBench,专测 LLM 能否做出编译器做不到的代码优化,还用 AST 验证模型是不是真做了优化,做代码生成方向的研究者可以看看。

PatternBench 针对 7 类变换,测量代码在经过激进编译器优化后仍能保留的性能提升。该基准把运行时加速测试与基于 AST 的优化忠实度分析配对,验证模型是否真正执行了目标优化。

Body

实验覆盖前沿闭源模型、开源权重模型和微调模型,结果显示仅看运行时加速无法完整反映优化能力。研究还发现优化忠实度与实际加速高度相关,且微调能同时提升忠实度与优化效果。

Original · arXiv cs.AI

Pattern-Driven Evaluation of LLM Code Optimization: Isolating Compiler-Transcendent Semantic Reasoning

Existing evaluations of LLM-based code optimization primarily measure end-to-end speedup, obscuring whether a model actually performs the intended optimization. For compiled languages, this is especially problematic: observed gains may reflect transformations already recoverable by modern optimizing compilers rather than optimization behavior attributable to the model itself. We present PatternBench, a benchmark for studying compiler-transcendent optimization, i.e., performance improvements that remain after aggressive compiler optimization. PatternBench targets residual optimization opportunities across seven classes of transformations and pairs runtime evaluation with an AST-based optimization faithfulness analysis that verifies whether the intended optimization is realized in the generated program. Experiments with frontier, open-weight, and fine-tuned models show that runtime speedup alone provides an incomplete account of optimization capability. Optimization faithfulness is strongly associated with realized speedup, and fine-tuning improves both faithfulness and optimization effectiveness. These results suggest that evaluation of LLM-based code optimization should measure not only performance outcomes, but also whether the target transformation was successfully executed.

Industry Coordinates & Source Verification

This report is categorized under AITOP's "Papers" desk. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include PatternBench, LLM, 代码优化, 编译器.

Source attribution: curated from arXiv cs.AI (@Wesley Lu, Runzhou Liu, Hongru Du, Xinyao Yi).