  This paper introduces a novel framework for matrix diagonalization, recasting
it as a sequential decision-making problem and applying the power of Decision
Transformers (DTs). Our approach determines optimal pivot selection during
diagonalization with the Jacobi algorithm, leading to significant speedups
compared to the traditional max-element Jacobi method. To bolster robustness,
we integrate an epsilon-greedy strategy, enabling success in scenarios where
deterministic approaches fail. This work demonstrates the effectiveness of DTs
in complex computational tasks and highlights the potential of reimagining
mathematical operations through a machine learning lens. Furthermore, we
establish the generalizability of our method by using transfer learning to
diagonalize matrices of smaller sizes than those trained.
