20260514:增加新内容

This commit is contained in:
2026-05-14 13:54:52 +08:00
parent 56c4d3ef7c
commit b116710e4c
294 changed files with 10682 additions and 255 deletions

63
concepts/flow-matching.md Normal file
View File

@@ -0,0 +1,63 @@
---
title: "Flow Matching"
created: 2026-05-13
updated: 2026-05-13
type: concept
tags: [generative-modeling, diffusion, continuous-time, ODE]
sources:
- https://arxiv.org/abs/2210.02747
---
# Flow Matching
Flow Matching 是一种连续时间生成建模框架通过学习速度场velocity field来定义从噪声到数据的连续变换路径。
## 核心公式
给定数据分布 p_data(x) 和噪声分布 p_noise(ε)(通常 ε ~ N(0,I)),定义**线性插值路径**[[rectified-flows]]
```
z_t = t·x + (1-t)·ε, t ∈ [0,1]
```
速度场定义为 z_t 对时间的导数:
```
v = dz/dt = x - ε
```
训练目标是最小化预测速度与真实速度的 MSE
```
L_MSE = E_{t,x,ε} ||v_θ(z_t, t) - v||²
```
## x-prediction vs v-prediction
由于 v = (x - z_t)/(1-t),网络可以直接预测 x[[x-prediction-parameterization]])而非 v
```
x_θ = net_θ(z_t, t)
v_θ = (x_θ - z_t) / (1-t)
```
x-prediction 在 [[embedded-language-flows|ELF]] 中至关重要:它与解码任务(预测干净离散 token的语义一致使得共享权重设计可行。
## 推理
通过求解 ODE `dz_t/dt = v_θ(z_t, t)` 从 z_0 ~ N(0,I) 逐步推进到 z_1 ≈ x。可使用欧拉求解器或更高级的数值方法。
## 与其他框架的关系
- **DDPM**:离散时间步,高斯前向过程 + 去噪后向过程
- **Score-based models**:通过 score function ∇log p_t(z) 参数化Flow Matching 可统一在此框架下
- **Rectified Flows**Flow Matching 的特例,使用直线插值路径
## 在语言建模中的应用
[[embedded-language-flows|ELF]] 将 Flow Matching 应用于语言生成:离散 token → T5 编码 → 连续嵌入空间 → Flow Matching 去噪 → 最后一步解码回 token。
## 参考
- Lipman et al., "Flow Matching for Generative Modeling", ICLR 2023
- Albergo & Vanden-Eijnden, "Stochastic Interpolants", JMLR 2025