Skip to content

Multi-level Code Optimization via Mixture of Prompts

Jul 2026 · arXiv.org · Vol abs/2607.23665 · 0 citations · 49 references
Computer Science

TL;DR

Optimo is proposed, a multi-level LLM-based code optimization approach built on a novel Mixture-of-Prompts (MoP) architecture that achieves up to 57.48% opt%, and consistently outperforms the best baseline by up to 96.51% in terms of opt%.

Abstract

Runtime efficiency is a critical factor that impacts both software quality and user satisfaction. There are many approaches proposed for code optimization to improve runtime efficiency. Traditional code optimization methods operate on intermediate representations (IRs) during compilation for static languages. They are effective but struggle to handle dynamic languages that do not require compilation. Recently, large language models (LLMs) have been leveraged to directly optimize source code in dynamic languages. However, these methods fail to identify suitable optimization targets and usually conduct incomprehensive single-level optimization. To address these challenges, we propose Optimo, a multi-level LLM-based code optimization approach built on a novel Mixture-of-Prompts (MoP) architecture. In the MoP architecture, Optimo identifies time-critical code structures as performance bottlenecks via differential profiling. These structures are then routed to some optimization strategies, akin to expert models in MoE, each tailored to optimize specific code patterns. Unlike traditional approaches that focus only on statement-level optimizations, Optimo operates at four levels of abstraction, ranging from coarse-grained algorithmic improvements to fine-grained optimizations in API usage. We evaluate Optimo on two code efficiency benchmarks, COFFE and Effibench. Our results demonstrate that Optimo achieves an up to 57.48% opt%, i.e., the percentage of optimized programs that are correct and at least 10% faster than the original programs, and an up to 3.97x speedup when optimizing human-written code, and it consistently outperforms the best baseline by up to 96.51% in terms of opt%. Furthermore, Optimo achieves an up to 42.42% opt% and an up to 13.51x speedup when optimizing LLM-generated code.

View source

Similar papers

Preprint Aug 2026

Effect of Abstractions and Prompting Strategies on LLM-Guided High-Performance Optimizations

It is demonstrated that LLMs provided with specific optimization goals achieve better measured performance and validity rates when generating C code compared to creating computation pipelines and optimization schedules with established frameworks, suggesting that future development should explore alternative approaches for verifiable LLM-guided code optimization.

Jiří Klepl, Matyás Brabec, Martin Kruliš · 0 citations
Book Open access Sep 2026

Quantifying the Code-Size Overhead of eBPF JIT Compilation

eBPF allows user-defined programs to safely extend Linux kernel functionality at runtime, but its final machine code comes from a compilation pipeline that differs from native targets, and how efficient that pipeline is has no clear reference point. Our work constructs one: using the standard LLVM x86 backend as an approximate best case for code-generation quality, we compile nearly identical source through both the eBPF path (with kernel JIT) and a native path. We hold source logic, optimization level, and build configuration equal, so the two differ only in their backend target and can be compared fairly by code size. Applying this to Cilium datapath programs, the two pipelines stay nearly identical through the frontend and midend, which isolates the overhead almost entirely to backend code generation, where the eBPF output contains 27.6% more instructions and is 16.6% larger in bytes. The baseline then lets us attribute the gap to a few recurring causes (operand widening, address computation, memory copies, register pressure) and categorize each by root cause, as coming from the eBPF instruction set or from a less mature backend, or a mix of both. This pinpoints where the overhead occurs and provides a method to measure it for other eBPF workloads and backends. Because eBPF code runs in hot kernel paths, this overhead is worth reducing, and the baseline offers a stable reference for measuring how far eBPF code generation is from native quality and tracking that gap as backends mature, for other projects and workloads.

Hoang Duong, Hao Sun, Zhendong Su · 0 citations
Preprint Aug 2026

T-LLM Compiler: Trusted LLM-based Code Optimization and Verification Framework

The Trusted LLM (T-LLM) Compiler is presented, which proposes an advancement in compiler technology through a collaborative effort involving high-level LLM code transformations, traditional compilers, and verification tools and facilitates iterative code optimization efforts with verification strategies that enable corrective actions.

Zahra Fazel, Sunanda Gamage, Shayan Shirahmad Gale Bagi et al. · 0 citations
Preprint Aug 2026

Route-Align-Verify for Functional Correctness in Code Generation

The results indicate that functional correctness in code generation can be meaningfully improved without modifying the backbone architecture, by jointly optimizing how tasks are prompted, how the model is adapted, and how final outputs are selected.

Erxue Zhou, Jing Meng, Ao-Fan Liu · 0 citations
Review Aug 2026

From Static to Dynamic: Benchmarking Real-World Code Review with MCR-Bench

MCR-Bench is introduced, the first defect state-aware benchmark designed for realistic multi-round code review, and in-depth error analysis dissects the distinct drivers of false positives and false negatives, revealing critical weaknesses such as cross-round temporal misalignment and inadequate long-range memory.

De-Wu Zheng, Yan-Lin Wang, Xi-Wen Wang et al. · 0 citations
Preprint Aug 2026

SimP: Unifying Syntax- and Semantic-Guided Techniques for Efficient Program Reduction

SimP is a program reduction framework that combines traditional reduction with LLM-based syntax- and semantic-guided reduction, and synergistically combines rule-based and LLM-based reduction stages to optimize the reduction performance.

Yewei Xiong, Xiangyu Gao, Qiaochu Chen et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.