Pattern-Driven Evaluation of LLM Code Optimization: Isolating Compiler-Transcendent Semantic Reasoning
On the map: LLM reasoning → Test-time compute and efficient thinking also fits: Reasoning for agents, planning and code
Abstract (arXiv)
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.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Test-time compute and efficient thinking, one of 17 directions in LLM reasoning. Builds on 18 of its 27 references that are in the map. Submitted 17 Oct 2026.
Builds on
18 of 27 references.
References · 18
- 2023Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Promptingcited by 1,324
- 2022Fine-Tuning can Distort Pretrained Features and Underperform Out-of-Distributioncited by 796
- 2023Measuring Faithfulness in Chain-of-Thought Reasoningcited by 786
- 2025Reasoning Models Don't Always Say What They Thinkcited by 503
- 2023Learning Performance-Improving Code Editscited by 122
- 2024Evaluating Language Models for Efficient Code Generationcited by 83
- 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 78
- 2024Quantifying Contamination in Evaluating Code Generation Capabilities of Language Modelscited by 72
- 2024How Efficient is LLM-Generated Code? A Rigorous & High-Standard Benchmarkcited by 53
- 2025SWE-Perf: Can Language Models Optimize Code Performance on Real-World Repositories?cited by 52
- 2025Walk the Talk? Measuring the Faithfulness of Large Language Model Explanationscited by 51
- 2021MLGO: a Machine Learning Guided Compiler Optimizations Frameworkcited by 44
6 more
- 2024Mercury: A Code Efficiency Benchmark for Code Large Language Modelscited by 44
- 2024EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimizationcited by 36
- 2025FaithCoT-Bench: Benchmarking Instance-Level Faithfulness of Chain-of-Thought Reasoningcited by 33
- 2017Souper: A Synthesizing Superoptimizercited by 15
- 2023Invalidator: Automated Patch Correctness Assessment via Semantic and Syntactic Reasoningcited by 12
- 2025Breaking Memorization Barriers in LLM Code Fine-Tuning via Information Bottleneck for Improved Generalizationcited by 2
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2026HintPilot: LLM-based Compiler Hint Synthesis for Code Optimization
- 2026Efficiency Hallucination: Formalizing and Measuring Behavioral Calibration in LLM-Based Code Optimization
- 2026CoRE: A Fine-Grained Code Reasoning Benchmark Beyond Output Prediction
- 2024Should AI Optimize Your Code? A Comparative Study of Classical Optimizing Compilers Versus Current Large Language Models
- 2026LiteCoOp: Lightweight Multi-LLM Shared-Tree Reasoning for Model-Serving Compiler Optimizations
- 2023Large Language Models for Compiler Optimization
- 2026ECCO: Evidence-Driven Causal Reasoning for Compiler Optimization
- 2025Demystifying Errors in LLM Reasoning Traces: An Empirical Study of Code Execution Simulation