arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.16714quant-phcs.AIcs.CL
收藏

Quantum Transformer:通过量子线性代数加速模型推理

Quantum Transformer: Accelerating model inference via quantum linear algebra

Centre for Quantum Technologies, National University of Singapore(新加坡国立大学量子技术中心);Department of Computer Science, University of Toronto(多伦多大学计算机科学系);Vector Institute for Artificial Intelligence(人工智能向量研究所);School of Computing, National University of Singapore(新加坡国立大学计算机学院);Department of Mathematics, National University of Singapore(新加坡国立大学数学系);NVIDIA Corporation(NVIDIA公司);Department of Chemistry, University of Toronto(多伦多大学化学系);Research Center for Emerging Computing Technologies, National Institute of Advanced Industrial Science and Technology (AIST)(新兴计算技术研究中心,日本国家先进工业科学与技术研究院);Quantum Computing Center, Keio University(Keio大学量子计算中心);Department of Materials Science & Engineering, University of Toronto(多伦多大学材料科学与工程系);Department of Chemical Engineering & Applied Chemistry, University of Toronto(多伦多大学化学工程与应用化学系);Lebovic Fellow, Canadian Institute for Advanced Research(加拿大高级研究研究院Lebovic研究员)

Naixu Guo, Zhan Yu, Matthew Choi, Yizhan Han, Aman Agrawal, Kouhei Nakaji, Alán Aspuru-Guzik, Patrick Rebentrost

AI总结:

本研究从容错量子计算视角探究Transformer架构,开发构建其核心模块的量子子例程,实现矩阵哈达玛积等运算,通过数值实验验证了量子计算在实际场景中加速Transformer推理的潜力。

摘要:

大语言模型(LLM)驱动的强大生成式人工智能需要消耗大量计算资源用于推理。本研究从容错量子计算的视角,探究了这类模型的核心组件——Transformer架构。我们开发了量子子例程,用于构建Transformer的基础模块,包括自注意力、带层归一化的残差连接以及前馈网络。作为一项重要的子例程,我们展示了如何在量子计算机上高效实现矩阵的哈达玛积与逐元素函数运算。我们的算法可生成Transformer输出的振幅编码,该编码可用于测量预测或作为下一层的输入。研究发现,输入序列的矩阵范数是决定量子复杂度的主导因素。通过在开源LLM(包括生物信息学应用场景的模型)上开展的数值实验,我们证明了在实际场景中量子计算可实现Transformer推理的加速潜力。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑