Improving Matrix Exponential for Generative AI Flows: A Taylor-Based Approach Beyond Paterson-Stockmeyer

Authors: J. Sastre, D. Faronbi, J.M. Alonso, P. Traver, J. Ibáñez, N. Lloret

Summary

The paper proposes an improved algorithm for computing the matrix exponential, a key operation in scientific computing and system simulation (control theory, quantum mechanics and, more recently, generative machine learning models).

Background

The traditional standard has been to combine Padé approximants with the scaling and squaring technique. However, Taylor-based methods, which use polynomial evaluation schemes more efficient than the classical Paterson-Stockmeyer approach, offer higher accuracy and lower computational cost.

Contributions

  • An optimized Taylor-based algorithm designed for the high-throughput requirements of generative AI flows.
  • A rigorous error analysis.
  • A dynamic strategy for selecting the Taylor order and scaling factor, minimizing computational effort within a given error tolerance.

Results

Numerical experiments show significant acceleration and good numerical stability compared to current state-of-the-art implementations, making the method an efficient tool for large-scale generative modeling.

Link

https://www.themoonlight.io/en/review/improving-matrix-exponential-for-generative-ai-flows-a-taylor-based-approach-beyond-paterson-stockmeyer

Keywords

Matrix exponential, scaling and squaring, Taylor approximation, Padé approximant, efficient matrix polynomial evaluation,
Algorithmic Efficiency, Generative AI flows.

A MATLAB Tool for the Stable Generation of Matrix Polynomial Evaluation Schemes with Two-Product Savings

The efficient evaluation of high-degree matrix polynomials is central to the numerical approximation of matrix functions. For decades, the Paterson–Stockmeyer (PS) method has provided the standard benchmark for reducing the number of matrix–matrix multiplications required by these computations. Recent theoretical advances, however, have shown that further savings are possible through evaluation schemes that eliminate two matrix products (2M) relative to the classical approach. Despite this progress, numerically stable implementations of such schemes have remained largely restricted to a few specific polynomial degrees and applications.

Javier Ibáñez, Jorge Sastre, José M. Alonso, and Emilio Defez address this limitation by developing a software-assisted procedure that extends the 2M reduction to polynomials of degrees m∈{18,21,24,26,27,28} and to every degree m≥30, provided that the leading coefficient is nonzero. The main numerical challenge lies in determining the coefficients that define the evaluation schemes. These coefficients are obtained by solving systems of nonlinear equations, whose solutions may differ substantially in their numerical stability. The authors therefore introduce an automated verification procedure to identify and validate coefficient sets suitable for floating-point computations.

The central contribution is a MATLAB implementation that combines symbolic computation with variable-precision arithmetic to construct the reduced nonlinear systems, identify suitable solutions, assess their numerical stability, and estimate the precision required for reliable evaluation. Beyond the 2M cases, the framework also identifies polynomial degrees for which a one-product reduction is attainable, thereby extending the range of available evaluation strategies.

Numerical experiments involving several matrix functions show that the resulting schemes maintain accuracy comparable to that of the classical Paterson–Stockmeyer method and, in some cases, improve upon it, while consistently achieving the predicted reduction of two matrix–matrix multiplications. These results demonstrate that the proposed software provides a practical route from theoretical evaluation formulas to numerically reliable implementations, making the computational savings accessible to a substantially broader class of matrix polynomials.


Publication details


Main Contributions

  • Software procedure extending the two-matrix-product reduction to a broad range of polynomial degrees.
  • Automated verification routine for selecting numerically stable coefficient sets.
  • MATLAB implementation using variable-precision arithmetic and numerical validation on matrix functions.

Why This Matters

The reduction of two matrix–matrix multiplications represents both a theoretical and a practical improvement in the computational cost of evaluating high-degree polynomials. The developed tool makes this reduction reliably accessible across a broad range of polynomial degrees, potentially benefiting matrix function algorithms that rely on polynomial approximations.

An Optimized Taylor Algorithm for the Matrix Exponential in Generative AI Workflows

The matrix exponential is a key operation in scientific computing and system simulation, with applications ranging from control theory and quantum mechanics to modern generative machine learning. Although Padé approximants combined with scaling and squaring have traditionally been the standard approach, recent advances in Taylor-based methods have shown that more efficient polynomial evaluation schemes can outperform the classical Paterson–Stockmeyer algorithm, both in accuracy and computational cost.

In this work, J. Sastre, D. Faronbi, J. M. Alonso, P. Traver, J. Ibáñez, and N. Lloret introduce an optimized Taylor-based algorithm for computing the matrix exponential, specifically developed to address the computational demands of generative AI flows. The method combines advanced matrix polynomial evaluation techniques with a rigorous error analysis and an adaptive strategy for selecting the Taylor approximation order and scaling factor. This allows the algorithm to adjust its computational effort to the properties of each input matrix while meeting a prescribed accuracy tolerance.

Beyond the numerical formulation itself, the main contribution lies in translating these algorithmic improvements into measurable gains in generative model training and inference. By reducing the number of matrix multiplications required without compromising numerical accuracy, the proposed approach addresses a significant computational bottleneck in flow-based architectures. Experiments on standard image datasets report training speedups ranging from 3.91× to 9.74× compared with the original implementation, while inference on batches of 128 samples is approximately 1.95× faster. These results illustrate how improvements in numerical algorithms can directly contribute to the efficiency and scalability of modern generative models.


Publication Details


Main Countributions

  • Optimized Taylor algorithm for the matrix exponential, designed for generative AI flows.
  • Error analysis and an adaptive strategy for selecting the Taylor approximation order and scaling factor.
  • Significant speedups while maintaining high numerical stability compared with reference implementations.

Why This Matters

Generative AI flows rely on computationally intensive matrix operations. A faster and more stable method for computing the matrix exponential can reduce the computational cost of these models without compromising accuracy.

A Charlier-Polynomial Approach to the Matrix Exponential

The matrix exponential is one of the most frequently evaluated matrix functions, and small improvements in its numerical computation can have a significant impact on large-scale scientific workloads. In a paper published in the International Journal of Computer Mathematics, J. M. Alonso, E. Defez, J. Ibáñez, J. Sastre, and A. Ibáñez introduce a new method based on Charlier polynomials in combination with the scaling-and-squaring technique.

The approximating matrix polynomial is evaluated through an efficient polynomial evaluation scheme that keeps the computational cost competitive with existing state-of-the-art codes. The authors perform a comprehensive numerical comparison across different matrix types. In their testbed, the variant expm_charlier_1 consistently appears among the most accurate and stable methods, while other variants and a reference code (expm_new) show higher error levels in a substantial fraction of the cases.

A distinctive aspect of this work is the use of a discrete orthogonal polynomial family in the matrix-exponential context. To our knowledge, discrete orthogonal polynomials, like the case of Charlier polynomials, have not been previously employed to address the matrix exponential computation.The article thus contributes a new polynomial family to the toolbox of matrix-exponential algorithms and provides empirical evidence of its numerical behaviour, without relying on asymptotic arguments alone.


Publication Details

  • Title: Computing Matrix Exponentials via Charlier Method
  • Authors: J. M. Alonso, E. Defez, J. Ibáñez, J. Sastre, A. Ibáñez
  • Journal: International Journal of Computer Mathematics, 1-20, 2026
  • DOI: 10.1080/00207160.2026.2697770

Main Contributions

  • A new algorithm for the matrix exponential based on Charlier matrix polynomialsand scaling-and-squaring.
  • Efficient evaluation of the approximating matrix polynomial via the Paterson–Stockmeyer method.
  • A numerical study showing that the expm_charlier_1 variant achieves competitive accuracy and stability across different matrix classes.
  • The first use, to the authors’ knowledge, of discrete orthogonal polynomials (Charlier) for matrix-exponential computation.

Why This Matters

Matrix exponentials appear in the solution of differential equations, in control theory, and in many scientific computing pipelines. Extending the set of reliable polynomial-based methods gives practitioners more options when selecting an algorithm for a specific matrix structure or accuracy requirement.

New Generating Functions for Chebyshev, Gegenbauer, and Jacobi Matrix Polynomials

Generating functions are a fundamental tool in the analysis of orthogonal polynomials, but their extension to the matrix setting has remained fragmented across different polynomial families. In a new article published in Mediterranean Journal of Mathematics, Emilio Defez and Michael M. Tung present a unified approach to deriving generating functions for the matrix analogues of the Chebyshev, Gegenbauer, and Jacobi polynomials.

The work does not stop at the matrix level. Alongside the matrix generating functions, the authors establish several explicit identities for the corresponding scalar polynomial families. These results provide new analytical tools for a class of polynomials that play a growing role in the numerical solution of matrix differential equations, the approximation of inverse Laplace transforms, and the high-accuracy computation of matrix functions such as the exponential.

By bringing three classical families under a single derivation framework, the article offers a compact reference for researchers working with matrix orthogonal polynomials and opens the door to analogous results for other polynomial sequences.


Publication Details

  • Title: New Generating Functions for Chebyshev, Gegenbauer, and Jacobi Matrix Polynomials
  • Authors: E. Defez, M. M. Tung
  • Journal: Mediterranean Journal of Mathematics, Vol. 23, 2026, Article 118
  • DOI: 10.1007/s00009-026-03119-x

Main Contributions

  • A unified derivation of generating functions for Chebyshev, Gegenbauer, and Jacobi matrix polynomials.
  • New explicit identities for the corresponding scalar polynomial families.
  • A consistent analytical framework that connects three classical polynomial sequences in the matrix setting.

Why This Matters

Matrix orthogonal polynomials are increasingly used in numerical linear algebra and in the approximation of matrix functions. Having a unified source of generating functions simplifies the derivation of new series expansions and can reduce the analytical effort required when adapting classical polynomial techniques to the matrix case.

Euler polynomials for the matrix exponential approximation

José M. Alonso, Javier Ibáñez, Emilio Defez, Pedro Alonso-Jordá. Journal of Computational and Applied Mathematics, vol. 425, 115074, 2023. https://doi.org/10.1016/j.cam.2023.115074.

In this work, a new method to compute the matrix exponential function by using an approximation based on Euler polynomials is proposed. These polynomials are used in combination with the scaling and squaring technique, considering an absolute forward-type theoretical error. Its numerical and computational properties have been evaluated and compared with the most current and competitive codes dedicated to the computation of the matrix exponential. Under a heterogeneous test battery and a set of exhaustive experiments, it has been demonstrated that the new method offers performance in terms of accuracy and stability which is as good as or even better than those of the considered methods, with an intermediate computational cost among all of them. All of the above makes this a very competitive alternative that should be considered in the growing list of available numerical methods and implementations dedicated to the approximation of the matrix exponential.

Boosting the computation of the matrix exponential

Boosting the computation of the matrix exponential, J. Sastre, J. Ibáñez, E. Defez, Appl. Math. Comput. in press, 2018, doi:10.1016/j.amc.2018.08.017, Preprint, Matlab code expmpol.m.

This paper presents new Taylor algorithms for the computation of the matrix exponential based on recent new matrix polynomial evaluation methods. Those methods are more efficient than the well known Paterson–Stockmeyer method. The cost of the proposed algorithms is reduced with respect to previous algorithms based on Taylor approximations. Tests have been performed to compare the MATLAB implementations of the new algorithms to a state-of-the-art Padé algorithm for the computation of the matrix exponential, providing higher accuracy and cost performances.

First article with an application of the new matrix polynomial evaluation methods from J. Sastre, Efficient evaluation of matrix polynomials, Linear Algebra Appl. 539, (2018) 229-250. With the new matrix polynomial evaluation methods, Taylor approximation methods are more efficient than Padé approximant based methods.

A new efficient and accurate spline algorithm for the matrix exponential computation

A new efficient and accurate spline algorithm for the matrix exponential computation, Emilio Defez, Javier Ibáñez, Jorge Sastre, Jesús Peinado, Pedro Alonso. Journal of Computational and Applied Mathematics, Volume 337, pp. 354-365. August 2018. Preprint, Matlab code expmspl.m.

In this work an accurate and efficient method based on matrix splines for computing matrix exponential is given. An algorithm and a MATLAB implementation have been developed and compared with the state-of-the-art algorithms for computing the matrix exponential. We also developed a parallel implementation for large scale problems. This implementation allowed us to get a much better performance when working with this kind of problems.