NLAFormer: Transformers Learn Numerical Linear Algebra Operations

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Ma, Zhantao, Gao, Yihang, Ng, Michael K.
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915466031661056
author Ma, Zhantao
Gao, Yihang
Ng, Michael K.
author_facet Ma, Zhantao
Gao, Yihang
Ng, Michael K.
contents Transformers are effective and efficient at modeling complex relationships and learning patterns from structured data in many applications. The main aim of this paper is to propose and design NLAFormer, which is a transformer-based architecture for learning numerical linear algebra operations: pointwise computation, shifting, transposition, inner product, matrix multiplication, and matrix-vector multiplication. Using a linear algebra argument, we demonstrate that transformers can express such operations. Moreover, the proposed approach discards the simulation of computer control flow adopted by the loop-transformer, significantly reducing both the input matrix size and the number of required layers. By assembling linear algebra operations, NLAFormer can learn the conjugate gradient method to solve symmetric positive definite linear systems. Experiments are conducted to illustrate the numerical performance of NLAFormer.
format Preprint
id arxiv_https___arxiv_org_abs_2508_19557
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle NLAFormer: Transformers Learn Numerical Linear Algebra Operations
Ma, Zhantao
Gao, Yihang
Ng, Michael K.
Numerical Analysis
65F10, 68Q32
Transformers are effective and efficient at modeling complex relationships and learning patterns from structured data in many applications. The main aim of this paper is to propose and design NLAFormer, which is a transformer-based architecture for learning numerical linear algebra operations: pointwise computation, shifting, transposition, inner product, matrix multiplication, and matrix-vector multiplication. Using a linear algebra argument, we demonstrate that transformers can express such operations. Moreover, the proposed approach discards the simulation of computer control flow adopted by the loop-transformer, significantly reducing both the input matrix size and the number of required layers. By assembling linear algebra operations, NLAFormer can learn the conjugate gradient method to solve symmetric positive definite linear systems. Experiments are conducted to illustrate the numerical performance of NLAFormer.
title NLAFormer: Transformers Learn Numerical Linear Algebra Operations
topic Numerical Analysis
65F10, 68Q32
url https://arxiv.org/abs/2508.19557