Abstract
Matrix diagonalization is a fundamental operation in scientific computing, yet traditional numerical methods like the Jacobi algorithm can be computationally intensive for large-scale systems. This paper proposes a novel approach by framing matrix diagonalization as a sequential decision-making problem solved via Decision Transformers (DTs). By integrating an epsilon-greedy optimization strategy, the model learns robust "meta-strategies" for pivot selection. Experimental results on Hamiltonian matrices demonstrate a 49.23% reduction in rotation steps and a 45x inference speedup compared to existing AI-accelerated eigensolvers.
Introduction
Calculating eigenvalues and eigenvectors ($Av = \lambda v$) is essential for fields ranging from quantum mechanics to data analysis. As matrices grow to involve millions or billions of elements, traditional numerical methods like the Jacobi algorithm become computationally expensive. The Jacobi method works by repeatedly applying rotations to "zero out" off-diagonal elements. The standard heuristic, the "max-element" approach, picks the largest off-diagonal value to eliminate next. While reliable, this is not necessarily the most efficient path to a diagonal matrix. This research explores whether a "smarter" sequence of rotations can reach the solution in fewer steps using reinforcement learning.
Methodology
The authors treat matrix diagonalization as a Markov Decision Process (MDP) where the state is the current matrix, the action is the choice of which off-diagonal element (pivot) to rotate, and the reward is based on the number of elements successfully zeroed out.
Unlike traditional Reinforcement Learning (RL) that learns a value function, this approach utilizes Decision Transformers (DTs) to treat RL as a sequence-modeling task. The model predicts the next action based on the history of states, actions, and "Returns-to-go" (R2G), which represents the total reward the agent aims to achieve.
To prevent the model from getting stuck on unfamiliar matrices (distributional shift), an epsilon-greedy optimization strategy was integrated. During training, this forces exploration of sub-optimal paths to build robustness. During inference, if the reward drops below a threshold, the model switches from its best prediction to random exploration to return to a known state. The architecture employs a causal transformer to ensure the model only considers past rotations, preserving the temporal logic of the algorithm.
Datasets and Training
The researchers utilized a dataset of 3,000 Hamiltonian matrices ($5 \times 5$) derived from molecular dynamics simulations. Trajectories were generated using Monte Carlo Tree Search (MCTS) to capture 10,000 "playouts" per matrix, providing both optimal and sub-optimal sequences for training. This methodology builds upon benchmarks established by previous AI-driven eigensolvers like FastEigen.
Results and Discussion
The DT approach demonstrated significant improvements over traditional and existing AI methods. The model learned a "meta-strategy," targeting elements near the diagonal in early steps and moving toward boundary elements later.
Key performance metrics include:
- Step Reduction: The DT reduced the number of required rotation steps by an average of 49.23% compared to the traditional max-element Jacobi method.
- Speedup: The method achieved an inference time of just 0.11 minutes per matrix, representing a 45x speedup over the FastEigen algorithm.
- Zero-Shot Transfer: A model trained on $5 \times 5$ matrices successfully diagonalized $3 \times 3$ matrices without additional training, outperforming the max-element method by 38.72%.
By adding $\epsilon$-greedy exploration, the authors created a safety net that allows the solver to recover from errors when encountering matrices slightly different from the training set, ensuring higher reliability than purely deterministic AI models.
Conclusion and Future Work
While the current study demonstrates the power of Decision Transformers in accelerating numerical algorithms, scalability remains a primary challenge. As matrix size increases, the action space grows quadratically, potentially straining the Transformer's attention mechanism. Future work will focus on optimizing the codebase for larger matrices, exploring different probability distributions for state sampling, and refining reward functions to better account for numerical stability.
Summary updated