arXiv:2602.19128cs.AI2026-02被引 19

用自进化世界模型让大模型更聪明地生成高效GPU核代码

K-Search: LLM Kernel Generation via Co-Evolving Intrinsic World Model

  • 用大模型构建可迭代优化的世界模型,分离高层规划与底层实现
  • 在FlashInfer复杂核上平均提速2.1倍,最复杂核提升达14.3倍
  • 适合需要极致性能优化的深度学习系统开发者和编译器研究者

优化GPU核对现代机器学习系统的效率至关重要,但因设计因素复杂且硬件快速演进而极具挑战。现有自动化方法通常将大语言模型(LLMs)仅当作启发式进化循环中的随机代码生成器,难以应对需多步协同结构变换的复杂核,因缺乏显式规划能力,常因中间实现错误或低效而丢弃有潜力的策略。为此,我们提出通过协同进化世界模型进行搜索,并构建K-Search框架。该框架以动态世界模型替代静态搜索启发式,利用大模型的先验领域知识引导搜索过程,主动探索优化空间。该方法明确分离高层算法规划与底层程序实例化,使系统能穿越非单调优化路径,同时对临时实现缺陷保持鲁棒性。我们在FlashInfer的多种复杂核上评估K-Search,包括GQA、MLA和MoE核。结果表明,K-Search显著优于当前最优进化搜索方法,在复杂MoE核上最高实现14.3倍加速,平均提升2.10倍。在GPUMode TriMul任务中,其在H100上达到1030μs,超越此前所有进化方法及人工设计解,达到顶尖水平。

原文摘要 · Abstract (English)

Optimizing GPU kernels is critical for efficient modern machine learning systems yet remains challenging due to the complex interplay of design factors and rapid hardware evolution. Existing automated approaches typically treat Large Language Models (LLMs) merely as stochastic code generators within heuristic-guided evolutionary loops. These methods often struggle with complex kernels requiring coordinated, multi-step structural transformations, as they lack explicit planning capabilities and frequently discard promising strategies due to inefficient or incorrect intermediate implementations. To address this, we propose Search via Co-Evolving World Model and build K-Search based on this method. By replacing static search heuristics with a co-evolving world model, our framework leverages LLMs' prior domain knowledge to guide the search, actively exploring the optimization space. This approach explicitly decouples high-level algorithmic planning from low-level program instantiation, enabling the system to navigate non-monotonic optimization paths while remaining resilient to temporary implementation defects. We evaluate K-Search on diverse, complex kernels from FlashInfer, including GQA, MLA, and MoE kernels. Our results show that K-Search significantly outperforms state-of-the-art evolutionary search methods, achieving an average 2.10x improvement and up to a 14.3x gain on complex MoE kernels. On the GPUMode TriMul task, K-Search achieves state-of-the-art performance on H100, reaching 1030us and surpassing both prior evolution and human-designed solutions.

GPU优化大模型编程自动代码生成编译器

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