用大模型和强化学习自动优化跨架构的机器学习性能。
PerfDojo: Automated ML Library Generation for Heterogeneous Architectures
- 用大模型生成可读代码,让强化学习自动调优。
- 在多种CPU和GPU上实现显著加速,无需硬件知识。
- 适合想省去手动调优的研发人员和系统工程师。
机器学习模型复杂度上升及硬件架构多样化(如CPU、GPU、专用加速器)使得性能优化面临巨大挑战。指令集差异、不同数据类型与模型特性(如稀疏性、量化)的专用内核需求,以及架构特异性优化,使性能调优变得复杂。人工优化成本高,现有自动化方法常依赖复杂的硬件特定启发式规则和难以理解的中间表示,阻碍了性能可移植性。我们提出PerfLLM,一种基于大语言模型(LLMs)与强化学习(RL)的新型自动优化方法。核心是PerfDojo,一个将优化问题建模为强化学习游戏的环境,采用人类可读、数学化编码表示,通过变换保证语义正确性。该方法无需预先掌握硬件知识,既支持人工分析,也利于强化学习代理训练。实验表明,PerfLLM在多种CPU(x86、Arm、RISC-V)和GPU架构上均能实现显著性能提升。
原文摘要 · Abstract (English)
The increasing complexity of machine learning models and the proliferation of diverse hardware architectures (CPUs, GPUs, accelerators) make achieving optimal performance a significant challenge. Heterogeneity in instruction sets, specialized kernel requirements for different data types and model features (e.g., sparsity, quantization), and architecture-specific optimizations complicate performance tuning. Manual optimization is resource-intensive, while existing automatic approaches often rely on complex hardware-specific heuristics and uninterpretable intermediate representations, hindering performance portability. We introduce PerfLLM, a novel automatic optimization methodology leveraging Large Language Models (LLMs) and Reinforcement Learning (RL). Central to this is PerfDojo, an environment framing optimization as an RL game using a human-readable, mathematically-inspired code representation that guarantees semantic validity through transformations. This allows effective optimization without prior hardware knowledge, facilitating both human analysis and RL agent training. We demonstrate PerfLLM's ability to achieve significant performance gains across diverse CPU (x86, Arm, RISC-V) and GPU architectures.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。