On the Computational Hardness of Transformers
Abstract
The transformer has revolutionized modern AI across language, vision, and beyond. It consists of layers, each running attention heads in parallel and feeding the combined output to the subsequent layer. In attention, the input consists of tokens, each a vector of dimension . The attention mechanism involves multiplying three matrices, applying softmax to an intermediate product. Several recent works have advanced our understanding of the complexity of attention. Known algorithms for transformers compute each attention head independently. This raises a fundamental question that has recurred throughout TCS under the guise of ``direct sum'' problems: can multiple instances of the same problem be solved more efficiently than solving each instance separately? Many answers to this question, both positive and negative, have arisen in fields spanning communication complexity and algorithm design. Thus, we ask whether transformers can be computed more efficiently than independent evaluations of attention. In this paper, we resolve this question in the negative, and give the first non-trivial computational lower bounds for multi-head multi-layer transformers. In the small embedding regime (), computing attention heads separately takes time. We establish that this is essentially optimal under SETH. In the large embedding regime (), one can compute attention heads separately using arithmetic operations (plus exponents), where is the matrix multiplication exponent. We establish that this is optimal, by showing that arithmetic operations are necessary when . Our lower bound in the large embedding regime relies on a novel application of the Baur-Strassen theorem, a powerful algorithmic tool underpinning the famous backpropagation algorithm.
Cite
@article{arxiv.2603.11332,
title = {On the Computational Hardness of Transformers},
author = {Barna Saha and Yinzhan Xu and Christopher Ye and Hantao Yu},
journal= {arXiv preprint arXiv:2603.11332},
year = {2026}
}
Comments
46 pages, 2 figures. Abstract shortened to meet arXiv requirements