Discovering faster matrix multiplication algorithms with reinforcement learning

被引:303
作者
Fawzi, Alhussein [1 ]
Balog, Matej [1 ]
Huang, Aja [1 ]
Hubert, Thomas [1 ]
Romera-Paredes, Bernardino [1 ]
Barekatain, Mohammadamin [1 ]
Novikov, Alexander [1 ]
Ruiz, Francisco J. R. [1 ]
Schrittwieser, Julian [1 ]
Swirszcz, Grzegorz [1 ]
Silver, David [1 ]
Hassabis, Demis [1 ]
Kohli, Pushmeet [1 ]
机构
[1] DeepMind, London, England
关键词
DEEP NEURAL-NETWORKS; DECOMPOSITIONS; GO;
D O I
10.1038/s41586-022-05172-4
中图分类号
O [数理科学和化学]; P [天文学、地球科学]; Q [生物科学]; N [自然科学总论];
学科分类号
07 ; 0710 ; 09 ;
摘要
Improving the efficiency of algorithms for fundamental computations can have a widespread impact, as it can affect the overall speed of a large amount of computations. Matrix multiplication is one such primitive task, occurring in many systems-from neural networks to scientific computing routines. The automatic discovery of algorithms using machine learning offers the prospect of reaching beyond human intuition and outperforming the current best human-designed algorithms. However, automating the algorithm discovery procedure is intricate, as the space of possible algorithms is enormous. Here we report a deep reinforcement learning approach based on AlphaZero(1) for discovering efficient and provably correct algorithms for the multiplication of arbitrary matrices. Our agent, AlphaTensor, is trained to play a single-player game where the objective is finding tensor decompositions within a finite factor space. AlphaTensor discovered algorithms that outperform the state-of-the-art complexity for many matrix sizes. Particularly relevant is the case of 4 x 4 matrices in a finite field, where AlphaTensor's algorithm improves on Strassen's two-level algorithm for the first time, to our knowledge, since its discovery 50 years ago(2). We further showcase the flexibility of AlphaTensor through different use-cases: algorithms with state-of-the-art complexity for structured matrix multiplication and improved practical efficiency by optimizing matrix multiplication for runtime on specific hardware. Our results highlight AlphaTensor's ability to accelerate the process of algorithmic discovery on a range of problems, and to optimize for different criteria.
引用
收藏
页码:47 / +
页数:17
相关论文
共 63 条
[1]  
Abadi M, 2016, PROCEEDINGS OF OSDI'16: 12TH USENIX SYMPOSIUM ON OPERATING SYSTEMS DESIGN AND IMPLEMENTATION, P265
[2]  
Alman J, 2021, Disc Algorithms, P522
[3]  
[Anonymous], 2021, FAST MATR MULT ALG C
[4]   The geometry of rank decompositions of matrix multiplication II: 3 x 3 matrices [J].
Ballard, Grey ;
Ikenmeyer, Christian ;
Landsberg, J. M. ;
Ryder, Nick .
JOURNAL OF PURE AND APPLIED ALGEBRA, 2019, 223 (08) :3205-3224
[5]  
Balog M, 2019, Arxiv, DOI arXiv:1906.11786
[6]  
Bansal Kshitij., 2019, INT C MACHINE LEARNI, P454
[7]  
Battaglia Peter W., 2018, arXiv
[8]  
Benson AR, 2015, ACM SIGPLAN NOTICES, V50, P42, DOI [10.1145/2858788.2688513, 10.1145/2688500.2688513]
[9]   General tensor decomposition, moment matrices and applications [J].
Bernardi, A. ;
Brachat, J. ;
Comon, P. ;
Mourrain, B. .
JOURNAL OF SYMBOLIC COMPUTATION, 2013, 52 :51-71
[10]  
Blaser M., 2013, Graduate Surveys, V5, P1, DOI DOI 10.4086/TOC.GS.2013.005