arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.05027cs.LGcs.AI
收藏

使用深度强化学习优化自动微分

Optimizing Automatic Differentiation with Deep Reinforcement Learning

Peter Grünberg Institute(彼得·格伦贝格研究所);Forschungszentrum Jülich(于利希研究中心);RWTH Aachen(亚琛工业大学)

Jamie Lohoff, Emre Neftci

AI总结:

本文提出一种基于深度强化学习和跨区域消除的新方法,通过将寻找最优消除顺序建模为单人游戏,在计算精确雅可比矩阵的同时优化乘法次数,在多个任务上实现高达33%的改进并转化为实际运行时提升。

摘要:

在机器学习、计算流体力学、机器人和金融等许多科学领域,使用自动微分计算雅可比矩阵是普遍存在的。即使是在雅可比矩阵计算中少量节省计算量或内存使用,也能带来巨大的能源消耗和运行时间的节省。虽然已有许多方法可以实现这种节省,但它们通常以计算效率换取对精确雅可比矩阵的近似。在本文中,我们提出了一种新方法,通过利用深度强化学习(RL)和一种称为跨区域消除(cross-country elimination)的概念,来优化雅可比矩阵计算所需的乘法次数,同时仍计算精确的雅可比矩阵。跨区域消除是一个自动微分框架,它将雅可比矩阵的累积表述为计算图上所有顶点的有序消除,其中每次消除都会产生一定的计算成本。我们将寻找最小化所需乘法次数的最优消除顺序的过程,表述为一个由RL智能体进行的单人游戏。我们证明,在取自不同领域的多个相关任务中,该方法比现有最先进的方法实现了高达33%的改进。此外,我们通过在JAX中提供一个能够高效执行所获消除顺序的跨区域消除解释器,证明了这些理论上的增益可以转化为实际的运行时间改进。

英文摘要:

Computing Jacobians with automatic differentiation is ubiquitous in many scientific domains such as machine learning, computational fluid dynamics, robotics and finance. Even small savings in the number of computations or memory usage in Jacobian computations can already incur massive savings in energy consumption and runtime. While there exist many methods that allow for such savings, they generally trade computational efficiency for approximations of the exact Jacobian. In this paper, we present a novel method to optimize the number of necessary multiplications for Jacobian computation by leveraging deep reinforcement learning (RL) and a concept called cross-country elimination while still computing the exact Jacobian. Cross-country elimination is a framework for automatic differentiation that phrases Jacobian accumulation as ordered elimination of all vertices on the computational graph where every elimination incurs a certain computational cost. We formulate the search for the optimal elimination order that minimizes the number of necessary multiplications as a single player game which is played by an RL agent. We demonstrate that this method achieves up to 33% improvements over state-of-the-art methods on several relevant tasks taken from diverse domains. Furthermore, we show that these theoretical gains translate into actual runtime improvements by providing a cross-country elimination interpreter in JAX that can efficiently execute the obtained elimination orders.

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

↑