Files
myWiki/concepts/causal-multimodal-vae.md

63 lines
2.3 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: "Causal Multimodal VAE"
created: 2026-06-25
updated: 2026-06-25
type: concept
tags: [vae, causal, multimodal, streaming, audio, video, latent-coding]
sources:
- "[[wan-streamer]]"
---
# Causal Multimodal VAE
**Causal Multimodal VAE**(因果多模态变分自编码器)是 Wan-Streamer 中用于流式多模态潜编码的核心组件,包含严格因果的音频 VAE 和视频 VAE。
## 为什么需要因果 VAE
标准 VAE如用于 Stable Diffusion 的图像 VAE通常是**非因果的**——编码一帧时需要访问未来帧的上下文(通过卷积或双向注意力)。这在离线场景下可行,但在流式场景下会引入额外的延迟(等待未来帧到达)。
**因果 VAE** 的核心约束:
- 编码时刻 t 的帧时,只能使用 ≤t 时刻的信息
- 解码时刻 t 的潜变量时,同样只能使用 ≤t 时刻的上下文
这确保了每个流式单元到达后**立即可用**,无需等待窗口填充。
## 在 Wan-Streamer 中的设计
Wan-Streamer 的全因果架构要求从底层到顶层都是因果的:
```
流式视频帧序列 → 因果视频编码器 → 视频潜变量
流式音频帧序列 → 因果音频编码器 → 音频潜变量
[block-causal Transformer]
因果音频解码器 → 流式音频输出
因果视频解码器 → 流式视频输出
```
### 因果视频 VAE
- 使用因果卷积和/或因果注意力替代标准 VAE 中的非因果操作
- 支持 25 FPS 的流式编码
- 每个 160ms 单元独立可编码
### 因果音频 VAE
- 类似设计,支持流式音频的因果编码
- 与视频 VAE 的潜空间通过 block-causal Transformer 进行跨模态交互
## 与标准 VAE 的对比
| 维度 | 标准 VAE | 因果 VAE |
|------|---------|---------|
| 编码方向 | 双向(访问过去+未来) | 单向(仅访问过去) |
| 延迟 | 需要等待窗口完成 | 逐帧即时编码 |
| 适用场景 | 离线生成/重建 | 实时流式交互 |
| 重建质量 | 略高(更多上下文) | 可接受(因果约束) |
## 参考
- [[wan-streamer]]
- [[block-causal-attention]]
- [[end-to-end-streaming-interaction]]