arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2306.01097cs.AIcs.DSmath.CO
收藏

无需烦恼的快速矩阵乘法:一种约束规划方法

Fast Matrix Multiplication Without Tears: A Constraint Programming Approach

University of Toronto(多伦多大学)

Arnaud Deza, Chang Liu, Pashootan Vaezipoor, Elias B. Khalil

AI总结:

本文提出约束规划方法求解快速矩阵乘法的约束满足问题,通过对称性破除、有效不等式、稀疏分解及求解器性能波动,发现算法或证明不可行,并在 CP Optimizer 上快速找到至 $3\ imes3$ 矩阵的算法。

摘要:

众所周知,将一个 $N \ imes M$ 矩阵与一个 $M \ imes P$ 矩阵相乘,所用的乘法次数可以少于朴素的 $NMP$ 方法所暗示的次数。其中最著名的例子是 Strassen 算法,它用 7 次而不是 8 次乘法来完成两个 $2\ imes2$ 矩阵的乘法。这引出了快速矩阵乘法的约束满足问题:必须选择并组合一组 $R < NMP$ 个乘法项,使其满足关于输出矩阵的正确性约束。尽管该问题具有高度组合性,但人们尚未从这一角度对其进行穷尽研究,近期的深度强化学习方法 AlphaTensor 就是例证。在本工作中,我们提出一种简单而新颖的 Constraint Programming(约束规划)方法,用于寻找快速矩阵乘法的非交换算法,或在其他情况下给出不可行性证明。我们提出了一组对称性破除约束和有效不等式,它们在证明不可行性方面尤其有帮助。在可行方面,我们发现,利用求解器性能的可变性,并结合基于稀疏性的问题分解,能够为更大的(可行的)快速矩阵乘法实例找到解。我们使用 CP Optimizer 的实验结果表明,可以在短时间内为最大至 $3\ imes3$ 的矩阵找到快速矩阵乘法算法。

英文摘要:

It is known that the multiplication of an $N \times M$ matrix with an $M \times P$ matrix can be performed using fewer multiplications than what the naive $NMP$ approach suggests. The most famous instance of this is Strassen's algorithm for multiplying two $2\times 2$ matrices in 7 instead of 8 multiplications. This gives rise to the constraint satisfaction problem of fast matrix multiplication, where a set of $R < NMP$ multiplication terms must be chosen and combined such that they satisfy correctness constraints on the output matrix. Despite its highly combinatorial nature, this problem has not been exhaustively examined from that perspective, as evidenced for example by the recent deep reinforcement learning approach of AlphaTensor. In this work, we propose a simple yet novel Constraint Programming approach to find non-commutative algorithms for fast matrix multiplication or provide proof of infeasibility otherwise. We propose a set of symmetry-breaking constraints and valid inequalities that are particularly helpful in proving infeasibility. On the feasible side, we find that exploiting solver performance variability in conjunction with a sparsity-based problem decomposition enables finding solutions for larger (feasible) instances of fast matrix multiplication. Our experimental results using CP Optimizer demonstrate that we can find fast matrix multiplication algorithms for matrices up to $3\times 3$ in a short amount of time.

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

↑