arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.18916cs.LG
收藏

通过检索增强搜索实现LLM程序优化

LLM Program Optimization via Retrieval Augmented Search

University of Pennsylvania(宾夕法尼亚大学)

Sagnik Anupam, Alexander Shypula, Osbert Bastani

AI总结:

提出检索增强搜索(RAS)方法,利用LLM进行黑盒程序优化,通过检索慢-快程序对引导束搜索,并基于LLM生成的自然语言描述进行上下文检索,显著优于源码检索;同时提出AEGIS方法通过原子编辑提升可解释性。

摘要:

近期工作展示了大型语言模型(LLM)在程序优化方面的潜力,这是编程语言中的一个关键挑战。我们提出了一种名为检索增强搜索(RAS)的黑盒适应方法,该方法对候选优化进行束搜索;每一步,它从给定的慢-快程序对训练数据集中检索上下文示例来引导LLM。关键的是,我们发现基于LLM生成的自然语言描述进行上下文检索显著优于基于源代码的检索。我们还提出了AEGIS,一种通过将训练示例分解为本质上更渐进的“原子编辑”来提高可解释性的方法。我们表明,在优化C++程序方面,RAS的性能比先前最先进的黑盒适应策略高出2.06倍,而AEGIS在做出显著更小编辑的同时性能高出1.37倍。我们还表明,与基线相比,使用RAS将Python程序的平均运行时间百分位数提高了10.27。

英文摘要:

Recent work has demonstrated the potential of large language models (LLMs) for program optimization, a key challenge in programming languages. We propose a blackbox adaptation method called Retrieval Augmented Search (RAS) that performs beam search over candidate optimizations; at each step, it retrieves in-context examples from a given training dataset of slow-fast program pairs to guide the LLM. Critically, we find that performing contextual retrieval based on an LLM-generated natural language description significantly outperforms retrieval based on the source code. We also propose AEGIS, a method for improving interpretability by decomposing training examples into ''atomic edits'' that are significantly more incremental in nature. We show that RAS performs up to 2.06$\times$ better than prior state-of-the-art blackbox adaptation strategies on optimizing C++ programs, and that AEGIS performs up to 1.37$\times$ better while making significantly smaller edits. We also show that using RAS improves the mean runtime percentile of Python programs by 10.27 compared to baselines.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑