跳到主要内容

Mamba 与状态空间模型

Transformer 路线中的 SSM 简介见 2.3.7 Mamba 与 SSM

要解决的问题

突破 Transformer O(L2)O(L^2) attention 瓶颈,用 线性递推状态 处理超长序列,同时尽量保持并行训练能力。

状态空间模型(SSM)

连续形式 h˙=Ah+Bx\dot{\mathbf{h}} = \mathbf{A}\mathbf{h} + \mathbf{B}\mathbf{x},离散化后:

ht=Aˉht1+Bˉxt,yt=Cht\mathbf{h}_t = \bar{\mathbf{A}}\mathbf{h}_{t-1} + \bar{\mathbf{B}}\mathbf{x}_t, \quad \mathbf{y}_t = \mathbf{C}\mathbf{h}_t

推理每步 O(1)O(1) 更新固定维状态(相对 KV 线性增长)。

Mamba(选择性 SSM)

与 Transformer 的取舍

TransformerMamba
精确拷贝/检索需验证
训练生态极成熟成长中
推理长序列KV 贵状态固定

混合架构

Jamba、Zamba 等 Attention 层 + SSM 层 交替,兼顾质量与吞吐。

参考