Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Approximating Matrix Functions with Deep Neural Networks and Transformers

About

Transformers have revolutionized natural language processing, but their use for numerical computation has received less attention. We study the approximation of matrix functions, which map scalar functions to matrices, using neural networks including transformers. We focus on functions mapping square matrices to square matrices of the same dimension. These types of matrix functions appear throughout scientific computing, e.g., the matrix exponential in continuous-time Markov chains and the matrix sign function in stability analysis of dynamical systems. In this paper, we make two contributions. First, we prove bounds on the width and depth of ReLU networks needed to approximate the matrix exponential to an arbitrary precision. Second, we show experimentally that a transformer encoder-decoder with suitable numerical encodings can approximate certain matrix functions at a relative error of 5% with high probability. Our study reveals that the encoding scheme strongly affects performance, with different schemes working better for different functions.

Rahul Padmanabhan, Simone Brugiapaglia• 2026

Related benchmarks

TaskDatasetResultRank
Matrix Cosine Approximation5 x 5 matrices
Accuracy (tol=0.05)0.00e+0
4
Matrix Cosine Approximation3x3 matrices
Accuracy (tol=0.05)10.43
4
Matrix Exponential Approximation5 x 5 matrices
Accuracy (tol=0.05)93.86
4
Matrix Exponential Approximation3x3 matrices
Accuracy (tol=0.05)99.58
4
Matrix Logarithm Approximation5 x 5 matrices
Accuracy (tol=0.05)84.31
4
Matrix Logarithm Approximation3x3 matrices
Accuracy (tol=0.05)93.09
4
Matrix Sign Approximation5 x 5 matrices
Accuracy (tol=0.05)1.89
4
Matrix Sign Approximation3x3 matrices
Accuracy (tol=0.05)97
4
Matrix Sine Approximation5 x 5 matrices
Accuracy (tol=0.05)0.00e+0
4
Matrix Sine Approximation3x3 matrices
Accuracy (tol=0.05)0.00e+0
4
Showing 10 of 10 rows

Other info

Follow for update