arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2406.07522cs.CLcs.LG
收藏

Samba:用于高效无限上下文语言建模的简单混合状态空间模型

Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling

Microsoft(微软);University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校)

Liliang Ren, Yang Liu, Yadong Lu, Yelong Shen, Chen Liang, Weizhu Chen

AI总结:

本文提出Samba,一种结合Mamba状态空间模型与滑动窗口注意力的混合架构,实现线性时间复杂度的无限上下文建模,在多项基准上超越现有模型,并支持高效的长上下文外推。

摘要:

高效地对无限上下文长度的序列进行建模一直是一个具有挑战性的问题。以往的方法要么遭受二次计算复杂度的困扰,要么在长度泛化方面外推能力有限。在这项工作中,我们提出了Samba,一种简单的混合架构,它在层级别上结合了Mamba(一种选择性状态空间模型(SSM))与滑动窗口注意力(SWA)。Samba选择性地将给定序列压缩为循环隐藏状态,同时仍能通过注意力机制精确回忆近期记忆。我们将Samba扩展到38亿参数,并使用3.2万亿训练令牌,证明它在各种基准测试中显著优于最先进的模型。在4K长度的序列上预训练后,Samba在零样本情况下,在长达1M的上下文长度中显示出改进的困惑度。当在4K长度序列上进行微调时,Samba高效地外推到256K上下文长度,并在Passkey检索任务上实现完美的记忆回忆,在具有挑战性的Phonebook任务上,与全注意力模型相比,表现出优越的检索外推能力。作为一种线性时间序列模型,对于128K长度的用户提示,Samba的吞吐量比使用分组查询注意力的Transformer高3.73倍,在生成64K令牌且无限流式传输时,速度提升3.64倍。我们在开源数据上的训练代码公开于https://github.com/microsoft/Samba。

英文摘要:

Efficiently modeling sequences with infinite context length has long been a challenging problem. Previous approaches have either suffered from quadratic computational complexity or limited extrapolation ability in length generalization. In this work, we present Samba, a simple hybrid architecture that layer-wise combines Mamba, a selective State Space Model (SSM), with Sliding Window Attention (SWA). Samba selectively compresses a given sequence into recurrent hidden states while still maintaining the ability to precisely recall recent memories with the attention mechanism. We scale Samba up to 3.8B parameters with 3.2T training tokens and demonstrate that it significantly outperforms state-of-the-art models across a variety of benchmarks. Pretrained on sequences of 4K length, Samba shows improved perplexity in context lengths of up to 1M in zero-shot. When finetuned on 4K-length sequences, Samba efficiently extrapolates to a 256K context length with perfect memory recall on the Passkey Retrieval task, and exhibits superior retrieval extrapolation on the challenging Phonebook task compared to full-attention models. As a linear-time sequence model, Samba achieves a 3.73x higher throughput compared to Transformers with grouped-query attention for user prompts of 128K length, and a 3.64x speedup when generating 64K tokens with unlimited streaming. Our code for training on open source data is publicly available at https://github.com/microsoft/Samba.

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

↑