Files
myWiki/concepts/structured-state-space-duality.md

53 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "结构化状态空间对偶 (Structured State Space Duality)"
created: 2026-06-18
updated: 2026-06-18
type: concept
tags: [ssm, attention, duality, framework]
sources:
- dao-transformers-are-ssms-2024
---
# 结构化状态空间对偶 (SSD)
SSD 是 Dao & Gu (2024) 提出的统一框架,揭示 **SSM 和 Attention 本质上是同一类模型的对偶形式**,通过 [[semiseparable-matrices|半可分矩阵]] 这一数学桥梁连接。
## 框架结构
```
SSM (线性/循环) ←→ 半可分矩阵 ←→ Attention (二次/并行)
↑ 线性时间 ↑ 二次时间
↑ 常状态推理 ↑ 矩阵乘法优化
```
## 核心等价关系
1. **矩阵变换视角**SSM 算子 `SSM(A, B, C)` 等价于矩阵乘法 `Y = M_X * X`
2. **张量收缩视角**:从张量收缩的双线性形式导出 SSM ↔ Attention 的对偶
3. **半可分矩阵**M 属于经典的半可分矩阵家族——用 O(T) 参数表示、O(T) 矩阵乘法
## SSD 层的双重形式
### 循环(线性)形式
- 选择性 SSM 的简化A 从对角矩阵退化为**标量乘单位矩阵**
- Head 维度 P 从 1 增大到 64/128类似 Transformer head
- 牺牲少许表达力换取显著的训练效率
### 对偶(二次)形式
```
Y = (L ○ QK^T) · V
```
- L_ij = a_i × ... × a_{j+1}a_i ∈ [0,1] 输入依赖
- 与 Softmax Attention 的区别:① 去掉 softmax② 增加数据依赖的位置掩码 L
## 意义
SSD 使 SSM 能利用为 Transformer 开发的硬件优化矩阵乘法单元、Tensor Parallelism、FlashAttention 式 block 算法),同时保持线性推理的优势。
## 参考
- [[mamba-2|Mamba-2]]
- [[semiseparable-matrices|半可分矩阵]]
- [[ssd-algorithm|SSD 算法]]
- [[dao-transformers-are-ssms-2024|论文]]