M6-075M6: Multimodal & Generative ModelsFlow Matching & Rectified FlowHard
⚡Flashcard Drill➔Mastery:
Unified Framework of Continuous Diffusion SDEs, Probability Flow ODEs, and Flow Matching
📐 Mathematical Definition
⚡ One-Sentence Core Answer
Continuous diffusion SDEs, deterministic Probability Flow ODEs, and Flow Matching form a unified mathematical continuum of continuous-time generative transport, differing only in trajectory curvature and stochastic noise injection.
📌 Key Takeaways
- •The unifying differential equation: all three paradigms transport a prior noise distribution to the data distribution via continuous vector fields governed by the Fokker-Planck continuity equation
- •Stochastic vs deterministic duality: SDEs inject continuous Brownian perturbations during reverse sampling, while ODEs and Flow Matching follow deterministic paths with identical marginals
- •Trajectory geometry evolution: progresses from curved stochastic trajectories (DDPM SDE) to curved deterministic trajectories (DDIM / Probability Flow ODE) to straight optimal transport trajectories (Flow Matching)
📐 Mathematical Derivations
Mathematical Mechanism: 1. The Master SDE Formulation (Song et al., 2021): Forward transport: Generative reverse transport: 2. The Generalized Probability Flow ODE Family: Parameterize sampling via stochasticity parameter : (a) Standard Reverse SDE (DDPM). (b) Deterministic Probability Flow ODE (DDIM): 3. The Flow Matching Generalization: Flow Matching replaces the diffusion drift and score terms with a direct velocity vector field : Under linear displacement interpolation : Transforming curved Brownian diffusion paths into straight-line optimal transport flows. 4. Paradigm Comparison Matrix: \begin{array}{l|c|c|c} \textbf{Feature} & \textbf{Diffusion SDE (DDPM)} & \textbf{Probability Flow ODE (DDIM)} & \textbf{Flow Matching (SD3/Flux)} \\ \hline \text{Trajectory Type} & \text{Stochastic / Curved} & \text{Deterministic / Curved} & \textbf{Deterministic / Straight} \\ \text{Target Variable} & \text{Noise } \epsilon_\theta \text{ or Score } s_\theta & \text{Noise } \epsilon_\theta & \textbf{Velocity } v_\theta = x_1 - x_0 \\ \text{Optimal Solvers} & \text{Ancestral SDE (Euler-a)} & \text{Semi-linear ODE (DPM-Solver)} & \textbf{Standard Euler / Midpoint} \\ \text{Exact Likelihood} & \text{Intractable (variational bound)} & \textbf{Exact (change of variables)} & \textbf{Exact (change of variables)} \\ \text{Inversion Ability} & \text{No (stochastic noise)} & \textbf{Yes (deterministic ODE)} & \textbf{Yes (deterministic ODE)} \end{array}
🏭 Production Trade-offs
Deep Dive & Engineering Trade-offs: ① The Trajectory Curvature Continuum: The fundamental evolutionary progression in generative modeling has been straightening the transport path. DDPM's path is highly curved and noisy, requiring 1,000 steps. DDIM straightens the path into a deterministic curve, reducing steps to 50. Flow Matching straightens the trajectory into Euclidean lines, enabling sampling in 15-20 steps. Reflow straightens paths further, enabling 1-2 step generation. ② Likelihood Computation and Inversion: Both Probability Flow ODEs and Flow Matching allow exact continuous log-likelihood computation via the instantaneous change-of-variables formula: , where the Jacobian trace is computed using the Hutchinson estimator. ③ Stochastic Self-Correction vs Speed: Stochastic SDEs retain an advantage in noisy, imperfect models: injecting Gaussian noise acts as a Langevin MCMC stabilizer that knocks drifting samples back into high-probability manifolds. Deterministic ODEs and Flow Matching lack this noise cushion; model approximation errors accumulate monotonically along the trajectory. ⑤ Interview Strategy: Write the master SDE equation with parameter , show how gives DDPM and gives the Probability Flow ODE, show how Flow Matching sets with straight velocity , and articulate the historical trajectory straightening progression.
⚠️ Common Interview Pitfalls
- ✕Viewing diffusion models and flow matching as competing mutually exclusive paradigms rather than continuous-time siblings
- ✕Assuming stochastic SDEs have no advantages; SDE noise injection provides valuable trajectory error-correction in low-capacity models
- ✕Forgetting that Probability Flow ODEs and Flow Matching both support exact data log-likelihood computation via Jacobian trace integration
🎯 Interviewer Follow-up Inquiries
- ?How does the stochasticity parameter continuously interpolate between the deterministic Probability Flow ODE and the stochastic reverse SDE?
- ?What mathematical progression connects DDPM's 1000-step diffusion to Flow Matching's 20-step straight transport?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
📚
Associated Knowledge Base Guides & Mindmaps
Explore the comprehensive technical article, exam cards, and global architecture tree.
中文速览与面试要点
解释 Flow Matching 与 Diffusion 的统一视角。
两者都是'学一个把噪声输运到数据的场':扩散用加噪路径 + score,FM 用任意路径 + 速度场;可互相转换。
核心要点
- 数学机理: 统一框架 ——(1) 共同的数学结构 ——两者都定义'把噪声分布输运到数据分布'的过程,可用 ODE (确定性)或 SDE (随机)描述:dx=v(x,t)dt(ODE)或 dx=f(x,t)dt+g(t)dW(SDE);生成即'从噪声积分到数据'。(2) 两个场的对应 ——(a) 扩散 学 score ∇log p_t(x)(通过 ε/v/x_0-prediction);(b) FM 学 速度场 v(x,t);(c) 关系 :v=f(x,t)−½g²(t)·∇log p_t(来自 SDE/ODE 的转换),即'速度 = 漂移 − ½扩散系数² × score'。(3) 路径的差异 ——(a) 扩散 的路径由'加噪调度'决定(x_t=√ᾱ_t x_0+√(1−ᾱ_t)ε)—— 弯曲 (非直线);(b) FM 可定义 任意路径 (含直线、OT 路径)——故可优化'路径直度'(→ 少步)。(4) 目标参数化的差异 ——(a) 扩散需选 ε/v/x_0-prediction(因为不同 SNR 区间难度不同);(b) FM 的直线路径目标是常数(x_1−x_0)—— 更简单 。(5) 训练损失的等价性 ——对同一路径,'score matching 损失'与'FM 损失' 等价 (因为两个场有线性关系);故两者的'训练'本质相同。 统一视角的实用价值 ——(a) 理论统一 ——不必区分'扩散派'与'FM 派'(它们是同一框架的特例);(b) 技术迁移 ——采样器(SDE/ODE 求解器)、引导(CFG)、参数化、量化都可在两者间迁移;(c) 路径设计空间 ——统一视角下,'选路径'成为明确的设计维度(直线/OT/扩散/VP/VE);(d) 模型互转 ——可从扩散模型转 FM(或反之),便于复用预训练权重。 为什么现代模型倾向 FM ——(a) 训练目标更简单 (常数目标、无参数化难题);(b) 路径可设计 (直线/OT → 少步采样);(c) 与扩散等价 (无功能损失);(d) 实证 ——SD3、Flux、以及多数新模型用 FM(rectified flow)。 更一般的框架 ——(a) 随机插值(Stochastic Interpolants) ——用'插值 + 噪声'统一描述(包含扩散与 FM);(b) 基于流的生成模型(Flow-based) ——连续归一化流(CNF)的一般理论。 实践建议 ——(a) 新项目 → FM(rectified flow,训练简单 + 少步友好);(b) 复用已有扩散模型 → 用扩散路径的 FM(等价);(c) 理解理论 → 用统一视角(SDE/ODE + 场)。 度量 ——(a) 步数 vs 质量;(b) 训练稳定性;(c) 与已有生态的兼容性。
- 深度剖析与工程权衡:① '两者是同一框架的特例'是核心认知 ——面试中能给出 v=f−½g²∇log p 的关系式并说明'差异在路径与参数化'是深度理解的标志。② '技术可迁移'是统一视角的实用价值 ——采样器、引导、量化等都通用;这降低了'换框架'的成本。③ 'FM 训练更简单'是它流行的直接原因 ——常数目标、无参数化难题;这减少了调参负担。④ '路径可设计'是 FM 的独特优势 ——扩散的路径被'加噪调度'固定;FM 可选(直线/OT),从而优化少步采样。⑤ '等价性'避免'派系之争' ——不必争论'扩散 vs FM'(同一框架);应根据'路径设计与工程便利'选择。⑥ 面试要点 ——被问'FM 与扩散的关系',应给出' 统一为 ODE/SDE + 场(扩散学 score、FM 学速度)+ v=f−½g²∇log p 互相转换 + 差异在路径与参数化 '与' FM 训练更简单、路径可设计 ';能写出统一的关系式是深度理解的标志。
- 统一为'ODE/SDE + 场':扩散学 score、FM 学速度
- 两者通过 v=f−½g²∇log p 互相转换
- 差异在'路径选择'与'目标参数化',而非框架
常见陷阱
- 把 FM 与扩散当作互斥的两种方法
- 忽略'路径设计'是 FM 的独特优势