LLM代码优化依赖预训练先验,而非反馈或智能结构。
Prior Knowledge or Search? A Study of LLM Agents in Hardware-Aware Code Optimization

- 通过控制实验发现LLM在代码优化中更像贪婪搜索器。
- 输入尺寸信息对模型无影响,性能随异常尺寸骤降。
- 反馈循环中CUDA优化持续提升,而TVM IR却恶化。
LLM发现与优化系统广泛应用于多个领域,通常采用提出-评估-修正的循环机制。该过程依赖环境反馈进行上下文调节。然而,随着现代LLM代理结构日益复杂,难以评估各组件贡献度,也难以判断探索何时失败。本文通过三项受控实验回答这些问题:(1) 在纯黑盒优化中,LLM表现为贪婪优化器;(2) 在零样本核生成中,提供显式输入尺寸信息无显著影响,模型无论尺寸或温度如何,均收敛至相同核参数,仿佛尺寸指令无效;且当任务为非常见核尺寸时,性能急剧下降,无论使用何种语言;(3) 在反馈循环优化中,CUDA性能随迭代反馈单调提升,而TVM IR则持续恶化,表明当模型使用低密度语言时,优化能力会退化。结果表明,LLM在代码优化任务中高度依赖预训练先验,而非提供的反馈或代理结构。
原文摘要 · Abstract (English)
LLM discovery and optimization systems are increasingly applied across domains, implementing a common propose-evaluate-revise loop. Such optimization or discovery progresses via context conditioning on received feedback from an environment. However, as modern LLM agents are increasingly complex in their structure, it is difficult to evaluate which components contribute the most, and when and how this exploration may fail. We answer these questions through three controlled experiments. Our findings: (1) In pure black-box optimization, LLMs act as greedy optimizers. (2) In zero-shot kernel generation, providing explicit input-size information has no measurable effect, models converge to the same kernel parameters regardless of size or temperature, as though the size instruction were invisible. Moreover, when tasked to perform kernel optimization for uncommon kernel sizes, performance sharply degrades regardless of the language used. (3) In feedback-loop kernel optimization, CUDA improves monotonically under iterative feedback, while TVM IR actively degrades, which demonstrates that kernel optimization degrades when models operate with low-density language. Our results conclude that LLMs in code optimization tasks highly depend on pretrained priors rather than provided feedback or agentic structure.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。