Large language models (LLMs) have made fundamental changes in human life. The attention scheme is one of the key components over all the LLMs, such as BERT, GPT-1, Transformers, GPT-2, 3, 3.5 and 4. Inspired by previous theoretical study of static version of the attention multiplication problem [Zandieh, Han, Daliri, and Karbasi arXiv 2023, Alman and Song arXiv 2023]. In this work, we formally define a dynamic version of attention matrix multiplication problem. There are matrices $Q,K, V \in \mathbb{R}^{n \times d}$, they represent query, key and value in LLMs. In each iteration we update one entry in $K$ or $V$. In the query stage, we receive $(i,j) \in [n] \times [d]$ as input, and want to answer $(D^{-1} A V)_{i,j}$, where $A:=\exp(QK^\top) \in \mathbb{R}^{n \times n}$ is a square matrix and $D := \mathrm{diag}(A {\bf 1}_n) \in \mathbb{R}^{n \times n}$ is a diagonal matrix. Here ${\bf 1}_n$ denote a length-$n$ vector that all the entries are ones. We provide two results: an algorithm and a conditional lower bound. $\bullet$ On one hand, inspired by the lazy update idea from [Demetrescu and Italiano FOCS 2000, Sankowski FOCS 2004, Cohen, Lee and Song STOC 2019, Brand SODA 2020], we provide a data-structure that uses $O(n^{\omega(1,1,\tau)-\tau})$ amortized update time, and $O(n^{1+\tau})$ worst-case query time. $\bullet$ On the other hand, show that unless the hinted matrix vector multiplication conjecture [Brand, Nanongkai and Saranurak FOCS 2019] is false, there is no algorithm that can use both $O(n^{\omega(1,1,\tau) - \tau- \Omega(1)})$ amortized update time, and $O(n^{1+\tau-\Omega(1)})$ worst query time. In conclusion, our algorithmic result is conditionally optimal unless hinted matrix vector multiplication conjecture is false.


翻译:大型语言模型(LLMs)已对人类生活产生根本性变革。注意力机制是BERT、GPT-1、Transformer、GPT-2、3、3.5和4等所有LLMs中的核心组件之一。受先前关于静态注意力乘性问题理论研究的启发[Zandieh, Han, Daliri, and Karbasi arXiv 2023, Alman and Song arXiv 2023],本文正式定义了注意力矩阵乘法的动态版本。设有矩阵 $Q,K, V \in \mathbb{R}^{n \times d}$,分别表示LLMs中的查询、键和值。在每次迭代中,我们更新 $K$ 或 $V$ 中的一个条目。在查询阶段,输入为 $(i,j) \in [n] \times [d]$,需回答 $(D^{-1} A V)_{i,j}$,其中 $A:=\exp(QK^\top) \in \mathbb{R}^{n \times n}$ 为方阵,$D := \mathrm{diag}(A {\bf 1}_n) \in \mathbb{R}^{n \times n}$ 为对角矩阵。这里 ${\bf 1}_n$ 表示长度为 $n$ 的全1向量。我们给出两项结果:一种算法和一个条件性下界。$\bullet$ 一方面,受[Demetrescu and Italiano FOCS 2000, Sankowski FOCS 2004, Cohen, Lee and Song STOC 2019, Brand SODA 2020]中惰性更新思想的启发,我们提出一种数据结构,其均摊更新时间为 $O(n^{\omega(1,1,\tau)-\tau})$,最坏情况查询时间为 $O(n^{1+\tau})$。$\bullet$ 另一方面,我们证明除非提示矩阵向量乘法猜想[Brand, Nanongkai and Saranurak FOCS 2019]不成立,否则不存在均摊更新时间为 $O(n^{\omega(1,1,\tau) - \tau- \Omega(1)})$ 且最坏查询时间为 $O(n^{1+\tau-\Omega(1)})$ 的算法。总之,除非提示矩阵向量乘法猜想不成立,我们的算法结果在条件性意义下是最优的。

0
下载
关闭预览

相关内容

在Omega中,资源发放是乐观的(optimistic),每一个应用都发放了所有的可用的资源,冲突是在提交的时候被解决的。Omega的资源管理器,本质上是一个保存着每一个节点的状态关系数据库,并且用不同的乐观并发控制来解决冲突。这样的好处是其大大的提高了调度器的性能(完全的并行,full parallelism)和资源利用率。
【Yoshua Bengio最新一作论文】GFlowNet基础,GFlowNet Foundations
专知会员服务
26+阅读 · 2021年11月22日
【文本生成现代方法】Modern Methods for Text Generation
专知会员服务
44+阅读 · 2020年9月11日
BERT进展2019四篇必读论文
专知会员服务
70+阅读 · 2020年1月2日
强化学习最新教程,17页pdf
专知会员服务
182+阅读 · 2019年10月11日
论文浅尝 | Temporal Knowledge Graph Completion Using Box Embeddings
开放知识图谱
1+阅读 · 2022年11月4日
一文带你浏览Graph Transformers
图与推荐
2+阅读 · 2022年7月14日
强化学习三篇论文 避免遗忘等
CreateAMind
20+阅读 · 2019年5月24日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
论文共读 | Attention is All You Need
黑龙江大学自然语言处理实验室
15+阅读 · 2017年9月7日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2010年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Arxiv
0+阅读 · 2023年5月22日
Arxiv
34+阅读 · 2022年12月20日
VIP会员
最新内容
超越网格:作战环境对炮兵的影响
专知会员服务
2+阅读 · 5月31日
BES:让语言模型通过双向进化搜索自我改进
专知会员服务
6+阅读 · 5月30日
以色列-美国-伊朗战争中的无人机:关键要点
专知会员服务
7+阅读 · 5月30日
《Palantir任务保障性软件安全标准(MA-S2)》
专知会员服务
19+阅读 · 5月30日
基于声学的无人机检测技术综述
专知会员服务
11+阅读 · 5月30日
《当代混合战争分析框架:俄乌战争经验教训》
专知会员服务
10+阅读 · 5月30日
相关资讯
论文浅尝 | Temporal Knowledge Graph Completion Using Box Embeddings
开放知识图谱
1+阅读 · 2022年11月4日
一文带你浏览Graph Transformers
图与推荐
2+阅读 · 2022年7月14日
强化学习三篇论文 避免遗忘等
CreateAMind
20+阅读 · 2019年5月24日
Unsupervised Learning via Meta-Learning
CreateAMind
44+阅读 · 2019年1月3日
A Technical Overview of AI & ML in 2018 & Trends for 2019
待字闺中
18+阅读 · 2018年12月24日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
【论文】变分推断(Variational inference)的总结
机器学习研究会
39+阅读 · 2017年11月16日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
论文共读 | Attention is All You Need
黑龙江大学自然语言处理实验室
15+阅读 · 2017年9月7日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2010年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员