Adaptive Flip Graph Algorithm for Matrix Multiplication

Yamato Arai, Yuma Ichikawa, Koji Hukushima

TL;DR

Researchers have developed an Adaptive Flip Graph Algorithm that finds more efficient ways to multiply matrices by navigating a "flip graph" of possible algorithms. By introducing "plus transitions" (moves that temporarily increase complexity to escape local optima) and "edge constraints" (focusing on smaller sub-problems first), they reduced the required multiplications for a $5 \times 5$ matrix from 95 down to 94, achieving these results on a single CPU.

What Problem Does This Paper Address?

Matrix multiplication is the engine of modern computing, powering everything from neural networks to climate simulations. Since Strassen’s 1969 discovery that $2 \times 2$ matrices could be multiplied with 7 multiplications instead of 8, researchers have hunted for the "tensor rank"—the absolute minimum number of multiplications needed for larger matrices.

Recently, "Flip Graph" algorithms emerged as a way to find these shortcuts. Imagine a map where every point is a valid multiplication algorithm. You move between points by "flipping" parts of the math. However, these graphs have two major flaws:

  1. Non-Reduction States: The search gets stuck in "local minima" where no single move reduces the number of multiplications, even if a better algorithm exists elsewhere.
  2. The Search Space Explosion: For large matrices (like $5 \times 5$), the number of possible moves is so vast that a random search is like looking for a needle in a galactic haystack.

Methods

The authors propose an Adaptive Flip Graph Algorithm that introduces two clever navigation strategies:

  • Plus Transitions (The Escape Hatch): Unlike previous versions that only allowed moves that kept the rank the same or lowered it, this algorithm can "step up." It intentionally performs a "Plus" transformation that increases the number of multiplications. This allows the search to climb out of a local mathematical dead-end to find a path toward a global optimum. The authors provide a formal proof that adding these moves makes the entire flip graph "connected," meaning every possible algorithm is reachable from any starting point.
  • Edge Constraints (The Guided Tour): To handle the massive search space of large matrices, the algorithm doesn't start by looking at the whole problem. Instead, it restricts its search to smaller sub-blocks (like $2 \times 2$ components) and gradually relaxes these constraints. This "warm-up" phase helps the algorithm find a promising direction before tackling the full complexity of the larger matrix.

Datasets

In the context of this research, "datasets" refer to the specific matrix dimensions and mathematical fields tested. The authors evaluated their algorithm on various $(n, m, p)$ matrix multiplication schemes (multiplying an $n \times m$ matrix by an $m \times p$ matrix).

  • Target: Matrix multiplication in characteristic two (arithmetic over $\mathbb{Z}_2$, where $1+1=0$).
  • Benchmarks: They compared their results against AlphaTensor (DeepMind's reinforcement learning approach) and the original Flip Graph algorithm.

Key Insights and Ideas

  • Connectivity is King: The most significant theoretical contribution is the proof that "Plus Transitions" ensure connectivity. In previous flip graphs, you could be "walled off" from the best solution. Now, there is always a path, provided you are willing to temporarily take a "worse" step.
  • Efficiency over Brute Force: While DeepMind’s AlphaTensor required massive TPU clusters to find new algorithms, this adaptive approach achieved better results for $5 \times 5$ matrices using a single-threaded CPU (Intel Core i7). This suggests that clever graph topology beats raw compute power for this specific problem.
  • Hierarchical Search: The success of "Edge Constraints" highlights that efficient large-scale matrix multiplication often inherits structure from smaller-scale optimizations.

Key Results

The algorithm successfully reproduced all known minimum ranks for smaller matrices and set new records for larger ones in characteristic two:

  • $4 \times 5 \times 5$ Matrix: Reduced the number of multiplications from 76 to 73.
  • $5 \times 5 \times 5$ Matrix: Reduced the number of multiplications from 95 to 94.
  • Escaping Plateaus: In tests on $4 \times 4 \times 4$ matrices, the "Plus Transition" allowed the search to continue improving long after the standard flip graph algorithm had flatlined (see Figure 1 in the paper).

Limitations and Future Work

  • Field Constraints: These specific results (73 and 94 multiplications) were obtained in characteristic two. These shortcuts might not directly translate to standard real-number arithmetic (though they often provide a starting point).
  • Scaling Up: While $5 \times 5$ is a breakthrough, the authors aim to develop strategies for matrices larger than "sixth order" ($6 \times 6$ and beyond), where the search space becomes even more daunting.
  • Search Heuristics: The current "Plus Transition" is triggered after a fixed number of failed updates. Future work could involve more sophisticated "metropolis-style" heuristics to decide when to increase rank more effectively.

Summary updated

BibTeX
@inproceedings{arai2024adaptive,
  author = {Yamato Arai and Yuma Ichikawa and Koji Hukushima},
  title = {{Adaptive Flip Graph Algorithm for Matrix Multiplication}},
  booktitle = {ISSAC},
  year = {2024},
  doi = {10.1145/3666000.3669701},
}
Figure