arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2212.14052cs.LGcs.CL
收藏

Hungry Hungry Hippos:迈向基于状态空间模型的语言建模

Hungry Hungry Hippos: Towards Language Modeling with State Space Models

Stanford University(斯坦福大学);University at Buffalo, SUNY(纽约州立大学布法罗分校)

Daniel Y. Fu, Tri Dao, Khaled K. Saab, Armin W. Thomas, Atri Rudra, Christopher Ré

AI总结:

该研究针对状态空间模型(SSMs)在语言建模中表达能力弱于注意力、硬件效率低的问题,提出H3层与FlashConv算法,构建的混合模型在多项基准上性能与速度均优于Transformers。

摘要:

状态空间模型(SSMs)已在部分模态中展现出最先进的序列建模性能,但在语言建模任务上的表现不及注意力机制。此外,尽管SSMs的计算复杂度随序列长度近似线性增长而非二次增长,但由于硬件利用率低下,其运行速度仍慢于Transformers。本文在厘清语言建模中SSMs与注意力机制的表达能力差距、降低二者间的硬件效率壁垒方面取得了进展。首先,我们利用合成语言建模任务分析SSMs与注意力机制的差距,发现现有SSMs在两项能力上存在短板:回忆序列中较早的token、跨序列比较token。为明确这一问题对语言建模的影响,我们提出一种全新的SSM层H3,专门针对上述两项能力设计。H3在合成语言任务上的表现与注意力机制相当,在OpenWebText数据集上的困惑度(PPL)仅比Transformers高0.4。此外,保留两层注意力层的1.25亿参数H3-注意力混合模型,在OpenWebText上的PPL竟比Transformers低1.0,表现更优。接下来,为提升现代硬件上SSMs的训练效率,我们提出FlashConv。FlashConv采用融合块FFT算法提升长度不超过8K的序列的处理效率,并引入一种新颖的状态传递算法,利用SSMs的循环特性实现更长序列的扩展。FlashConv在长程竞技场(long-range arena)基准上实现了2倍加速,使混合语言模型的文本生成速度比Transformers快2.4倍。借助FlashConv,我们在Pile数据集上将H3-注意力混合语言模型的参数规模扩展至27亿,并取得了颇具前景的初步结果:其困惑度低于Transformers,且在SuperGLUE基准的大多数任务上,零样本和少样本学习表现均优于Transformers。

英文摘要:

State space models (SSMs) have demonstrated state-of-the-art sequence modeling performance in some modalities, but underperform attention in language modeling. Moreover, despite scaling nearly linearly in sequence length instead of quadratically, SSMs are still slower than Transformers due to poor hardware utilization. In this paper, we make progress on understanding the expressivity gap between SSMs and attention in language modeling, and on reducing the hardware barrier between SSMs and attention. First, we use synthetic language modeling tasks to understand the gap between SSMs and attention. We find that existing SSMs struggle with two capabilities: recalling earlier tokens in the sequence and comparing tokens across the sequence. To understand the impact on language modeling, we propose a new SSM layer, H3, that is explicitly designed for these abilities. H3 matches attention on the synthetic languages and comes within 0.4 PPL of Transformers on OpenWebText. Furthermore, a hybrid 125M-parameter H3-attention model that retains two attention layers surprisingly outperforms Transformers on OpenWebText by 1.0 PPL. Next, to improve the efficiency of training SSMs on modern hardware, we propose FlashConv. FlashConv uses a fused block FFT algorithm to improve efficiency on sequences up to 8K, and introduces a novel state passing algorithm that exploits the recurrent properties of SSMs to scale to longer sequences. FlashConv yields 2$\times$ speedup on the long-range arena benchmark and allows hybrid language models to generate text 2.4$\times$ faster than Transformers. Using FlashConv, we scale hybrid H3-attention language models up to 2.7B parameters on the Pile and find promising initial results, achieving lower perplexity than Transformers and outperforming Transformers in zero- and few-shot learning on a majority of tasks in the SuperGLUE benchmark.

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

↑