arXiv:2501.18916cs.LG2025-01ACL被引 6

用检索增强搜索提升LLM编程优化效果,更准更快。

LLM Program Optimization via Retrieval Augmented Search

  • 用自然语言描述检索优化示例,指导LLM逐步优化代码
  • 对C++程序提速最高达2.06倍,Python程序平均性能提升10.27个百分点
  • 通过原子级修改提升可解释性,改动更小更精准

近期研究展示了大语言模型(LLMs)在程序优化中的潜力,这是编程语言领域的一项关键挑战。我们提出一种黑箱适配方法——检索增强搜索(RAS),通过在候选优化方案上进行束搜索;每一步均从给定的慢速-快速程序对数据集中检索上下文示例以引导LLM。关键发现是:基于LLM生成的自然语言描述进行上下文检索,显著优于基于源代码的检索。我们还提出AEGIS方法,通过将训练样本分解为“原子编辑”来提升可解释性,这些编辑更加增量式。实验表明,RAS在优化C++程序时性能比现有最优黑箱策略最高提升2.06倍;AEGIS在提升1.37倍的同时,修改幅度显著减小。此外,使用RAS使Python程序的平均运行时间百分位提升10.27个点。

原文摘要 · Abstract (English)

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.

程序优化LLM应用检索增强代码生成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。