Quantum Transformer: Accelerating model inference via quantum linear algebra
Naixu Guo, Zhan Yu, Matthew Choi, Yizhan Han, Aman Agrawal, Kouhei Nakaji, Al\'an Aspuru-Guzik, Patrick Rebentrost

TL;DR
This paper explores how quantum computing can accelerate transformer-based AI models by developing quantum algorithms for key components, showing potential speedups in inference tasks with practical implications.
Contribution
It introduces quantum subroutines for transformer components and demonstrates potential quantum speedup in inference for large language models.
Findings
Quantum algorithms for self-attention and feed-forward networks
Potential quantum speedup demonstrated on open-source LLMs
Matrix norm influences quantum complexity significantly
Abstract
Powerful generative artificial intelligence from large language models (LLMs) harnesses extensive computational resources for inference. In this work, we investigate the transformer architecture, a key component of these models, under the lens of fault-tolerant quantum computing. We develop quantum subroutines to construct the building blocks in the transformer, including the self-attention, residual connection with layer normalization, and feed-forward network. As an important subroutine, we show how to efficiently implement the Hadamard product and element-wise functions of matrices on quantum computers. Our algorithm prepares an amplitude encoding of the transformer output, which can be measured for prediction or use in the next layer. We find that the matrix norm of the input sequence plays a dominant role in the quantum complexity. With numerical experiments on open-source LLMs,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsOptical Network Technologies · ECG Monitoring and Analysis · Semiconductor Lasers and Optical Devices
MethodsResidual Connection · Softmax
