Quantum Transformer: Accelerating model inference via quantum linear algebra
Fuente:
arXiv
Guardado en:
| Autores principales: | , , , , , , , |
|---|---|
| Formato: | Preprint |
| Publicado: |
2024
|
| Materias: | |
| Acceso en línea: | |
| Etiquetas: |
Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
|
| _version_ | 1866914119641202688 |
|---|---|
| author | Guo, Naixu Yu, Zhan Choi, Matthew Han, Yizhan Agrawal, Aman Nakaji, Kouhei Aspuru-Guzik, Alán Rebentrost, Patrick |
| author_facet | Guo, Naixu Yu, Zhan Choi, Matthew Han, Yizhan Agrawal, Aman Nakaji, Kouhei Aspuru-Guzik, Alán Rebentrost, Patrick |
| contents | 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, including for bio-informatics applications, we demonstrate the potential of a quantum speedup for transformer inference in practical regimes. |
| format | Preprint |
| id |
arxiv_https___arxiv_org_abs_2402_16714 |
| institution | arXiv |
| publishDate | 2024 |
| record_format | arxiv |
| spellingShingle | Quantum Transformer: Accelerating model inference via quantum linear algebra Guo, Naixu Yu, Zhan Choi, Matthew Han, Yizhan Agrawal, Aman Nakaji, Kouhei Aspuru-Guzik, Alán Rebentrost, Patrick Quantum Physics Artificial Intelligence Computation and Language 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, including for bio-informatics applications, we demonstrate the potential of a quantum speedup for transformer inference in practical regimes. |
| title | Quantum Transformer: Accelerating model inference via quantum linear algebra |
| topic | Quantum Physics Artificial Intelligence Computation and Language |
| url | https://arxiv.org/abs/2402.16714 |