<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Diffusion/Flow - 标签 - mywebsite</title><link>https://steven-yl.github.io/mywebsite/tags/diffusion/flow/</link><description>Diffusion/Flow - 标签 - mywebsite</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>steven@gmail.com (Steven)</managingEditor><webMaster>steven@gmail.com (Steven)</webMaster><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Fri, 27 Mar 2026 10:00:00 +0800</lastBuildDate><atom:link href="https://steven-yl.github.io/mywebsite/tags/diffusion/flow/" rel="self" type="application/rss+xml"/><item><title>Analytic Diffusion Studio — 技术文档索引</title><link>https://steven-yl.github.io/mywebsite/00-index/</link><pubDate>Fri, 27 Mar 2026 10:00:00 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/00-index/</guid><description>Analytic Diffusion Studio — 技术文档索引</description></item><item><title>Analytic Diffusion Studio — 项目总览</title><link>https://steven-yl.github.io/mywebsite/01-overview/</link><pubDate>Fri, 27 Mar 2026 10:00:00 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/01-overview/</guid><description>Analytic Diffusion Studio — 项目总览</description></item><item><title>smalldiffusion 技术文档索引</title><link>https://steven-yl.github.io/mywebsite/00_index/</link><pubDate>Fri, 27 Mar 2026 10:00:00 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/00_index/</guid><description><![CDATA[<blockquote>
  <p>smalldiffusion 是一个轻量级扩散模型库，用不到 100 行核心代码实现了扩散模型的训练与采样。
本文档对项目进行全面技术解读，从整体架构到每个函数的实现细节。</p>

</blockquote><h2 id="文档结构" class="headerLink">
    <a href="#%e6%96%87%e6%a1%a3%e7%bb%93%e6%9e%84" class="header-mark"></a>文档结构</h2><table>
  <thead>
      <tr>
          <th>文件</th>
          <th>内容</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><a href="01_overview.md" rel="">01_overview.md</a></td>
          <td>项目总览：架构设计、模块关系、扩散模型数学基础</td>
      </tr>
      <tr>
          <td><a href="02_diffusion.md" rel="">02_diffusion.md</a></td>
          <td>核心模块：噪声调度、训练循环、采样算法 (<code>diffusion.py</code>)</td>
      </tr>
      <tr>
          <td><a href="03_data.md" rel="">03_data.md</a></td>
          <td>数据模块：数据集工具、玩具数据集 (<code>data.py</code>)</td>
      </tr>
      <tr>
          <td><a href="04_model_base.md" rel="">04_model_base.md</a></td>
          <td>模型基础：ModelMixin、预测模式修饰器、注意力机制、嵌入层 (<code>model.py</code>)</td>
      </tr>
      <tr>
          <td><a href="05_model_dit.md" rel="">05_model_dit.md</a></td>
          <td>Diffusion Transformer 模型 (<code>model_dit.py</code>)</td>
      </tr>
      <tr>
          <td><a href="06_model_unet.md" rel="">06_model_unet.md</a></td>
          <td>U-Net 模型 (<code>model_unet.py</code>)</td>
      </tr>
      <tr>
          <td><a href="07_examples.md" rel="">07_examples.md</a></td>
          <td>实战示例：从玩具模型到 Stable Diffusion</td>
      </tr>
  </tbody>
</table>
<h2 id="模块依赖关系" class="headerLink">
    <a href="#%e6%a8%a1%e5%9d%97%e4%be%9d%e8%b5%96%e5%85%b3%e7%b3%bb" class="header-mark"></a>模块依赖关系</h2><div class="code-block highlight is-open show-line-numbers  tw-group tw-my-2">
  <div class="
    
    tw-flex 
    tw-flex-row
    tw-flex-1 
    tw-justify-between 
    tw-w-full tw-bg-bgColor-secondary
    ">      
    <button 
      class="
        code-block-button
        tw-mx-2 
        tw-flex
        tw-flex-row
        tw-flex-1"
      aria-hidden="true">
          <div class="group-[.is-open]:tw-rotate-90 tw-transition-[transform] tw-duration-500 tw-ease-in-out print:!tw-hidden tw-w-min tw-h-min tw-my-1 tw-mx-1"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg></div>
          <p class="tw-select-none !tw-my-1">text</p>]]></description></item><item><title>smalldiffusion 项目总览</title><link>https://steven-yl.github.io/mywebsite/01_overview/</link><pubDate>Fri, 27 Mar 2026 10:00:00 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/01_overview/</guid><description><![CDATA[<h2 id="11-项目定位" class="headerLink">
    <a href="#11-%e9%a1%b9%e7%9b%ae%e5%ae%9a%e4%bd%8d" class="header-mark"></a>1.1 项目定位</h2><p>smalldiffusion 是一个教学与实验导向的扩散模型库，核心训练和采样代码不到 100 行。它的设计目标是：</p>
<ul>
<li>提供可读、可理解的扩散模型实现</li>
<li>支持从 2D 玩具数据到 Stable Diffusion 级别的预训练模型</li>
<li>方便研究者快速实验新的采样算法和模型架构</li>
</ul>
<p>论文参考：<a href="https://arxiv.org/abs/2306.04848" target="_blank" rel="noopener noreferrer">Permenter and Yuan, arXiv:2306.04848</a></p>]]></description></item><item><title>Flow Matching Guide and Code: Discrete Flow Matching</title><link>https://steven-yl.github.io/mywebsite/flow-matching-guide-and-code-discrete-flow-matching/</link><pubDate>Thu, 05 Mar 2026 00:00:00 +0000</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/flow-matching-guide-and-code-discrete-flow-matching/</guid><description><![CDATA[<p>我们来详细整理并解释这段关于连续时间马尔可夫链（CTMC）的内容，使其更易于理解。</p>
<hr>
<h2 id="6-连续时间马尔可夫链模型" class="headerLink">
    <a href="#6-%e8%bf%9e%e7%bb%ad%e6%97%b6%e9%97%b4%e9%a9%ac%e5%b0%94%e5%8f%af%e5%a4%ab%e9%93%be%e6%a8%a1%e5%9e%8b" class="header-mark"></a>6. 连续时间马尔可夫链模型</h2><h3 id="核心思想ctmc-是什么" class="headerLink">
    <a href="#%e6%a0%b8%e5%bf%83%e6%80%9d%e6%83%b3ctmc-%e6%98%af%e4%bb%80%e4%b9%88" class="header-mark"></a>核心思想：CTMC 是什么？</h3><p>CTMC 是一种用于生成<strong>离散数据</strong>（比如文本、类别数据）的模型。你可以把它想象成一个在有限个离散状态之间随时间跳转的“粒子”，它按照一定的“速率”从一个状态跳到另一个状态。这与之前讨论的“流模型”（用于连续数据，如图像）形成对比，CTMC 是后续“离散流匹配”模型的基础。</p>]]></description></item><item><title>Flow Matching Guide and Code(项目解析)</title><link>https://steven-yl.github.io/mywebsite/flow-matching-guide-and-code%E9%A1%B9%E7%9B%AE%E8%A7%A3%E6%9E%90/</link><pubDate>Sat, 28 Feb 2026 19:37:39 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/flow-matching-guide-and-code%E9%A1%B9%E7%9B%AE%E8%A7%A3%E6%9E%90/</guid><description>&lt;div class="featured-image">
                &lt;img src="/mywebsite/posts/images/flow-matching-guide-and-code-%e9%a1%b9%e7%9b%ae%e8%a7%a3%e6%9e%90.webp" referrerpolicy="no-referrer">
            &lt;/div>Meta flow_matching 库与论文《Flow Matching Guide and Code》(arXiv:2412.06264) 的技术解析：项目结构、三种范式（连续/离散/黎曼 Flow Matching）、概率路径与调度器、损失与求解器、流形与测地线实现，以及 2D/图像/文本示例、训练后调度器变换与 log 似然计算等使用指南。</description></item><item><title>An Introduction to Flow Matching and Diffusion Models</title><link>https://steven-yl.github.io/mywebsite/an-introduction-to-flow-matching-and-diffusion-models/</link><pubDate>Sat, 28 Feb 2026 10:26:59 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/an-introduction-to-flow-matching-and-diffusion-models/</guid><description>&lt;div class="featured-image">
                &lt;img src="/mywebsite/posts/images/an-introduction-to-flow-matching-and-diffusion-models.webp" referrerpolicy="no-referrer">
            &lt;/div>《An Introduction to Flow Matching and Diffusion Models》全文技术解读：从生成即采样与 ODE/SDE 基础出发，系统介绍流模型与扩散模型、连续性方程与福克-普朗克方程、流匹配与得分匹配训练目标及其与 DDPM 的对应，并涵盖条件生成、无分类器引导（CFG）与 U-Net/DiT 等架构。</description></item><item><title>Flow Matching Guide and Code</title><link>https://steven-yl.github.io/mywebsite/flow-matching-guide-and-code/</link><pubDate>Sat, 28 Feb 2026 10:26:59 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/flow-matching-guide-and-code/</guid><description>&lt;div class="featured-image">
                &lt;img src="/mywebsite/posts/images/flow-matching-guide-and-code.webp" referrerpolicy="no-referrer">
            &lt;/div>《Flow Matching Guide and Code》全文技术解读：从流模型数学基础与欧氏空间 FM（概率路径、速度场、条件流匹配、线性/仿射条件流），到黎曼流形、离散 FM 与 Generator Matching 统一框架，并阐明与扩散模型、去噪分数匹配的关系。</description></item><item><title>The Principles of Diffusion Models</title><link>https://steven-yl.github.io/mywebsite/the-principles-of-diffusion-models/</link><pubDate>Sat, 28 Feb 2026 10:26:59 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/the-principles-of-diffusion-models/</guid><description>&lt;div class="featured-image">
                &lt;img src="/mywebsite/posts/images/the-principles-of-diffusion-models.webp" referrerpolicy="no-referrer">
            &lt;/div>《The Principles of Diffusion Models》（arXiv:2510.21890）全文技术解读：从前向破坏过程与反向生成出发，系统梳理扩散模型的三种表述——变分视角（VAE→DDPM）、基于分数的视角（EBM→NCSN→分数 SDE）、基于流的视角（NF→流匹配），阐明条件化技巧与福克–普朗克方程下的统一；并涵盖引导生成、数值求解器、蒸馏与从零学习的流映射模型（CM/CTM/MF）等。</description></item><item><title>Analytic Diffusion Studio — 扩散模型理论基础</title><link>https://steven-yl.github.io/mywebsite/02-diffusion-theory/</link><pubDate>Fri, 27 Mar 2026 10:00:00 +0800</pubDate><author><name>Steven</name><uri>https://github.com/steven-yl</uri></author><guid>https://steven-yl.github.io/mywebsite/02-diffusion-theory/</guid><description>Analytic Diffusion Studio — 扩散模型理论基础</description></item></channel></rss>