Fullscreen PDF ↗ Original Source ↗

Gat 等;arXiv:2407.15595v2(2024-11-05);NeurIPS 2024。

许可 CC BY 4.0:https://creativecommons.org/licenses/by/4.0/ 。本文件为完整逐段翻译;图表与代码按原 PDF 保留。

Discrete Flow Matching 离散流匹配

Abstract 摘要

SOURCE PDF p.1 · abstract1.1
EN
Despite Flow Matching and diffusion models having emerged as powerful generative paradigms for continuous variables such as images and videos, their application to high-dimensional discrete data, such as language, is still limited. In this work, we present Discrete Flow Matching, a novel discrete flow paradigm designed specifically for generating discrete data. Discrete Flow Matching offers several key contributions: (i) it works with a general family of probability paths interpolating between source and target distributions; (ii) it allows for a generic formula for sampling from these probability paths using learned posteriors such as the probability denoiser ( xx -prediction) and noise-prediction ( ϵ\epsilon -prediction); (iii) practically, focusing on specific probability paths defined with different schedulers improves generative perplexity compared to previous discrete diffusion and flow models; and (iv) by scaling Discrete Flow Matching models up to 1.7B parameters, we reach 6.7% Pass@1 and 13.4% Pass@10 on HumanEval and 6.7% Pass@1 and 20.6% Pass@10 on 1-shot MBPP coding benchmarks. Our approach is capable of generating high-quality discrete data in a non-autoregressive fashion, significantly closing the gap between autoregressive models and discrete flow models.
中
虽然流匹配与扩散模型已成为图像、视频等连续变量的强大生成范式,但在语言等高维离散数据上的应用仍然有限。本文提出离散流匹配(Discrete Flow Matching),一种专门生成离散数据的新离散流范式。主要贡献包括:(i)适用于连接源分布与目标分布的一般概率路径族;(ii)借助学得的概率去噪器(x 预测)、噪声预测器(ε 预测)等后验,提供沿这些路径采样的通用公式;(iii)在实践中,选用不同调度器定义的特定概率路径,相比已有离散扩散和流模型改善了生成困惑度;(iv)将模型扩展到 17 亿参数,在 HumanEval 上取得 6.7% Pass@1、13.4% Pass@10,在单样本提示的 MBPP 编程基准上取得 6.7% Pass@1、20.6% Pass@10。本方法以非自回归方式生成高质量离散数据,显著缩小了自回归模型与离散流模型之间的差距。

1 Introduction 1 引言

SOURCE PDF p.1 · S1.p1.1
EN
Despite the remarkable success of diffusion and flow models in generating continuous spatial signals such as images ( Ho et al., 2020 ; Rombach et al., 2022 ; Esser et al., 2024 ) and videos ( Singer et al., 2022 ; Blattmann et al., 2023 ) , their performance still falters when applied to discrete sequential data compared to autoregressive models. Recent progress in adapting diffusion and flow models to the discrete setting has been made via mostly two approaches: embedding the discrete data in continuous space and applying continuous diffusion ( Dieleman et al., 2022 ; Stark et al., 2024 ) or designing diffusion or flow processes over discrete state spaces ( Austin et al., 2021a ; Campbell et al., 2022 ) .
中
尽管扩散和流模型在生成图像(Ho 等,2020;Rombach 等,2022;Esser 等,2024)、视频(Singer 等,2022;Blattmann 等,2023)这类连续空间信号上取得了显著成功,但应用于离散序列数据时,其性能相对自回归模型仍显不足。近期将扩散和流推广到离散情形的进展主要来自两条路线:把离散数据嵌入连续空间再进行连续扩散(Dieleman 等,2022;Stark 等,2024),或直接在离散状态空间上设计扩散或流过程(Austin 等,2021a;Campbell 等,2022)。

SOURCE PDF p.1 · S1.p2.1
EN
In this paper, we pursue the discrete flow approach of Campbell et al. (2024) and introduce Discrete Flow Matching, a theoretical framework and algorithmic methodology for discrete flow models that yields a state-of-the-art discrete non-autoregressive generative approach. Surprisingly, Discrete Flow Matching exhibits similarities with the continuous Flow Matching ( Lipman et al., 2022 ) approach proposed for continuous signals. Notably, its generating probability velocity , employed in the sampling algorithm, is identical in form to its continuous counterpart. Additionally, Discrete Flow Matching offers the following advancements and simplifications over prior methods: It encompasses a more comprehensive family of probability paths transforming source (noise) distributions into target (data) distributions, accommodating arbitrary source-target couplings and time-dependent schedulers. Furthermore, it provides a unified formulation for the generating probability velocity directly expressed in terms of the learned posteriors and schedulers, along with a unified and general theory and algorithm for corrector sampling and iterations. In practice, we observe that path and corrector schedulers are pivotal, and their proper tuning leads to substantial improvements in generation quality. We have trained a 1.7B parameter Discrete Flow Matching model on the same data mix as in Llama-2 ( Touvron et al., 2023 ) and CodeLlama ( Roziere et al., 2023 ) , achieving 6.7% Pass@1 and 13.4% Pass@10 on HumanEval and 6.7% Pass@1 and 20.6% Pass@10 on 1-shot MBPP coding benchmarks; Figure 1 shows some code generation examples. In conditional text generation our model produces texts with a generative perplexity score of 9.7 as measured by the Llama-3 8B model, surpassing a 1.7B autoregressive model that achieves 22.3 and not far from the Llama-2 7B model that achieves 8.3 in generative perplexity score. We strongly believe that Discrete Flow Matching represents a significant step in bridging the performance gap between discrete diffusion and autoregressive models, and that further enhancements are possible by exploring the vast design space that Discrete Flow Matching has to offer.
中
本文沿用 Campbell 等(2024)的离散流路线,提出离散流匹配:它为离散流模型提供理论框架与算法方法,并得到当时先进的离散非自回归生成方法。令人意外的是,离散流匹配与为连续信号提出的连续流匹配(Lipman 等,2022)存在相似性,尤其是采样算法使用的生成概率速度与连续情形具有完全相同的形式。相较已有方法,本框架进一步扩展并简化了设计:用更全面的概率路径族把源(噪声)分布变为目标(数据)分布,容许任意源—目标耦合和随时间变化的调度器;给出以学得后验和调度器直接表示的统一生成概率速度公式,并统一校正采样与校正迭代的理论、算法。实践表明,路径调度器与校正调度器非常关键,恰当调节可明显改善生成质量。我们使用与 Llama-2(Touvron 等,2023)、CodeLlama(Roziere 等,2023)相同的混合数据训练了 17 亿参数模型,取得 HumanEval 的 6.7% Pass@1、13.4% Pass@10,以及单样本提示 MBPP 的 6.7% Pass@1、20.6% Pass@10;图 1 展示若干代码生成例子。条件文本生成中,以 Llama-3 8B 评估的生成困惑度为 9.7,优于一个 17 亿参数自回归模型的 22.3,并接近 Llama-2 7B 的 8.3。我们认为离散流匹配是缩小离散扩散与自回归模型性能差距的重要一步,进一步探索其广阔设计空间还可带来改进。

S1.F1

SOURCE PDF p.2,S1.F1

Figure 1 : Code generation examples using Discrete Flow Matching . Code condition is marked in gray , model generation is marked in yellow . Left sub-figure presents the standard left-to-right prompting; Middle and Right sub-figures, presents complex infilling setup. 图 1:离散流匹配的代码生成示例。灰色为给定代码条件,黄色为模型生成。左图为标准从左到右提示,中、右图为复杂代码填空。

2 Discrete Flow Matching 2 离散流匹配

2.1 Setup and notations 2.1 设置与记号

SOURCE PDF p.2 · S2.SS1.p1.1
EN
In discrete sequence modeling, we denote a sequence xx as an array of NN elements (x1,x2,…,xN)(x^{1},x^{2},\ldots,x^{N}) . Each element, or token , within this sequence is selected from a vocabulary of size dd . Consequently, the entire set of possible sequences is given by D=[d]N\mathcal{D}=[d]^{N} , where [d]={ 1,…,d }[d]=\set{1,\ldots,d} . A random variable taking values in the space D\mathcal{D} is denoted by XX and its corresponding probability mass function (PMF) is P(X=x)P(X=x) . For simplicity, throughout the paper, we sometimes omit the random variable XX and use p(x)p(x) to denote the PMF.
中
在离散序列建模中,序列 x 表示为含 N 个元素的数组 (x1,x2,…,xN)(x^1,x^2,\ldots,x^N)。每个元素或词元(token)从大小为 d 的词表中选取。因此所有可能序列构成 D=[d]N\mathcal D=[d]^N,其中 [d]={1,…,d}[d]=\{1,\ldots,d\}。取值于 D 的随机变量记为 X,其概率质量函数(PMF)为 P(X=x)。为简便,全文有时省略随机变量 X,直接用 p(x) 表示 PMF。

SOURCE PDF p.2 · S2.SS1.p2.1
EN
To describe marginalization properties, we denote p(xi)p(x^{i}) the xix^{i} marginal of pp , i.e. , p(xi)=∑xiˉp(x)p(x^{i})=\sum_{x^{\bar{i}}}p(x) , where xiˉ=(…,xi−1,xi+1,…)∈[d]N−1x^{\bar{i}}=(\ldots,x^{i-1},x^{i+1},\ldots)\in[d]^{N-1} are all the arguments excluding ii . Similarly, p(xiˉ)=∑xip(x)p(x^{\bar{i}})=\sum_{x^{i}}p(x) , and xi∈[d]x^{i}\in[d] . A useful PMF is the delta function, δy\delta_{y} , y∈\gDy\in\gD , which is defined by
中
为描述边缘化,记 p(xi)p(x^i) 为 p 关于第 i 个分量的边缘分布,即 p(xi)=∑xiˉp(x)p(x^i)=\sum_{x^{\bar i}}p(x);其中 xiˉ=(…,xi−1,xi+1,…)∈[d]N−1x^{\bar i}=(\ldots,x^{i-1},x^{i+1},\ldots)\in[d]^{N-1} 表示除 i 外的全部分量。同样,p(xiˉ)=∑xip(x)p(x^{\bar i})=\sum_{x^i}p(x),且 xi∈[d]x^i\in[d]。一个有用的 PMF 是 delta 函数 δy\delta_y(y∈Dy\in\mathcal D),定义如下。
δy(x)=∏i=1Nδyi(xi), where δyi(xi)={1xi=yi0xi≠yi.\delta_{y}(x)=\prod_{i=1}^{N}\delta_{y^{i}}(x^{i}),\text{ where }\delta_{y^{i}}(x^{i})=\begin{cases}1&x^{i}=y^{i}\\ 0&x^{i}\neq y^{i}\end{cases}.

SOURCE PDF p.2 · S2.SS1.p2.2
EN
With the marginal notation δy(xi)=δyi(xi)\delta_{y}(x^{i})=\delta_{y^{i}}(x^{i}) and δy(xiˉ)=δyiˉ(xiˉ)=∏j≠iδyj(xj)\delta_{y}(x^{\bar{i}})=\delta_{y^{\bar{i}}}(x^{\bar{i}})=\prod_{j\neq i}\delta_{y^{j}}(x^{j}) which simplifies notation.
中
使用边缘记号,δy(xi)=δyi(xi)\delta_y(x^i)=\delta_{y^i}(x^i),以及 δy(xiˉ)=δyiˉ(xiˉ)=∏j≠iδyj(xj)\delta_y(x^{\bar i})=\delta_{y^{\bar i}}(x^{\bar i})=\prod_{j\ne i}\delta_{y^j}(x^j),可以简化书写。

2.2 Source and target distributions 2.2 源分布与目标分布

SOURCE PDF p.2 · S2.SS2.p1.1
EN
In discrete generative models our goal is to transform source samples X0∼pX_{0}\sim p to target samples X1∼qX_{1}\sim q . Our training data, consist of pairs X0X_{0} and X1X_{1} that are sampled from a joint distribution π(x,y)\pi(x,y) , satisfying the marginals constraints p(x)=∑y∈\gDπ(x,y),q(y)=∑x∈\gDπ(x,y)p(x)=\sum_{y\in\gD}\pi(x,y),q(y)=\sum_{x\in\gD}\pi(x,y) , i.e.,
中
离散生成模型旨在把源样本 X0∼pX_0\sim p 转换为目标样本 X1∼qX_1\sim q。训练数据是从联合分布 π(x,y)\pi(x,y) 采样的 X0,X1X_0,X_1 样本对,该分布满足边缘约束 p(x)=∑y∈Dπ(x,y)p(x)=\sum_{y\in\mathcal D}\pi(x,y)、q(y)=∑x∈Dπ(x,y)q(y)=\sum_{x\in\mathcal D}\pi(x,y),即下式。
(X0,X1)∼π(X0,X1).(X_{0},X_{1})\sim\pi(X_{0},X_{1}).

SOURCE PDF p.2 · S2.SS2.p1.2
EN
In the simplest case, the training pairs X0X_{0} and X1X_{1} are sampled independently from the source and target distributions respectively,
中
最简单的情形,是分别从源分布和目标分布独立抽取训练样本 X0,X1X_0,X_1。
(X0,X1)∼p(X0)q(X1).(X_{0},X_{1})\sim p(X_{0})q(X_{1}).

SOURCE PDF p.2 · S2.SS2.p1.3
EN
Example: source and couplings. Common instantiations of source distribution pp are: (i) adding a special token value often referred to as a ‘mask’ or ‘dummy’ token, denoted here by \dummy\dummy , and setting the source distribution to be all-mask sequences, i.e. , p(x)=δ\dummy(x)p(x)=\delta_{\dummy}(x) ; and (ii) using uniform distribution over \gD\gD , which is equivalent to drawing each xix^{i} independently to be some value in [d][d] with equal probability, denoted p(x)=pu(x)p(x)=p_{\tiny\text{u}}(x) . In this paper we focus mainly on (i). We further consider two choices of couplings π\pi : Independent coupling, which we call unconditional coupling (U-coupling), π(x0,x1)=p(x0)q(x1)\pi(x_{0},x_{1})=p(x_{0})q(x_{1}) . A random sample that realizes this choice have the form
中
例:源分布与耦合。常见源分布 p 有:(i)增加一个称为 mask 或 dummy 的特殊词元,此处记为 M(M 指原文 m\mathbb{m},即双线体小写 m 所表示的同一掩码词元),并把源分布设为全掩码序列,即 p(x)=δM(x)p(x)=\delta_M(x);(ii)在 D 上取均匀分布,相当于每个 xix^i 独立地等概率选取 [d] 中的一个值,记为 p(x)=pu(x)p(x)=p_{\mathrm u}(x)。本文主要研究(i)。进一步考察两类耦合 π:独立耦合称为无条件耦合(U-coupling),π(x0,x1)=p(x0)q(x1)\pi(x_0,x_1)=p(x_0)q(x_1)。实现这一耦合的随机样本具有下式形式。
(X0,X1)=((\dummy,…,\dummy),X1),(X_{0},X_{1})=\Big((\dummy,\ldots,\dummy),X_{1}\Big),

SOURCE PDF p.3 · S2.SS2.p1.4
EN
where X1∼q(X1)X_{1}\sim q(X_{1}) is a random sample from the training set. The second choice of coupling π(x0,x1)=p(x0∣x1)q(x1)\pi(x_{0},x_{1})=p(x_{0}|x_{1})q(x_{1}) , which we find improves conditional sampling, partially masks inputs with samples of the form
中
其中 X1∼q(X1)X_1\sim q(X_1) 是训练集中的随机样本。第二种耦合 π(x0,x1)=p(x0∣x1)q(x1)\pi(x_0,x_1)=p(x_0|x_1)q(x_1) 对输入进行部分掩码,样本如下;我们发现它能改善条件采样。
(X0,X1)=(\sI⊙X1+(\one−\sI)⊙(\dummy,…,\dummy),X1),(X_{0},X_{1})=(\sI\odot X_{1}+(\one-\sI)\odot(\dummy,\ldots,\dummy),X_{1}),

SOURCE PDF p.3 · S2.SS2.p1.5
EN
where X1∼q(X1)X_{1}\sim q(X_{1}) and \sI∈{ 0,1 }N\sI\in\set{0,1}^{N} is a random variable indicating the conditioning, ⊙\odot denotes the entry-wise product, and \one∈\RealN\one\in\Real^{N} is the vector of all ones. We call this conditional coupling (C-coupling).
中
其中 X1∼q(X1)X_1\sim q(X_1),I∈{0,1}NI\in\{0,1\}^N 是标识条件位置的随机变量,⊙ 表示逐元素乘积,1∈RN\mathbf1\in\mathbb R^N 是全一向量。此方式称为条件耦合(C-coupling)。

2.3 Probability paths 2.3 概率路径

SOURCE PDF p.3 · S2.SS3.p1.1
EN
We follow the Flow Matching approach ( Lipman et al., 2022 ; Liu et al., 2022 ; Albergo and Vanden-Eijnden, 2022 ) that uses a predefined probability path ptp_{t} interpolating pp and qq , i.e. ,
中
我们遵循流匹配方法(Lipman 等,2022;Liu 等,2022;Albergo 与 Vanden-Eijnden,2022),使用一条预定义的概率路径 ptp_t 在 p 与 q 之间插值,即满足下列端点条件。
p0=p and  p1=qp_{0}=p\quad\text{ and }\quad\ p_{1}=q

SOURCE PDF p.3 · S2.SS3.p1.2
EN
to train the generative model taking a source sample X0∼pX_{0}\sim p to a target sample X1∼qX_{1}\sim q . We use arbitrary coupling of source and target ( Pooladian et al., 2023 ; Tong et al., 2023 ) , π(x0,x1)\pi(x_{0},x_{1}) , and the symmetric Flow Matching path ( Albergo and Vanden-Eijnden, 2022 ) to define the marginal probability path,
中
由此训练把源样本 X0∼pX_0\sim p 变为目标样本 X1∼qX_1\sim q 的生成模型。我们采用任意源—目标耦合 π(x0,x1)\pi(x_0,x_1)(Pooladian 等,2023;Tong 等,2023),以及对称流匹配路径(Albergo 与 Vanden-Eijnden,2022),定义边缘概率路径如下。
pt(x)=∑x0,x1∈\gDpt(x∣x0,x1)π(x0,x1), where pt(x∣x0,x1)=∏i=1Npt(xi∣x0,x1),p_{t}(x)=\sum_{x_{0},x_{1}\in\gD}p_{t}(x|x_{0},x_{1})\pi(x_{0},x_{1}),\text{ where }p_{t}(x|x_{0},x_{1})=\prod_{i=1}^{N}p_{t}(x^{i}|x_{0},x_{1}),

SOURCE PDF p.3 · S2.SS3.p1.3
EN
and pt(xi∣x0,x1)p_{t}(x^{i}|x_{0},x_{1}) is a time-dependent probability on the space of tokens [d][d] conditioned on the pair x0,x1x_{0},x_{1} , and satisfying p0(xi∣x0,x1)=δx0(xi)p_{0}(x^{i}|x_{0},x_{1})=\delta_{x_{0}}(x^{i}) and p1(xi∣x0,x1)=δx1(xi)p_{1}(x^{i}|x_{0},x_{1})=\delta_{x_{1}}(x^{i}) . If the conditional path pt(xi∣x0,x1)p_{t}(x^{i}|x_{0},x_{1}) satisfies these boundary conditions then the marginal path pt(x)p_{t}(x) satisfies ( 6 ).
中
这里 pt(xi∣x0,x1)p_t(x^i|x_0,x_1) 是给定样本对 x0,x1x_0,x_1 后、词元空间 [d] 上随时间变化的概率,满足 p0(xi∣x0,x1)=δx0(xi)p_0(x^i|x_0,x_1)=\delta_{x_0}(x^i) 与 p1(xi∣x0,x1)=δx1(xi)p_1(x^i|x_0,x_1)=\delta_{x_1}(x^i)。若条件路径满足这些边界条件,则边缘路径 pₜ(x) 满足式(6)。

SOURCE PDF p.3 · S2.SS3.p2.1
EN
In developing the framework, we would like to consider as general as possible set of probability paths that are also tractable to learn within the Flow Matching framework. We consider conditional probability paths as a convex sum of mm conditional probabilities wj(xi∣x0,x1)w^{j}(x^{i}|x_{0},x_{1}) , i.e. ,
中
构建框架时,我们希望覆盖尽可能一般、同时又能在流匹配框架内切实学习的概率路径。考虑把条件概率路径写成 m 个条件概率 wj(xi∣x0,x1)w^j(x^i|x_0,x_1) 的凸组合,即下式。
pt(xi∣x0,x1)=∑j=1mκti,jwj(xi∣x0,x1),p_{t}(x^{i}|x_{0},x_{1})=\sum_{j=1}^{m}\kappa^{i,j}_{t}w^{j}(x^{i}|x_{0},x_{1}),

SOURCE PDF p.3 · S2.SS3.p2.2
EN
where ∑jκti,j=1\sum_{j}\kappa^{i,j}_{t}=1 and κti,j≥0\kappa^{i,j}_{t}\geq 0 are collectively called the scheduler . Note that the scheduler can be defined independently for each location in the sequence i∈[N]i\in[N] or uniformly for all tokens, κti,j=κtj\kappa^{i,j}_{t}=\kappa^{j}_{t} .
中
满足 ∑jκti,j=1\sum_j\kappa_t^{i,j}=1 与 κti,j≥0\kappa_t^{i,j}\ge0 的这组系数统称调度器。调度器既可对序列的每个位置 i∈[N]i\in[N] 独立定义,也可对全部词元统一设置为 κti,j=κtj\kappa_t^{i,j}=\kappa_t^j。

SOURCE PDF p.3 · S2.SS3.p3.1
EN
A simple yet useful instance of these conditional paths is reminiscent of the continuous Flow Matching paths formulated as convex interpolants,
中
下式是一个简单而有用的条件路径实例,它类似于连续流匹配中用凸插值构造的路径。
pt(xi∣x0,x1)=(1−κt)δx0(xi)+κtδx1(xi),\displaystyle p_{t}(x^{i}|x_{0},x_{1})=(1-\kappa_{t})\delta_{x_{0}}(x^{i})+\kappa_{t}\delta_{x_{1}}(x^{i}),

SOURCE PDF p.3 · S2.SS3.p3.2
EN
where the scheduler κt\kappa_{t} satisfies κ0=0\kappa_{0}=0 , κ1=1\kappa_{1}=1 , and monotonically increasing in tt . Another interesting instantiation of ( 8 ) is adding uniform noise with some probability depending on tt ,
中
调度器 κₜ 满足 κ₀=0、κ₁=1,且关于 t 单调递增。式(8)的另一个有趣实例,是以随时间变化的概率添加均匀噪声。
pt(xi∣x0,x1)=κt1δx1(xi)+κt2pu(xi)+κt3δx0(xi),p_{t}(x^{i}|x_{0},x_{1})=\kappa^{1}_{t}\delta_{x_{1}}(x^{i})+\kappa^{2}_{t}p_{\text{\tiny u}}(x^{i})+\kappa^{3}_{t}\delta_{x_{0}}(x^{i}),

SOURCE PDF p.3 · S2.SS3.p3.3
EN
where κ01=0\kappa^{1}_{0}=0 , κ11=1\kappa^{1}_{1}=1 , κ02=κ12=0\kappa^{2}_{0}=\kappa^{2}_{1}=0 (remembering that ∑jκti,j=1\sum_{j}\kappa_{t}^{i,j}=1 and κti,j≥0\kappa^{i,j}_{t}\geq 0 ).
中
其中 κ01=0\kappa_0^1=0、κ11=1\kappa_1^1=1、κ02=κ12=0\kappa_0^2=\kappa_1^2=0;同时仍须满足 ∑jκti,j=1\sum_j\kappa_t^{i,j}=1、κti,j≥0\kappa_t^{i,j}\ge0。

S2.F2

SOURCE PDF p.4,S2.F2

Figure 2 : Discrete flow in D = [ d ] N with d = 4 , N = 2 (middle-left) versus continuous flow in R N , N = 2 (left). The rate of change of probability of a state (gray disk) is given by the divergence operator shown in the continuous case (middle right) and the discrete case (right). 图 2:D=[d]ᴺ 中 d=4、N=2 的离散流(中左)与 N=2 的连续流(左)。灰色圆盘状态的概率变化率由散度算子给出;中右、右分别为连续与离散散度。

2.4 Generating Probability Velocities 2.4 生成概率速度

SOURCE PDF p.4 · S2.SS4.p1.1
EN
Continuous generating velocity. Sampling in continuous Flow Matching is performed by updating the current (continuous) sample Xt∈\RealNX_{t}\in\Real^{N} , t∈[0,1)t\in[0,1) , according to a learned generating velocity field uti(Xt)u_{t}^{i}(X_{t}) , i∈[N]i\in[N] . Euler sampling follows the (deterministic) rule
中
连续生成速度。连续流匹配依据学得的生成速度场 uti(Xt)u_t^i(X_t)(i∈[N]i\in[N]),更新当前连续样本 Xt∈RNX_t\in\mathbb R^N,其中 t∈[0,1)t\in[0,1)。Euler 采样遵循下列确定性更新规则。
Xt+hi=Xti+huti(Xt),X_{t+h}^{i}=X_{t}^{i}+hu_{t}^{i}(X_{t}),

SOURCE PDF p.4 · S2.SS4.p1.2
EN
where h>0h>0 is a user-defined time step. Note that ( 11 ) is updating separately each of the sample coordinates, XtiX_{t}^{i} , i∈[N]i\in[N] , see e.g. , Figure 2 , left. The velocity uti(Xt)u_{t}^{i}(X_{t}) can be either directly modeled with a neural network, or parameterized via the denoiser (a.k.a. xx -prediction) or noise-prediction (a.k.a. \eps\eps -prediction), see left column in Table 1 . If, for all t∈[0,1)t\in[0,1) , starting at Xt∼ptX_{t}\sim p_{t} and sampling with ( 11 ) provides Xt+h∼pt+h+o(h)X_{t+h}\sim p_{t+h}+o(h) 1 1 1 The o(hℓ)o(h^{\ell}) notation means a function going to zero faster than hℓh^{\ell} as h\too0h\too 0 , i.e. , o(hℓ)hℓ⟶h\too00\frac{o(h^{\ell})}{h^{\ell}}\overset{h\too 0}{\longrightarrow}0 . then we say that utu_{t} generates ptp_{t} .
中
其中 h>0 是用户指定的时间步长。注意式(11)分别更新样本的每个坐标 XtiX_t^i,例如图 2 左图。速度 uti(Xt)u_t^i(X_t) 可以直接由神经网络建模,也可以通过去噪器(x 预测)或噪声预测器(ε 预测)参数化,见表 1 左列。如果对任意 t∈[0,1)t\in[0,1),从 Xt∼ptX_t\sim p_t 出发按式(11)采样所得 Xt+h∼pt+h+o(h)X_{t+h}\sim p_{t+h}+o(h),就称 uₜ 生成 pₜ。注 1:o(hℓ)o(h^\ell) 表示当 h→0 时比 hℓh^\ell 更快趋于零的函数,即 o(hℓ)/hℓ→0o(h^\ell)/h^\ell\to0。

Generating probability velocity. 生成概率速度

SOURCE PDF p.4 · S2.SS4.SSS0.Px1.p1.1
EN
For defining Flow Matching in the discrete setting, we follow Campbell et al. (2024) and consider a Continuous-Time discrete Markov Chain (CTMC) paradigm, namely the sample XtX_{t} is jumping between states in \gD\gD , depending on a continuous time value t∈[0,1]t\in[0,1] . Similar to the continuous Flow Matching setting described above, we focus on a model that predicts the rate of probability change of the current sample XtX_{t} in each of its NN tokens, see Figure 2 , middle-left. Then, each token of the sample Xt∼ptX_{t}\sim p_{t} is updated independently by
中
为在离散情形下定义流匹配,我们遵循 Campbell 等(2024),采用连续时间离散马尔可夫链(CTMC)范式:样本 Xₜ 随连续时间 t∈[0,1]t\in[0,1] 在 D 的状态之间跳跃。与上述连续流匹配相似,模型预测当前样本 Xₜ 各个词元的概率变化率,见图 2 中左图。随后对 Xt∼ptX_t\sim p_t 的每个词元独立更新如下。
Xt+hi∼δXti(⋅)+huti(⋅,Xt),X^{i}_{t+h}\sim\delta_{X^{i}_{t}}(\cdot)+hu_{t}^{i}(\cdot,X_{t}),

SOURCE PDF p.4 · S2.SS4.SSS0.Px1.p1.2
EN
where we call utu_{t} the probability velocity as reminiscent of the velocity field in continuous Flow Matching, and as in the continuous case, we define:
中
我们把 uₜ 称为概率速度,呼应连续流匹配中的速度场。类似连续情形,作如下定义。

Definition 1 . 定义 1

SOURCE PDF p.4 · S2.Thmtheorem1.p1.1
EN
Probability velocity utu_{t} generates the probability path ptp_{t} if, for all t∈[0,1)t\in[0,1) and given a sample Xt∼ptX_{t}\sim p_{t} , the sample Xt+hX_{t+h} defined in ( 12 ) satisfies Xt+h∼pt+h+o(h)X_{t+h}\sim p_{t+h}+o(h) .
中
若对所有 t∈[0,1)t\in[0,1) 及给定样本 Xt∼ptX_t\sim p_t,由式(12)定义的样本 Xt+hX_{t+h} 满足 Xt+h∼pt+h+o(h)X_{t+h}\sim p_{t+h}+o(h),则称概率速度 uₜ 生成概率路径 pₜ。

SOURCE PDF p.4 · S2.SS4.SSS0.Px1.p2.1
EN
Algorithm 1 formulates a basic sampling algorithm given a generating probability velocity utu_{t} . In order for the r.h.s. of ( 12 ) to define a proper PMF for sufficiently small h>0h>0 , it is necessary and sufficient that the probability velocity satisfies the conditions
中
算法 1 给出了使用生成概率速度 uₜ 的基本采样算法。要使式(12)右侧在足够小的 h>0 下定义有效 PMF,概率速度满足以下条件是必要且充分的。
∑xi∈[d]uti(xi,z)=0, and uti(xi,z)≥0 for all i∈[N] and xi≠zi.\sum_{x^{i}\in[d]}u_{t}^{i}(x^{i},z)=0,\text{ and }u_{t}^{i}(x^{i},z)\geq 0\text{ for all }i\in[N]\text{ and }x^{i}\neq z^{i}.

S2.SS4.SSS0.Px1.fig1

SOURCE PDF p.4,S2.SS4.SSS0.Px1.fig1

Algorithm 1 Flow Matching sampling. 算法 1:流匹配采样。输入速度 uₜ、初始样本 X∼p、步长 h=1/n;对 t=0,h,2h,…,1−h,逐词元独立按 δXi+h uₜⁱ(·,X) 抽样(式 24 或 22),循环结束返回 X。

SOURCE PDF p.4 · S2.SS4.SSS0.Px1.p3.1
EN
Now the main question is how to find a probability velocity utu_{t} that generates the probability path defined in equations 7 and 8 ? A key insight in Flow Matching ( Lipman et al., 2022 ) is that utu_{t} can be constructed as a marginalization of conditional probability velocities, uti(xi,z∣x0,x1)u_{t}^{i}(x^{i},z|x_{0},x_{1}) , generating the corresponding conditional probability paths pt(xi∣x0,x1)p_{t}(x^{i}|x_{0},x_{1}) . This can also be shown to hold in the discrete CTMC setting ( Campbell et al., 2024 ) , where a reformulation in our context and notation is as follows.
中
核心问题是:如何找到生成式(7)、(8)所定义概率路径的概率速度 uₜ?流匹配的关键洞见(Lipman 等,2022)在于,可以对条件概率速度 uti(xi,z∣x0,x1)u_t^i(x^i,z|x_0,x_1) 做边缘化来构造 uₜ;这些条件速度分别生成对应条件概率路径 pt(xi∣x0,x1)p_t(x^i|x_0,x_1)。该结论在离散 CTMC 情形也成立(Campbell 等,2024),用本文符号可表述如下。

Theorem 2 . 定理 2

SOURCE PDF p.5 · S2.Thmtheorem2.p1.1
EN
Given a conditional probability velocity uti(xi,z∣x0,x1)u_{t}^{i}(x^{i},z|x_{0},x_{1}) generating a conditional probability path pt(x∣x0,x1)p_{t}(x|x_{0},x_{1}) , the marginal velocity defined by
中
给定生成条件概率路径 pt(x∣x0,x1)p_t(x|x_0,x_1) 的条件概率速度 uti(xi,z∣x0,x1)u_t^i(x^i,z|x_0,x_1),按下式定义的边缘速度:
uti(xi,z)=∑x0,x1∈\gDuti(xi,z∣x0,x1)pt(x0,x1∣z)u_{t}^{i}(x^{i},z)=\sum_{x_{0},x_{1}\in\gD}u_{t}^{i}(x^{i},z|x_{0},x_{1})p_{t}(x_{0},x_{1}|z)

SOURCE PDF p.5 · S2.Thmtheorem2.p1.2
EN
generates the marginal probability path pt(x)p_{t}(x) , where by Bayes’ rule
中
生成边缘概率路径 pₜ(x),其中由 Bayes 公式得到下式。
pt(x0,x1∣z)=pt(z∣x0,x1)π(x0,x1)pt(z).p_{t}(x_{0},x_{1}|z)=\frac{p_{t}(z|x_{0},x_{1})\pi(x_{0},x_{1})}{p_{t}(z)}.

SOURCE PDF p.5 · S2.SS4.SSS0.Px1.p4.1
EN
For completeness we provide a simple proof of this theorem in Section E.2 . The proof, similar to the continuous Flow Matching case, shows that utu_{t} and ptp_{t} satisfy the (discrete version of the) Continuity Equation.
中
为使论述完整,附录 E.2 给出此定理的简短证明。与连续流匹配类似,证明表明 uₜ 和 pₜ 满足离散版本的连续性方程。

The Continuity Equation. 连续性方程

SOURCE PDF p.5 · S2.SS4.SSS0.Px2.p1.2
EN
To provide the mathematical tool for showing that a probability velocity utu_{t} does indeed generate the probability path ptp_{t} , and also to further highlight the similarities to the continuous case, we next formulate the Kolmogorov Equations , which describe the state probability rate p˙t(x)\dot{p}_{t}(x) , x∈\gDx\in\gD , in CTMC as a Continuity Equation (CE). The Continuity Equation, similarly to Kolmogorov Equations, describes p˙t(x)\dot{p}_{t}(x) , x∈\RealNx\in\Real^{N} in the continuous case , and is formulated as the Partial Differential Equation (PDE)
中
为提供检验概率速度 uₜ 是否确实生成概率路径 pₜ 的数学工具,并进一步揭示与连续情形的相似性,我们将描述 CTMC 中状态概率变化率 p˙t(x)\dot p_t(x)(x∈D)的 Kolmogorov 方程改写为连续性方程(CE)。连续情形中,连续性方程同样描述 p˙t(x)\dot p_t(x)(x∈RNx\in\mathbb R^N),其偏微分方程(PDE)形式如下。
p˙t(x)+\divvx(ptut)=0,\dot{p}_{t}(x)+\divv_{x}(p_{t}u_{t})=0,

SOURCE PDF p.5 · S2.SS4.SSS0.Px2.p1.3
EN
where the divergence operator \divvx(v)\divv_{x}(v) applied to a vector field v:\RealN\too\RealNv:\Real^{N}\too\Real^{N} is defined by
中
其中,对向量场 v:RN→RNv:\mathbb R^N\to\mathbb R^N 的散度算子定义如下。
\divvx(v)=∑i=1N∂xivi(x),\divv_{x}(v)=\sum_{i=1}^{N}\partial_{x^{i}}v^{i}(x),

SOURCE PDF p.5 · S2.SS4.SSS0.Px2.p1.4
EN
and intuitively means the total flux leaving xx , see Figure 2 (middle-right). This gives an intuitive explanation to the Continuity Equation: the rate of the probability p˙t(x)\dot{p}_{t}(x) of a state x∈\RealNx\in\Real^{N} equals the total incoming probability flux , ptutp_{t}u_{t} , at xx . In the discrete case (CTMC) the Continuity Equation (( 16 )) holds as is, once the discrete divergence operator is properly defined, i.e. , to measure the outgoing flux from a discrete state. In more detail, given some vector field, which in the discrete case is a scalar-valued function over pairs of states, v:\gD×\gD\too\Realv:\gD\times\gD\too\Real , the discrete divergence is
中
直观上,它表示离开 x 的总通量,见图 2 中右图。这给出了连续性方程的直观解释:状态 x 的概率变化率等于该处总流入概率通量 pₜuₜ。离散情形(CTMC)只要恰当定义离散散度、使它度量离开离散状态的通量,式(16)即可原样成立。具体而言,离散向量场是定义在状态对上的标量函数 v:D×D→Rv:\mathcal D\times\mathcal D\to\mathbb R,其离散散度为下式。
\divvx(v)=∑z∈\gD\bracv(z,x)−v(x,z),\divv_{x}(v)=\sum_{z\in\gD}\brac{v(z,x)-v(x,z)},

SOURCE PDF p.5 · S2.SS4.SSS0.Px2.p1.5
EN
where v(z,x)v(z,x) represents the flux x\toozx\too z and v(x,z)v(x,z) represent the opposite flux z\tooxz\too x ; see Figure 2 , right. Now, in our case (see Figure 2 , middle-left), the probability flux at a state x∈\gDx\in\gD involves all sequences with at most one token difference from xx , i.e. , the probability flux ptutp_{t}u_{t} at xx takes the form v(x,z)=pt(z)uti(xi,z)v(x,z)=p_{t}(z)u_{t}^{i}(x^{i},z) and v(z,x)=pt(x)uti(zi,x)v(z,x)=p_{t}(x)u_{t}^{i}(z^{i},x) for zz and xx that differ only in the ii -th token, v(x,x)=pt(x)∑i=1Nuti(xi,x)v(x,x)=p_{t}(x)\sum_{i=1}^{N}u_{t}^{i}(x^{i},x) , and v(x,z)=0v(x,z)=0 for all other (z,x)∈\gD×\gD(z,x)\in\gD\times\gD . A direct calculation now shows (see Section E.1 ):
中
这里 v(z,x) 表示 x→z 的通量,v(x,z) 表示反向 z→x 的通量,见图 2 右图。本文中(见图 2 中左),状态 x 处的概率通量仅涉及与 x 至多相差一个词元的序列。若 z 与 x 仅第 i 个词元不同,则 v(x,z)=pt(z)uti(xi,z)v(x,z)=p_t(z)u_t^i(x^i,z)、v(z,x)=pt(x)uti(zi,x)v(z,x)=p_t(x)u_t^i(z^i,x);自环通量为 v(x,x)=pt(x)∑iuti(xi,x)v(x,x)=p_t(x)\sum_i u_t^i(x^i,x);其余状态对的 v(x,z) 为零。直接计算得到下式,详见附录 E.1。
\divvx(ptut)=−∑z∈\gDpt(z)\brac∑i=1Nδz(xiˉ)uti(xi,z).\divv_{x}(p_{t}u_{t})=-\sum_{z\in\gD}p_{t}(z)\brac{\sum_{i=1}^{N}\delta_{z}(x^{\bar{i}})u_{t}^{i}(x^{i},z)}.

SOURCE PDF p.5 · S2.SS4.SSS0.Px2.p1.6
EN
Checking that a probability velocity utu_{t} generates a probability path ptp_{t} (in the sense of Definition 1 ) amounts to verifying the Continuity Equation (( 16 )). Indeed, using arguments from Campbell et al. (2024) and the discrete divergence operator, the PMF of Xt+hX_{t+h} defined by sampling according to ( 12 ) is
中
检验概率速度 uₜ 是否在定义 1 的意义下生成 pₜ,归结为验证连续性方程(16)。确实,采用 Campbell 等(2024)的论证与离散散度算子,按式(12)采样的 Xt+hX_{t+h} 的 PMF 如下。
\EXt∏i=1N\bracδXt(xi)+huti(xi,Xt)=\EXt\bracδXt(x)+h∑i=1NδXt(xiˉ)uti(xi,Xt)+o(h)=pt(x)−h\divvx(ptut)+o(h)=(16)pt(x)+hp˙t(x)+o(h)=pt+h(x)+o(h),\displaystyle\E_{X_{t}}\prod_{i=1}^{N}\brac{\delta_{X_{t}}(x^{i})+hu_{t}^{i}(x^{i},X_{t})}=\E_{X_{t}}\brac{\delta_{X_{t}}(x)+h\sum_{i=1}^{N}\delta_{X_{t}}(x^{\bar{i}})u^{i}_{t}(x^{i},X_{t})}+o(h) \qquad \displaystyle=p_{t}(x)-h\divv_{x}(p_{t}u_{t})+o(h){\color{#ff0000}\overset{(16)}{=}}p_{t}(x)+h\dot{p}_{t}(x)+o(h)=p_{t+h}(x)+o(h),

SOURCE PDF p.6 · S2.SS4.SSS0.Px2.p1.7
EN
where we assume Xt∼ptX_{t}\sim p_{t} , the first equality uses the identity ∏i\bracai+hbi=∏iai+h∑i(∏j≠iaj)bi+o(h)\prod_{i}\brac{a^{i}+hb^{i}}=\prod_{i}a^{i}+h\sum_{i}(\prod_{j\neq i}a^{j})b^{i}+o(h) , the second equality uses  ( 19 ), and the previous-to-last equality uses the Continuity Equation (( 16 )). This shows that if the Continuity Equation holds then utu_{t} generates ptp_{t} in the sense of Definition 1 .
中
这里假设 Xt∼ptX_t\sim p_t。第一个等号使用恒等式 ∏i(ai+hbi)=∏iai+h∑i(∏j≠iaj)bi+o(h)\prod_i(a^i+hb^i)=\prod_i a^i+h\sum_i(\prod_{j\ne i}a^j)b^i+o(h);第二个等号使用式(19);倒数第二个等号使用连续性方程(16)。由此,连续性方程成立就意味着 uₜ 在定义 1 的意义下生成 pₜ。

SOURCE PDF p.6 · S2.SS4.SSS0.Px2.p2.1
EN
Conditional and marginal generating velocities. We provide the probability velocities generating the conditional probability paths pt(x∣x0,x1)p_{t}(x|x_{0},x_{1}) defined in equations 7 and 8 . Then, using the marginalization formula in ( 14 ) we end up with a closed-form marginal velocity for the probability paths pt(x)p_{t}(x) . In Section E.3 we show
中
条件与边缘生成速度。我们先给出生成式(7)、(8)所定义条件概率路径 pt(x∣x0,x1)p_t(x|x_0,x_1) 的概率速度,再用式(14)的边缘化公式,得到生成边缘路径 pₜ(x) 的闭式边缘速度。附录 E.3 证明如下结论。

Theorem 3 (Probability velocity of conditional paths) . 定理 3(条件路径的概率速度)

SOURCE PDF p.6 · S2.Thmtheorem3.p1.1
EN
A generating probability velocity for the conditional paths pt(x∣x0,x1)p_{t}(x|x_{0},x_{1}) defined in equations 7 and 8 is
中
生成式(7)、(8)所定义条件概率路径 pt(x∣x0,x1)p_t(x|x_0,x_1) 的一个概率速度如下。
uti(xi,z∣x0,x1)=∑j=1mati,jwj(xi∣x0,x1)+btiδz(xi),u_{t}^{i}(x^{i},z|x_{0},x_{1})=\sum_{j=1}^{m}a_{t}^{i,j}w^{j}(x^{i}|x_{0},x_{1})+b_{t}^{i}\delta_{z}(x^{i}),

SOURCE PDF p.6 · S2.Thmtheorem3.p1.2
EN
with ati,j=κ˙ti,j−κti,jκ˙ti,ℓ/κti,ℓa_{t}^{i,j}=\dot{\kappa}_{t}^{i,j}-\kappa_{t}^{i,j}\dot{\kappa}_{t}^{i,\ell}/\kappa_{t}^{i,\ell} , and bti=κ˙ti,ℓ/κti,ℓb_{t}^{i}=\dot{\kappa}_{t}^{i,\ell}/\kappa_{t}^{i,\ell} where ℓ=arg min⁡j∈[m]\bracκ˙ti,j/κti,j\ell=\argmin_{j\in[m]}\brac{\dot{\kappa}_{t}^{i,j}/\kappa_{t}^{i,j}} .
中
其中 ati,j=κ˙ti,j−κti,jκ˙ti,ℓ/κti,ℓa_t^{i,j}=\dot\kappa_t^{i,j}-\kappa_t^{i,j}\dot\kappa_t^{i,\ell}/\kappa_t^{i,\ell},bti=κ˙ti,ℓ/κti,ℓb_t^i=\dot\kappa_t^{i,\ell}/\kappa_t^{i,\ell},且 ℓ=arg⁡min⁡j∈[m](κ˙ti,j/κti,j)\ell=\arg\min_{j\in[m]}(\dot\kappa_t^{i,j}/\kappa_t^{i,j})。

SOURCE PDF p.6 · S2.SS4.SSS0.Px2.p3.1
EN
Now, computing the marginal probability velocity using ( 14 ) applied to the conditional probability velocity in ( 21 ) gives
中
把式(14)作用于式(21)的条件概率速度,便得到下列边缘概率速度。
uti(xi,z)=∑j=1mati,jw^tj(xi,z)+bti,jδz(xi),u^{i}_{t}(x^{i},z)=\sum_{j=1}^{m}a^{i,j}_{t}\hat{w}^{j}_{t}(x^{i},z)+b^{i,j}_{t}\delta_{z}(x^{i}),

SOURCE PDF p.6 · S2.SS4.SSS0.Px2.p3.2
EN
where the posteriors w^tj\hat{w}^{j}_{t} of wjw^{j} (that are later shown to be tractable to learn) are defined by
中
其中 wjw^j 的后验 w^tj\hat w_t^j 定义如下;后文将证明这些后验可以切实学习。
w^tj(xi,z)=∑x0,x1∈\gDwj(xi∣x0,x1)pt(x0,x1∣z),\hat{w}_{t}^{j}(x^{i},z)=\sum_{x_{0},x_{1}\in\gD}w^{j}(x^{i}|x_{0},x_{1})p_{t}(x_{0},x_{1}|z),

SOURCE PDF p.6 · S2.SS4.SSS0.Px2.p3.3
EN
where pt(x0,x1∣z)p_{t}(x_{0},x_{1}|z) (defined in ( 15 )) is the posterior probability of x0,x1x_{0},x_{1} conditioned on the current state Xt=zX_{t}=z . A useful instantiation of the general velocity in ( 22 ) is when considering the path family in ( 9 ), for which w1(xi∣x0,x1)=δx1(xi)w^{1}(x^{i}|x_{0},x_{1})=\delta_{x_{1}}(x^{i}) , w2(xi∣x0,x1)=δx0(xi)w^{2}(x^{i}|x_{0},x_{1})=\delta_{x_{0}}(x^{i}) , κti,1=κt\kappa_{t}^{i,1}=\kappa_{t} , κti,2=1−κt\kappa_{t}^{i,2}=1-\kappa_{t} , κ˙t≥0\dot{\kappa}_{t}\geq 0 ( i.e. , monotonically non-decreasing in tt ) and in this case ( 22 ) reads as
中
其中式(15)定义的 pt(x0,x1∣z)p_t(x_0,x_1|z) 是给定当前状态 Xₜ=z 的端点后验。对于式(9)的路径族,一般速度式(22)有一个有用的特例:w1=δx1w^1=\delta_{x_1}、w2=δx0w^2=\delta_{x_0}、κti,1=κt\kappa_t^{i,1}=\kappa_t、κti,2=1−κt\kappa_t^{i,2}=1-\kappa_t,并且 κ˙t≥0\dot\kappa_t\ge0,即随 t 单调不减。此时式(22)化为下式。

SOURCE PDF p.6 · S2.SS4.SSS0.Px2.p3.4
EN
uti(xi,z)=κ˙t1−κt\bracp1∣t(xi∣z)−δz(xi)u^{i}_{t}(x^{i},z)=\frac{\dot{\kappa}_{t}}{1-\kappa_{t}}\brac{p_{1|t}(x^{i}|z)-\delta_{z}(x^{i})} (24)
中
式(24):概率速度等于调度危险率 κ˙t/(1−κt)\dot\kappa_t/(1-\kappa_t) 乘以概率去噪器与当前状态 delta 分布的差。原式如下保留。
uti(xi,z)=κ˙t1−κt\bracp1∣t(xi∣z)−δz(xi)u^{i}_{t}(x^{i},z)=\frac{\dot{\kappa}_{t}}{1-\kappa_{t}}\brac{p_{1|t}(x^{i}|z)-\delta_{z}(x^{i})}

SOURCE PDF p.6 · S2.SS4.SSS0.Px2.p3.5
EN
where we use the notation p1∣t(xi∣z)=∑x0,x1δx1(xi)pt(x0,x1∣z)p_{1|t}(x^{i}|z)=\sum_{x_{0},x_{1}}\delta_{x_{1}}(x^{i})p_{t}(x_{0},x_{1}|z) for the probability denoiser .
中
这里概率去噪器记为 p1∣t(xi∣z)=∑x0,x1δx1(xi)pt(x0,x1∣z)p_{1|t}(x^i|z)=\sum_{x_0,x_1}\delta_{x_1}(x^i)p_t(x_0,x_1|z)。

S2.T1

SOURCE PDF p.6,S2.T1

Table 1 : Generating (marginal) velocity fields have identical form for the continuous and discrete Flow Matching when using denoiser/noise-prediction parameterization; x ^ 1∣ t ​ ( z ) = E X 1 ​ ∼ p t ​ ( ⋅ ∣ z ) ​ X 1 ​ is the standard continuous denoiser (a.k.a. x -prediction) and x ^ 0∣ t ​ ( z ) = E X 0 ​ ∼ p t ​ ( ⋅ ∣ z ) ​ X 0 ​ is the standard noise-prediction (a.k.a. ϵ -prediction). 表 1:用去噪器或噪声预测器参数化时,连续与离散流匹配的生成(边缘)速度具有相同形式。蓝色 x̂₁|ₜ(z) 是标准连续去噪器 E[X₁|z](x 预测),红色 x̂₀|ₜ(z) 是标准噪声预测器 E[X₀|z](ε 预测)。

Sampling backward in time. 反向时间采样

SOURCE PDF p.6 · S2.SS4.SSS0.Px3.p1.1
EN
We can also sample backwards in time by following the sampling rule Xt−hi∼δXti(⋅)−huti(⋅,Xt)X_{t-h}^{i}\sim\delta_{X_{t}^{i}}(\cdot)-hu_{t}^{i}(\cdot,X_{t}) . In this case −uti(xi,z)-u_{t}^{i}(x^{i},z) should satisfy ( 13 ). A (backward-time) generating probability velocity can then be achieved from ( 22 ) with the simple change to the coefficients ati,ja^{i,j}_{t} and bti,jb^{i,j}_{t} , see Section E.4 . For ptp_{t} defined with ( 9 ) the generating velocity is
中
也可以按 Xt−hi∼δXti(⋅)−huti(⋅,Xt)X_{t-h}^i\sim\delta_{X_t^i}(\cdot)-h u_t^i(\cdot,X_t) 反向采样。此时 −uti(xi,z)-u_t^i(x^i,z) 应满足式(13)。仅需改变式(22)中的系数 ati,ja_t^{i,j}、bti,jb_t^{i,j},即可得到反向时间生成概率速度,详见附录 E.4。对于用式(9)定义的 pₜ,其生成速度如下。

SOURCE PDF p.6 · S2.SS4.SSS0.Px3.p1.2
EN
uti(xi,z)=κ˙tκt\bracδz(xi)−p0∣t(xi∣z),u^{i}_{t}(x^{i},z)=\frac{\dot{\kappa}_{t}}{\kappa_{t}}\brac{\delta_{z}(x^{i})-p_{0|t}(x^{i}|z)}, (25)
中
式(25):反向参数化使用 κ˙t/κt\dot\kappa_t/\kappa_t 乘以当前 delta 分布与概率噪声预测器的差。原式如下保留。
uti(xi,z)=κ˙tκt\bracδz(xi)−p0∣t(xi∣z),u^{i}_{t}(x^{i},z)=\frac{\dot{\kappa}_{t}}{\kappa_{t}}\brac{\delta_{z}(x^{i})-p_{0|t}(x^{i}|z)},

SOURCE PDF p.7 · S2.SS4.SSS0.Px3.p1.3
EN
where in this case p0∣t(xi∣z)=∑x0,x1∈\gDδx0(xi)pt(x0,x1∣z)p_{0|t}(x^{i}|z)=\sum_{x_{0},x_{1}\in\gD}\delta_{x_{0}}(x^{i})p_{t}(x_{0},x_{1}|z) is the probability noise-prediction .
中
这里 p0∣t(xi∣z)=∑x0,x1∈Dδx0(xi)pt(x0,x1∣z)p_{0|t}(x^i|z)=\sum_{x_0,x_1\in\mathcal D}\delta_{x_0}(x^i)p_t(x_0,x_1|z) 是概率噪声预测器。

SOURCE PDF p.7 · S2.SS4.SSS0.Px3.p2.1
EN
Remarkably, the generating velocity fields in 24 and 25 take the exact same form as the generating (a.k.a. marginal) velocity fields in continuous flow matching when parameterized via the denoiser or noise-prediction parameterizations and using the same schedulers, see Table 1 and Section E.9 for explanation of the continuous case. In Section E.4 we provide the backward-time version of Theorem 3 .
中
值得注意的是,式(24)、(25)与连续流匹配中用去噪器或噪声预测器参数化、且采用相同调度器时的生成(边缘)速度场具有完全相同的形式。连续情形的解释见表 1 与附录 E.9。附录 E.4 还给出了定理 3 的反向时间版本。

Corrector sampling. 校正采样

SOURCE PDF p.7 · S2.SS4.SSS0.Px4.p1.1
EN
Combining the forward-time u^t\hat{u}_{t} ( ( 24 )) and backward-time uˇt\check{u}_{t} ( ( 25 )), i.e. ,
中
将前向时间速度 u^t\hat u_t(式 24)与反向时间速度 uˇt\check u_t(式 25)作下列组合。
uˉti(xi,z)=αtu^ti(xi,z)−βtuˇti(xi,z),\bar{u}_{t}^{i}(x^{i},z)=\alpha_{t}\hat{u}_{t}^{i}(x^{i},z)-\beta_{t}\check{u}_{t}^{i}(x^{i},z),

SOURCE PDF p.7 · S2.SS4.SSS0.Px4.p1.2
EN
provides a valid forward-time probability velocity field ( i.e. , satisfies ( 13 )) for t∈(0,1)t\in(0,1) as long as αt,βt>0\alpha_{t},\beta_{t}>0 . This velocity field can be used for two types of corrector sampling: (i) When αt−βt=1\alpha_{t}-\beta_{t}=1 sampling with uˉt\bar{u}_{t} leads to corrector sampling where intuitively each step moves 1+βt1+\beta_{t} forward in time and −βt-\beta_{t} backwards, which allows reintroducing noise into the sampling process; and (ii) when αt−βt=0\alpha_{t}-\beta_{t}=0 sampling with uˉt\bar{u}_{t} when fixing t∈(0,1)t\in(0,1) leads to corrector iterations where limit samples distribute according to ptp_{t} . In Section E.6 we prove:
中
只要 αt,βt>0\alpha_t,\beta_t>0,就可在 t∈(0,1)t\in(0,1) 得到有效前向概率速度,即满足式(13)。该速度有两种校正用法:(i)当 αₜ−βₜ=1 时,每一步直观上向前推进 1+βₜ、向后退回 −βₜ,因此可把噪声重新引入采样过程;(ii)当 αₜ−βₜ=0 时,固定 t∈(0,1)t\in(0,1) 反复采样可形成校正迭代,其极限样本服从 pₜ。附录 E.6 证明如下结论。

Theorem 4 . 定理 4

SOURCE PDF p.7 · S2.Thmtheorem4.p1.1
EN
For perfectly trained posteriors and αt,βt>0\alpha_{t},\beta_{t}>0 , t∈(0,1)t\in(0,1) , uˉt\bar{u}_{t} in ( 26 ) is a probability velocity, i.e. , satisfies ( 13 ), and: (i) For αt−βt=1\alpha_{t}-\beta_{t}=1 , uˉt\bar{u}_{t} provides a probability velocity generating ptp_{t} ; (ii) For αt−βt=0\alpha_{t}-\beta_{t}=0 , repeatedly sampling with uˉt\bar{u}_{t} at fixed t∈(0,1)t\in(0,1) and sufficiently small hh is guaranteed to converge to a sample from ptp_{t} .
中
对完全训练好的后验,若 αt,βt>0\alpha_t,\beta_t>0、t∈(0,1)t\in(0,1),则式(26)的 uˉt\bar u_t 是满足式(13)的概率速度;(i)αₜ−βₜ=1 时,它生成 pₜ;(ii)αₜ−βₜ=0 时,固定 t 并取足够小的 h,反复按此速度采样,保证收敛到服从 pₜ 的样本。

SOURCE PDF p.7 · S2.SS4.SSS0.Px4.p2.1
EN
One simplification to ( 26 ) can be done in the case of paths constructed with conditional as in ( 9 ), independent coupling π(x0,x1)=p(x0)q(x1)\pi(x_{0},x_{1})=p(x_{0})q(x_{1}) , and i.i.d. source p(x0)=∏i=1Np(x0i)p(x_{0})=\prod_{i=1}^{N}p(x_{0}^{i}) , e.g. , p(x0i)p(x_{0}^{i}) is uniform over [d][d] or δ\dummy(x0i)\delta_{\dummy}(x_{0}^{i}) . In this case, the backward-time formula in ( 25 ) take an equivalent simpler form
中
若路径的条件分布为式(9)、耦合独立 π(x0,x1)=p(x0)q(x1)\pi(x_0,x_1)=p(x_0)q(x_1),且源分布独立同分布 p(x0)=∏ip(x0i)p(x_0)=\prod_i p(x_0^i),则式(26)可简化。例如每个源词元可以服从 [d] 上均匀分布或 mask 的 delta 分布。此时式(25)的反向速度有下列等价简式。
uˇti(xi,z)=κ˙tκt\bracδz(xi)−p(xi),\check{u}_{t}^{i}(x^{i},z)=\frac{\dot{\kappa}_{t}}{\kappa_{t}}\brac{\delta_{z}(x^{i})-p(x^{i})},

SOURCE PDF p.7 · S2.SS4.SSS0.Px4.p2.2
EN
which does not require estimation of the posterior p0∣tp_{0|t} . See Section E.5 for the derivation.
中
这一简式不需要估计后验 p₀|ₜ,推导见附录 E.5。

Training. 训练

SOURCE PDF p.7 · S2.SS4.SSS0.Px5.p1.1
EN
Equation 22 shows that for generating samples from a probabilty path pt(x)p_{t}(x) we require the posteriors w^tj(xi∣Xt)\hat{w}_{t}^{j}(x^{i}|X_{t}) . Training such posteriors can be done by minimizing the loss
中
式(22)表明,沿概率路径 pₜ(x) 生成样本需要后验 w^tj(xi∣Xt)\hat w_t^j(x^i|X_t)。这些后验可通过最小化下列损失训练。
\gL(θ)=−∑j∈[m],i∈[N]\Et,(X0,X1),Xt,Yjilog⁡w^tj(Yji∣Xt;θ),\gL(\theta)=-\sum_{j\in[m],i\in[N]}\E_{t,(X_{0},X_{1}),X_{t},Y_{j}^{i}}\log\hat{w}_{t}^{j}(Y_{j}^{i}|X_{t};\theta),

SOURCE PDF p.7 · S2.SS4.SSS0.Px5.p1.2
EN
where tt is sampled according to some distribution in [0,1][0,1] (we used uniform), (X0,X1)∼π(X0,X1)(X_{0},X_{1})\sim\pi(X_{0},X_{1}) , Xt∼pt(Xt∣X0,X1)X_{t}\sim p_{t}(X_{t}|X_{0},X_{1}) , and Yji∼wj(Yji∣X0,X1)Y_{j}^{i}\sim w^{j}(Y_{j}^{i}|X_{0},X_{1}) ; θ∈\Realp\theta\in\Real^{p} denotes the learnable parameters. In the common case we use in this paper of learning a single posterior, i.e. , the probability denoiser p1∣tp_{1|t} , the loss takes the form \gL(θ)=−∑i∈[N]\Et,(X0,X1),Xtlog⁡p1∣t(X1i∣Xt)\gL(\theta)=-\sum_{i\in[N]}\E_{t,(X_{0},X_{1}),X_{t}}\log p_{1|t}(X_{1}^{i}|X_{t}) . In Section E.7 we prove:
中
其中 t 从 [0,1] 上某分布采样(本文用均匀分布),(X0,X1)∼π(X_0,X_1)\sim\pi、Xt∼pt(Xt∣X0,X1)X_t\sim p_t(X_t|X_0,X_1),且 Yji∼wj(Yji∣X0,X1)Y_j^i\sim w^j(Y_j^i|X_0,X_1);θ∈Rp\theta\in\mathbb R^p 是可学习参数。本文常用情形只学习单一后验,即概率去噪器 p₁|ₜ,此时损失为 L(θ)=−∑iEt,(X0,X1),Xtlog⁡p1∣t(X1i∣Xt)\mathcal L(\theta)=-\sum_i\mathbb E_{t,(X_0,X_1),X_t}\log p_{1|t}(X_1^i|X_t)。附录 E.7 证明如下结论。

Proposition 5 . 命题 5

SOURCE PDF p.7 · S2.Thmtheorem5.p1.1
EN
The minimizer of \gL\gL (( 28 )) is w^tj(xi∣Xt)\hat{w}_{t}^{j}(x^{i}|X_{t}) (( 23 )).
中
损失 L(式 28)的极小化解是式(23)的 w^tj(xi∣Xt)\hat w_t^j(x^i|X_t)。

S2.T2

SOURCE PDF p.8,S2.T2

Table 2: Generative perplexity on unconditional text generation compared to prior work. All models are sampled without the use of temperature or corrector steps. Double precision sampling results are reported in Table 5 . 表 2:无条件文本生成的生成困惑度比较;所有模型均不使用温度或校正步骤。双精度采样结果见表 5。

SOURCE PDF p.7 · S3.p1.1
EN
In the section we cover the most related work to ours; in Appendix A we cover other related work.
中
本节讨论与本文最相关的研究,其他相关工作见附录 A。

SOURCE PDF p.7 · S3.p2.1
EN
Discrete Flows ( Campbell et al., 2024 ) is probably the most related work to ours. We build upon their CTMC framework and offer the following generalizations and simplifications: We consider arbitrary couplings (X0,X1)(X_{0},X_{1}) , and offer a novel and rather general family of probability paths (( 8 )) for which we provide the generating probability velocities in a unified closed-form formula (equations 22 - 25 ). These in particular recreate the same formulas as the continuous Flow Matching counterpart (Table 1 ). We furthermore develop a general corrector velocity (( 26 )) that unifies both corrector iterations ( Song et al., 2020 ; Campbell et al., 2022 ) and stochastic sampling of Campbell et al. (2024) . We show that particular choices of noise schedulers κt\kappa_{t} ( κt=t\kappa_{t}=t reproduces Campbell et al. (2024) ) and corrector schedulers provide a boost in results. Lastly, we opted for the term probability velocity for uti(xi,Xt)u^{i}_{t}(x^{i},X_{t}) as it is not precisely a rate matrix in the state space \gD×\gD\gD\times\gD used in CTMC since uti(xi,z)u_{t}^{i}(x^{i},z) for all i∈[N]i\in[N] define multiple self-edges z\toozz\too z .
中
离散流(Campbell 等,2024)或许是最接近本文的工作。我们在其 CTMC 框架上做出如下推广与简化:考虑任意端点耦合,提出相当一般的新概率路径族(式 8),并给出统一闭式生成概率速度(式 22—25),特别地重现了连续流匹配的同型公式(表 1)。一般校正速度(式 26)还统一了校正迭代(Song 等,2020;Campbell 等,2022)与 Campbell 等(2024)的随机采样。特定噪声调度器 κₜ 以及校正调度器能改善结果;κₜ=t 重现 Campbell 等的方法。我们采用“概率速度”而非“速率矩阵”,因为在 CTMC 的 D×D 状态空间里,每个 i 定义的 uti(xi,z)u_t^i(x^i,z) 会产生多个 z→z 自环,因此它并不严格等于通常的速率矩阵。

SOURCE PDF p.8 · S3.p3.1
EN
Masked modeling ( Ghazvininejad et al., 2019 ; Chang et al., 2022 ) . In case of a masked model, i.e. , when the source distribution is p(x)=δ\dummy(x)p(x)=\delta_{\dummy}(x) , we achieve an interesting connection with MaskGit showing it is actually an instance of Discrete Flow Matching with a small yet crucial change to its sampling algorithm. First, in Section E.8 we prove that in the masked setting, the probability denoiser p1∣tp_{1|t} is time-independent :
中
掩码建模(Ghazvininejad 等,2019;Chang 等,2022)。当源分布为全掩码 p(x)=δM(x)p(x)=\delta_M(x) 时,可发现与 MaskGIT 的联系:对其采样算法做一个虽小但关键的修改,它便成为离散流匹配的实例。首先,附录 E.8 证明掩码情形的概率去噪器与时间无关。

Proposition 6 . 命题 6

SOURCE PDF p.8 · S3.Thmtheorem1.p1.1
EN
For paths defined by equations 7 and 9 with source p(x)=δ\dummy(x)p(x)=\delta_{\dummy}(x) the posterior pt(x0,x1∣z)=p(x0,x1∣z)p_{t}(x_{0},x_{1}|z)=p(x_{0},x_{1}|z) is time-independent. Consequently, the probability denoiser p1∣t(xi∣z)=p1(xi∣z)p_{1|t}(x^{i}|z)=p_{1}(x^{i}|z) is also time-independent.
中
对式(7)、(9)定义、源分布为 p(x)=δM(x)p(x)=\delta_M(x) 的路径,后验 pt(x0,x1∣z)=p(x0,x1∣z)p_t(x_0,x_1|z)=p(x_0,x_1|z) 与时间无关。因此概率去噪器 p1∣t(xi∣z)=p1(xi∣z)p_{1|t}(x^i|z)=p_1(x^i|z) 也与时间无关。

SOURCE PDF p.8 · S3.p4.1
EN
This shows that the probability denoiser can be learned with no time dependence, similar to the unmasking probabilities in MaskGit. During sampling however, there are two main differences between our sampling and MaskGit sampling. First, unmasking of tokens in our algorithm is done according to the probability δXt(xi)+huti(xi,Xt)\delta_{X_{t}}(x^{i})+hu^{i}_{t}(x^{i},X_{t}) independently for each token xix^{i} , i∈[N]i\in[N] . This procedure is justified as it samples from the correct probability asymptotically via the derivation of the Continuity Equation 20 . This is in contrast to MaskGit that prioritizes the token to be unmasked according to some confidence . In the experiments section we show that MaskGit’s prioritization, although has some benefit in the very low NFE regime, is actually introducing a strong bias in the sampling procedure and leads to inferior overall results. Secondly, using corrector sampling allows for reintroducing masks to already unmasked tokens in a way that is still guaranteed to produce samples from ptp_{t} , see Theorem 4 ; we find this to have a significant positive effect on the generation quality.
中
因此可像 MaskGIT 的去掩码概率一样,学习不显含时间的概率去噪器。但两者采样有两个主要区别。第一,本文按 δXt(xi)+huti(xi,Xt)\delta_{X_t}(x^i)+h u_t^i(x^i,X_t) 对各词元独立去掩码;连续性方程(20)的推导保证其渐近采样正确。MaskGIT 则依据某种置信度优先选择去掩码的词元。实验表明,虽然这种优先策略在极低 NFE 时有好处,却会引入显著采样偏差,使整体结果较差。第二,校正采样可以重新掩码已解开的词元,同时仍保证样本服从 pₜ(定理 4);我们发现这明显提升生成质量。

SOURCE PDF p.8 · S3.p5.1
EN
Discrete diffusion. D3PM ( Austin et al., 2021a ) and Argmax flows ( Hoogeboom et al., 2021 ) introduced diffusion in discrete spaces by proposing a corruption process for categorical data. A later work by Campbell et al. (2022) introduced discrete diffusion models with continuous time, and Lou et al. (2023) proposed learning probability ratios, extending score matching ( Song and Ermon, 2019 ) to discrete spaces.
中
离散扩散。D3PM(Austin 等,2021a)与 Argmax flows(Hoogeboom 等,2021)通过为类别数据设计损坏过程,在离散空间引入扩散。Campbell 等(2022)随后提出连续时间离散扩散模型,Lou 等(2023)通过学习概率比率,把得分匹配(Song 与 Ermon,2019)推广至离散空间。

S3.T3

SOURCE PDF p.8,S3.T3

Table 3 : Generative perplexity on conditional text generation. 表 3:条件文本生成的生成困惑度。

S3.T4

SOURCE PDF p.9,S3.T4

Table 4 : Execution based code generation evaluation. 表 4:基于代码执行的生成评估。

4 Experiments 4 实验

SOURCE PDF p.8 · S4.p1.1
EN
We evaluate our method on the tasks of language modeling, code generation, and image generation. For language modeling, we compare the proposed method against prior work considering the widely used generative perplexity metric. We scale the models to 1.7 billion parameters and present results on coding tasks, i.e., HumanEval ( Chen et al., 2021 ) , MBPP ( Austin et al., 2021b ) , demonstrating the most promising results to date in a non-autoregressive context. In image generation, we present results for a fully discrete CIFAR10 ( Krizhevsky et al., 2009 ) . Further details of the experimental setup for each model are provided in Appendix G .
中
我们在语言建模、代码生成和图像生成任务上评估方法。语言建模使用常见的生成困惑度指标与已有工作比较;模型扩展至 17 亿参数后,在 HumanEval(Chen 等,2021)、MBPP(Austin 等,2021b)上展示了非自回归情形当时最有潜力的编程结果。图像生成则在完全离散的 CIFAR10(Krizhevsky 等,2009)上评估。各模型的更多实验设置见附录 G。

SOURCE PDF p.9 · S4.p2.1
EN
Experimental setup. In our experiments we used the masked source, i.e. , p=δ\dummyp=\delta_{\dummy} , and trained with both unconditional coupling (U-coupling, ( 4 )) and conditional couplings (C-coupling, ( 5 )) with the probability path defined in equations 7 , 9 and in one case 10 . We trained a probability denoiser (loss in ( 28 )) and sampled using the generating velocity in ( 24 ) and Algorithm 1 . We used a particular choice of probability path scheduler κt\kappa_{t} , as well as corrector steps defined by a scheduler αt\alpha_{t} and temperature annealing. We found the choice of these schedulers to be pivotal for the model’s performance. In Appendix D we perform an ablation study, evaluating various scheduler choices.
中
实验设置。我们使用掩码源 p=δM,以无条件耦合(式 4)和条件耦合(式 5)训练,概率路径由式(7)、(9)定义,另有一个实验使用式(10)。训练概率去噪器(式 28),用式(24)的生成速度及算法 1 采样,并选择特定 κₜ 路径调度器、αₜ 校正调度器及温度退火。我们发现这些调度器的选择对模型性能非常关键,附录 D 给出不同选择的消融。

4.1 Language modeling 4.1 语言建模

SOURCE PDF p.9 · S4.SS1.p1.1
EN
We experimented with our method in three settings: (i) Small model (150M parameters) - comparison to other non-autoregressive baselines in unconditional text generation; (ii) Large model (1.7B parameters) - comparison to autoregressive models in conditional text generation; and (iii) Large model (1.7B parameters) - conditional code generation. As computing exact likelihood for non-autoregressive model is a challenge, for (i),(ii) we use the generative perplexity metric ( Appendix G measured with GPT2 ( Radford et al., 2019 ) , Llama-2 ( Touvron et al., 2023 ) , and Llama-3, and we also monitor the sentence entropy ( Appendix G ) to measure diversity of tokens and flag repetitive sequences, which typically yield low perplexity. Throughout our experiments we noticed entropy ≥6\geq 6 usually corresponds to diverse texts. For (iii) we evaluated using the success rate of coding tasks.
中
我们考察三种设置:(i)1.5 亿参数小模型,在无条件文本生成上与其他非自回归基线比较;(ii)17 亿参数大模型,在条件文本生成上与自回归模型比较;(iii)17 亿参数大模型,进行条件代码生成。非自回归模型精确似然难以计算,故(i)、(ii)采用由 GPT2(Radford 等,2019)、Llama-2(Touvron 等,2023)、Llama-3 测量的生成困惑度(附录 G),同时监测句子熵以衡量词元多样性、识别通常困惑度较低的重复序列。实验中熵≥6 通常对应较多样的文本。对(iii)则评估编程任务成功率。

SOURCE PDF p.9 · S4.SS1.p2.1
EN
Evaluation against prior work. We evaluate our method against prior work on non-autoregressive modeling. For a fair comparison, all methods are trained on a 150M parameters models using the OpenWebText ( Gokaslan and Cohen, 2019 ) dataset. We also fix all sampling hyperparameters to the most basic settings, i.e. , no temperature, top probability, corrector steps, etc. For our method we tried two paths defined by equations 9 and 10 . Results are reported in Table 2 , where our method outperforms all baselines in generative perplexity for all numbers of function evaluations (NFE).
中
与既有工作的评估。我们与非自回归建模的已有方法比较。为公平起见,全部方法都在 OpenWebText(Gokaslan 与 Cohen,2019)上训练 1.5 亿参数模型,且采样超参数均固定为最基本设置,即不使用温度、top probability 截断、校正步骤等。本文方法尝试了式(9)、(10)两条路径。表 2 表明,在所有函数评估次数(NFE)设置下,我们的生成困惑度均优于全部基线。

SOURCE PDF p.9 · S4.SS1.p3.1
EN
Conditional text generation. In this experiment, we train both C-coupling and U-coupling 1.7B parameters Discrete Flow Matching models with paths defined by ( 9 ) on a large scale data mix ( Touvron et al., 2023 ) . Table 3 presents the generative perplexity of conditional generations from our method; the conditions we used are the prefixes of the first 1000 samples in OpenWeb dataset. We also compare to existing state-of-the-art autoregressive models. Our results demonstrate that our model effectively narrows the gap in generative perplexity with autoregressive models, while maintaining an entropy comparable to the recent Llama-3 8B model. Furthermore, we note the C-coupling trained model produces slightly better perplexity in conditional tasks than the U-coupling model. In Appendix I we present qualitative conditional samples produced by our U-coupling model.
中
条件文本生成。我们用大规模混合数据(Touvron 等,2023)及式(9)路径,分别训练 C-coupling、U-coupling 的 17 亿参数离散流匹配模型。表 3 给出条件生成的生成困惑度;条件是 OpenWeb 数据集前 1000 个样本的前缀。我们还与已有先进自回归模型比较。结果表明,模型有效缩小了与自回归模型的困惑度差距,同时保持与较新的 Llama-3 8B 相当的熵。C-coupling 训练模型在条件任务上的困惑度略好于 U-coupling。附录 I 展示 U-coupling 模型的条件生成定性样例。

SOURCE PDF p.10 · S4.SS1.p4.1
EN
Code generation. Here we trained our basic setting of a 1.7B parameters Discrete Flow Matching model with U-coupling and path as in ( 9 ) on a code-focused data mix ( Roziere et al., 2023 ) . Table 4 presents results on HumanEval and MBPP (1-shot) for pass@ {1,10,25}\{1,10,25\} . In Table 4 , ‘Oracle length’ evaluates the performance of our model when conditioning on the length of the solution. This is done by inserting an ‘end of text’ token in the same position of the ground truth solution. Our method achieves non-trivial results on both tasks, which to the best of our knowledge is the first instance of a non-autoregressive method being capable of non-trivial coding tasks. In Appendix C , we analyze the proposed method for code infilling, which can be achieved as our model allows non-autoregressive generation. Lastly, in Appendix H we show qualitative examples of success and failure cases produced by our model on the coding tasks, and in Section H.3 we show examples of code infilling.
中
代码生成。我们用偏重代码的混合数据(Roziere 等,2023),训练基本设置的 17 亿参数离散流匹配模型,采用 U-coupling 与式(9)的路径。表 4 给出 HumanEval、MBPP(1-shot)的 Pass@{1,10,25}。“Oracle length”表示在给定解答长度的条件下评估:把文本结束词元插入到真实解答的同一位置。本文方法在两项任务都取得非平凡结果;据我们所知,这是非自回归方法首次能处理非平凡编程任务。模型支持非自回归生成,因此还可用于代码填空,分析见附录 C。附录 H 展示成功与失败案例,H.3 展示代码填空例子。

4.2 Image generation 4.2 图像生成

S4.F3

SOURCE PDF p.10,S4.F3

(a) FID. (a)FID。

(b) Inception Score. (b)Inception Score。

Figure 3 : FID and Inception scores vs. number of function evaluations (NFE). 图 3:FID 与 Inception Score 随函数评估次数 NFE 的变化。

SOURCE PDF p.10 · S4.SS2.p1.1
EN
We performed a fully discrete image generation, without using any metric or neighboring information between color values. We trained an Discrete Flow Matching model with U-coupling and path as in ( 9 ) on CIFAR10 to predict discrete color value for tokens, i.e. , d=256d=256 , with sequence length of N=32×32×3N=32\times 32\times 3 . For generative quality we evaluate the Fréchet Inception Distance (FID) ( Heusel et al., 2017 ) . Ablations for the probability path schedulers are provided in Figure 8 in the Appendix G . In Figure 3(a) we compare our method with: (i) MaskGIT ( Chang et al., 2022 ) ; and (ii) ( Campbell et al., 2024 ) which coincides with our method for a linear scheduler. More details in Appendix G . As can be seen in the Figure 3(a) , our method outperforms both baselines, achieving 3.633.63 FID at 10241024 NFE. In fig. 3(b) we observe a similar trend when evaluating Inception score. As discussed above, MaskGit sampling performs better for low NFE but quickly deteriorates for higher NFE. We attribute this to a bias introduced in the sampling process via the confidence mechanism.
中
我们进行完全离散图像生成,不使用颜色值之间的距离度量或邻域信息。在 CIFAR10 上,以 U-coupling 与式(9)路径训练离散流匹配模型,预测词元的离散颜色值,即 d=256,序列长度 N=32×32×3。生成质量用 Fréchet Inception Distance(FID;Heusel 等,2017)评估。概率路径调度器消融见附录 G 图 8。图 3(a) 比较了 MaskGIT(Chang 等,2022)和 Campbell 等(2024);后者等同于本方法的线性调度器版本,更多细节见附录 G。本文方法优于两项基线,在 1024 NFE 时达到 FID 3.63。图 3(b) 的 Inception Score 也呈现类似趋势。正如前文所述,MaskGIT 在低 NFE 时更好,但随 NFE 增大迅速恶化;我们将此归因于置信度机制引入的采样偏差。

5 Conclusions and future work 5 结论与未来工作

SOURCE PDF p.10 · S5.p1.1
EN
We introduce Discrete Flow Matching, a generalization of continuous flow matching and discrete flows that provides a large design space of discrete non-autoregressive generative models. Searching within this space we were able to train large scale language models that produce generated text with an improved generative perplexity compared to current non-autoregressive methods and able to solve coding tasks at rates not achievable before with non-autoregressive models, as far as we are aware. While reducing the number of network evaluations required to generate a discrete sample compared to autoregressive models, Discrete Flow Matching still does not achieve the level of sampling efficiency achieved by its continuous counterpart, flagging an interesting future work direction. Another interesting direction is to explore the space of probability paths in ( 8 ) (or a generalization of which) beyond what we have done in this paper. We believe discrete non-autoregressive models have the potential to close the gap and even surpass autoregressive models as well as unlock novel applications and use cases. As our work introduces an alternative modeling paradigm to discrete sequential data such as language and code, we feel it does not introduce significant societal risks beyond those that already exist with previous large language models.
中
我们提出离散流匹配,它推广了连续流匹配与离散流,为离散非自回归生成提供广阔设计空间。在其中探索后,我们训练出大规模语言模型,其文本生成困惑度优于当时非自回归方法,并以据我们所知此前非自回归模型达不到的成功率完成编程任务。虽然相对自回归模型减少了生成一个离散样本所需的网络评估次数,其采样效率仍未达到连续流匹配的水平,这是值得研究的方向。另一个方向是进一步探索式(8)及其推广所允许的概率路径空间。我们认为离散非自回归模型可能缩小乃至超越与自回归模型的差距,并带来新应用。本文针对语言、代码等离散序列提供另一建模范式,作者认为它没有引入超出现有大语言模型的显著额外社会风险。

References 参考文献

  • Ahn et al. (2024) Janice Ahn, Rishu Verma, Renze Lou, Di Liu, Rui Zhang, and Wenpeng Yin. Large language models for mathematical reasoning: Progresses and challenges. arXiv preprint arXiv:2402.00157 , 2024.

  • Albergo and Vanden-Eijnden (2022) Michael S Albergo and Eric Vanden-Eijnden. Building normalizing flows with stochastic interpolants. arXiv preprint arXiv:2209.15571 , 2022.

  • Austin et al. (2021a) Jacob Austin, Daniel D Johnson, Jonathan Ho, Daniel Tarlow, and Rianne Van Den Berg. Structured denoising diffusion models in discrete state-spaces. Advances in Neural Information Processing Systems , 34:17981–17993, 2021a.

  • Austin et al. (2021b) Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732 , 2021b.

  • Besnier and Chen (2023) Victor Besnier and Mickael Chen. A pytorch reproduction of masked generative image transformer, 2023.

  • Blattmann et al. (2023) Andreas Blattmann, Tim Dockhorn, Sumith Kulal, Daniel Mendelevitch, Maciej Kilian, Dominik Lorenz, Yam Levi, Zion English, Vikram Voleti, Adam Letts, et al. Stable video diffusion: Scaling latent video diffusion models to large datasets. arXiv preprint arXiv:2311.15127 , 2023.

  • Brown et al. (2020) Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems , 33:1877–1901, 2020.

  • Campbell et al. (2022) Andrew Campbell, Joe Benton, Valentin De Bortoli, Thomas Rainforth, George Deligiannidis, and Arnaud Doucet. A continuous time framework for discrete denoising models. Advances in Neural Information Processing Systems , 35:28266–28279, 2022.

  • Campbell et al. (2024) Andrew Campbell, Jason Yim, Regina Barzilay, Tom Rainforth, and Tommi Jaakkola. Generative flows on discrete state-spaces: Enabling multimodal flows with applications to protein co-design. arXiv preprint arXiv:2402.04997 , 2024.

  • Chang et al. (2022) Huiwen Chang, Han Zhang, Lu Jiang, Ce Liu, and William T Freeman. Maskgit: Masked generative image transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , pages 11315–11325, 2022.

  • Chang et al. (2023) Huiwen Chang, Han Zhang, Jarred Barber, AJ Maschinot, Jose Lezama, Lu Jiang, Ming-Hsuan Yang, Kevin Murphy, William T Freeman, Michael Rubinstein, et al. Muse: Text-to-image generation via masked generative transformers. arXiv preprint arXiv:2301.00704 , 2023.

  • Chen et al. (2021) Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374 , 2021.

  • Chen et al. (2022) Ting Chen, Ruixiang Zhang, and Geoffrey E. Hinton. Analog bits: Generating discrete data using diffusion models with self-conditioning. ArXiv , 2022.

  • Copet et al. (2024) Jade Copet, Felix Kreuk, Itai Gat, Tal Remez, David Kant, Gabriel Synnaeve, Yossi Adi, and Alexandre Défossez. Simple and controllable music generation. Advances in Neural Information Processing Systems , 36, 2024.

  • Dhariwal and Nichol (2021) Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems , 34:8780–8794, 2021.

  • Dieleman et al. (2022) Sander Dieleman, Laurent Sartran, Arman Roshannai, Nikolay Savinov, Yaroslav Ganin, Pierre H Richemond, Arnaud Doucet, Robin Strudel, Chris Dyer, Conor Durkan, et al. Continuous diffusion for categorical data. arXiv preprint arXiv:2211.15089 , 2022.

  • Esser et al. (2024) Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Müller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, et al. Scaling rectified flow transformers for high-resolution image synthesis. arXiv preprint arXiv:2403.03206 , 2024.

  • Ferruz and Höcker (2022) Noelia Ferruz and Birte Höcker. Controllable protein design with language models. Nature Machine Intelligence , 4(6):521–532, 2022.

  • Ghazvininejad et al. (2019) Marjan Ghazvininejad, Omer Levy, Yinhan Liu, and Luke Zettlemoyer. Mask-predict: Parallel decoding of conditional masked language models. arXiv preprint arXiv:1904.09324 , 2019.

  • Gokaslan and Cohen (2019) Aaron Gokaslan and Vanya Cohen. Openwebtext corpus. http://Skylion007.github.io/OpenWebTextCorpus , 2019.

  • Han et al. (2022) Xiaochuang Han, Sachin Kumar, and Yulia Tsvetkov. Ssd-lm: Semi-autoregressive simplex-based diffusion language model for text generation and modular control. arXiv preprint arXiv:2210.17432 , 2022.

  • Hassid et al. (2024) Michael Hassid, Tal Remez, Tu Anh Nguyen, Itai Gat, Alexis Conneau, Felix Kreuk, Jade Copet, Alexandre Defossez, Gabriel Synnaeve, Emmanuel Dupoux, et al. Textually pretrained speech language models. Advances in Neural Information Processing Systems , 36, 2024.

  • He et al. (2022) Zhengfu He, Tianxiang Sun, Kuan Wang, Xuanjing Huang, and Xipeng Qiu. Diffusionbert: Improving generative masked language models with diffusion models. In Annual Meeting of the Association for Computational Linguistics , 2022.

  • Heusel et al. (2017) Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in Neural Information Processing Systems (NeurIPS) , 2017.

  • Ho et al. (2020) Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems , 33:6840–6851, 2020.

  • Hoogeboom et al. (2021) Emiel Hoogeboom, Didrik Nielsen, Priyank Jaini, Patrick Forré, and Max Welling. Argmax flows and multinomial diffusion: Learning categorical distributions. Advances in Neural Information Processing Systems , 34:12454–12465, 2021.

  • Imani et al. (2023) Shima Imani, Liang Du, and Harsh Shrivastava. Mathprompter: Mathematical reasoning using large language models. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 5: Industry Track) , pages 37–42, 2023.

  • Kreuk et al. (2022) Felix Kreuk, Gabriel Synnaeve, Adam Polyak, Uriel Singer, Alexandre Défossez, Jade Copet, Devi Parikh, Yaniv Taigman, and Yossi Adi. Audiogen: Textually guided audio generation. arXiv preprint arXiv:2209.15352 , 2022.

  • Krizhevsky et al. (2009) Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. arXiv , 2009.

  • Li et al. (2023) Raymond Li, Loubna Ben Allal, Yangtian Zi, Niklas Muennighoff, Denis Kocetkov, Chenghao Mou, Marc Marone, Christopher Akiki, Jia Li, Jenny Chim, et al. Starcoder: may the source be with you! arXiv preprint arXiv:2305.06161 , 2023.

  • Li et al. (2022) Xiang Lisa Li, John Thickstun, Ishaan Gulrajani, Percy Liang, and Tatsunori Hashimoto. Diffusion-lm improves controllable text generation. ArXiv , 2022.

  • Lin et al. (2022) Zheng-Wen Lin, Yeyun Gong, Yelong Shen, Tong Wu, Zhihao Fan, Chen Lin, Weizhu Chen, and Nan Duan. Genie : Large scale pre-training for generation with diffusion model. In ArXiv , 2022.

  • Lipman et al. (2022) Yaron Lipman, Ricky TQ Chen, Heli Ben-Hamu, Maximilian Nickel, and Matt Le. Flow matching for generative modeling. arXiv preprint arXiv:2210.02747 , 2022.

  • Liu et al. (2022) Xingchao Liu, Chengyue Gong, and Qiang Liu. Flow straight and fast: Learning to generate and transfer data with rectified flow. arXiv preprint arXiv:2209.03003 , 2022.

  • Lou et al. (2023) Aaron Lou, Chenlin Meng, and Stefano Ermon. Discrete diffusion language modeling by estimating the ratios of the data distribution. arXiv preprint arXiv:2310.16834 , 2023.

  • Lovelace et al. (2022) Justin Lovelace, Varsha Kishore, Chao gang Wan, Eliot Shekhtman, and Kilian Q. Weinberger. Latent diffusion for language generation. ArXiv , 2022.

  • Madani et al. (2023) Ali Madani, Ben Krause, Eric R Greene, Subu Subramanian, Benjamin P Mohr, James M Holton, Jose Luis Olmos, Caiming Xiong, Zachary Z Sun, Richard Socher, et al. Large language models generate functional protein sequences across diverse families. Nature Biotechnology , 41(8):1099–1106, 2023.

  • Norris (1998) James R Norris. Markov chains . Number 2. Cambridge university press, 1998.

  • Peebles and Xie (2022) William Peebles and Saining Xie. Scalable diffusion models with transformers. arXiv preprint arXiv:2212.09748 , 2022.

  • Pooladian et al. (2023) Aram-Alexandre Pooladian, Heli Ben-Hamu, Carles Domingo-Enrich, Brandon Amos, Yaron Lipman, and Ricky TQ Chen. Multisample flow matching: Straightening flows with minibatch couplings. arXiv preprint arXiv:2304.14772 , 2023.

  • Radford et al. (2019) Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019. https://api.semanticscholar.org/CorpusID:160025533 .

  • Rombach et al. (2022) Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 10684–10695, 2022.

  • Romera-Paredes et al. (2024) Bernardino Romera-Paredes, Mohammadamin Barekatain, Alexander Novikov, Matej Balog, M Pawan Kumar, Emilien Dupont, Francisco JR Ruiz, Jordan S Ellenberg, Pengming Wang, Omar Fawzi, et al. Mathematical discoveries from program search with large language models. Nature , 625(7995):468–475, 2024.

  • Roziere et al. (2023) Baptiste Roziere, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Tal Remez, Jérémy Rapin, et al. Code llama: Open foundation models for code. arXiv preprint arXiv:2308.12950 , 2023.

  • Savinov et al. (2021) Nikolay Savinov, Junyoung Chung, Mikolaj Binkowski, Erich Elsen, and Aaron van den Oord. Step-unrolled denoising autoencoders for text generation. arXiv preprint arXiv:2112.06749 , 2021.

  • Singer et al. (2022) Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, et al. Make-a-video: Text-to-video generation without text-video data. arXiv preprint arXiv:2209.14792 , 2022.

  • Song and Ermon (2019) Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems , 32, 2019.

  • Song et al. (2020) Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456 , 2020.

  • Stark et al. (2024) Hannes Stark, Bowen Jing, Chenyu Wang, Gabriele Corso, Bonnie Berger, Regina Barzilay, and Tommi Jaakkola. Dirichlet flow matching with applications to dna sequence design. arXiv preprint arXiv:2402.05841 , 2024.

  • Su et al. (2024) Jianlin Su, Murtadha Ahmed, Yu Lu, Shengfeng Pan, Wen Bo, and Yunfeng Liu. Roformer: Enhanced transformer with rotary position embedding. Neurocomputing , 568:127063, 2024.

  • Tong et al. (2023) Alexander Tong, Nikolay Malkin, Guillaume Huguet, Yanlei Zhang, Jarrid Rector-Brooks, Kilian Fatras, Guy Wolf, and Yoshua Bengio. Improving and generalizing flow-based generative models with minibatch optimal transport. arXiv preprint arXiv:2302.00482 , 2023.

  • Touvron et al. (2023) Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288 , 2023.

  • Zhang et al. (2024) Qiang Zhang, Keyang Ding, Tianwen Lyv, Xinda Wang, Qingyu Yin, Yiwen Zhang, Jing Yu, Yuhao Wang, Xiaotong Li, Zhuoyi Xiang, et al. Scientific large language models: A survey on biological & chemical domains. arXiv preprint arXiv:2401.14656 , 2024.

  • Zhao et al. (2023) Wayne Xin Zhao, Kun Zhou, Junyi Li, Tianyi Tang, Xiaolei Wang, Yupeng Hou, Yingqian Min, Beichen Zhang, Junjie Zhang, Zican Dong, et al. A survey of large language models. arXiv preprint arXiv:2303.18223 , 2023.

  • Zheng et al. (2024) Kaiwen Zheng, Yongxin Chen, Hanzi Mao, Ming-Yu Liu, Jun Zhu, and Qinsheng Zhang. Masked diffusion models are secretly time-agnostic masked models and exploit inaccurate categorical sampling. arXiv preprint arXiv:2409.02908 , 2024.

  • Ziv et al. (2024) Alon Ziv, Itai Gat, Gael Le Lan, Tal Remez, Felix Kreuk, Alexandre Défossez, Jade Copet, Gabriel Synnaeve, and Yossi Adi. Masked audio generation using a single non-autoregressive transformer. arXiv preprint arXiv:2401.04577 , 2024.

SOURCE PDF p.14 · A1.p1.1
EN
We provide here some more details on relevant related works.
中
这里进一步介绍相关研究。

Continuous diffusion and flows. 连续扩散与流

SOURCE PDF p.14 · A1.SS0.SSS0.Px1.p1.1
EN
Another line of works has been exploring the use of continuous space diffusion for discrete data, typically operating in the logits space ( Dieleman et al., 2022 ; Li et al., 2022 ; Han et al., 2022 ; Lin et al., 2022 ; Chen et al., 2022 ) . An additional body of work has been focusing on the adoption of latent diffusion-like modeling ( Lovelace et al., 2022 ; He et al., 2022 ) . Stark et al. (2024) proposed to learn a continuous Flow Matching on the probability simplex with Dirichlet paths.
中
另一条研究路线是在连续空间对离散数据进行扩散,通常操作 logits 空间(Dieleman 等,2022;Li 等,2022;Han 等,2022;Lin 等,2022;Chen 等,2022)。另一些工作采用类似潜变量扩散的建模(Lovelace 等,2022;He 等,2022)。Stark 等(2024)提出利用 Dirichlet 路径,在概率单纯形上学习连续流匹配。

Autoregressive modeling. 自回归建模

SOURCE PDF p.14 · A1.SS0.SSS0.Px2.p1.1
EN
Autoregressive models have been a significant area of focus in recent years, particularly in the context of natural language processing and machine learning ( Zhao et al., 2023 ) . Autoregressive modeling, in its most fundamental form, utilizes the chain rule to learn the joint sequence probability by breaking it down into next-token conditional probabilities. GPT-2 ( Radford et al., 2019 ) , showcased the power of autoregressive language models in generating coherent and contextually relevant text over long passages. Its successor, GPT-3 ( Brown et al., 2020 ) , further pushed the boundaries, demonstrating impressive performance across a range of tasks without task-specific training data. Later models were adapted to other domains such as, code ( Roziere et al., 2023 ; Li et al., 2023 ; Chen et al., 2021 ) , biology ( Zhang et al., 2024 ; Ferruz and Höcker, 2022 ; Madani et al., 2023 ) , math ( Romera-Paredes et al., 2024 ; Imani et al., 2023 ; Ahn et al., 2024 ) , audio ( Kreuk et al., 2022 ; Copet et al., 2024 ; Hassid et al., 2024 ) and more.
中
近年来,自回归模型一直是自然语言处理与机器学习的重要方向(Zhao 等,2023)。其基本形式利用概率链式法则,把序列联合概率拆成逐个下一词元的条件概率来学习。GPT-2(Radford 等,2019)展示了生成连贯且符合上下文长文本的能力;GPT-3(Brown 等,2020)进一步表明,即使没有特定任务训练数据,也可在多种任务上表现良好。后续模型被扩展到代码(Roziere 等,2023;Li 等,2023;Chen 等,2021)、生物学(Zhang 等,2024;Ferruz 与 Höcker,2022;Madani 等,2023)、数学(Romera-Paredes 等,2024;Imani 等,2023;Ahn 等,2024)、音频(Kreuk 等,2022;Copet 等,2024;Hassid 等,2024)等领域。

Masked generative modeling. 掩码生成建模

SOURCE PDF p.14 · A1.SS0.SSS0.Px3.p1.1
EN
Masked generative modeling proposes to mask a variable portion of the input sequence and training a model to predict this masked section. Ghazvininejad et al. (2019) proposed Mask-Predict, a masked language modeling with parallel decoding. Savinov et al. (2021) extended the mask-modeling approach by employing an additional loss term that incorporates rolling model predictions. MaskGIT ( Chang et al., 2022 ) followed a similar path, for the task of class-conditioned image synthesis, Chang et al. (2023) extended this approach to high-quality textually guided image generation over low-resolution images followed by a super-resolution module. Recently, Ziv et al. (2024) proposed a text-to-music method, which relies on the MaskGIT foundations while observing that span masking boosts the quality of the generated sequence significantly.
中
掩码生成建模对输入序列中可变比例的部分做掩码,训练模型预测被遮挡部分。Ghazvininejad 等(2019)的 Mask-Predict 是并行解码的掩码语言模型;Savinov 等(2021)通过纳入滚动模型预测的额外损失项扩展此路线。MaskGIT(Chang 等,2022)沿类似思路进行类别条件图像合成,Chang 等(2023)又将其扩展为先生成低分辨率图像、再超分辨率的高质量文本引导图像生成。近期 Ziv 等(2024)基于 MaskGIT 提出文本到音乐方法,并观察到连续片段掩码显著提高生成序列质量。

Appendix B Further implementation details 附录 B 更多实现细节

Safe sampling. 安全采样

SOURCE PDF p.14 · A2.SS0.SSS0.Px1.p1.1
EN
When sampling according to Algorithm 1 using the generating probability velocity in ( 22 ), an arbitrary step size h>0h>0 can make some probabilities in δXti(⋅)+huti(⋅,Xt)\delta_{X_{t}^{i}}(\cdot)+hu_{t}^{i}(\cdot,X_{t}) negative and consequently require clamping and injecting further error into the sampling process that can in turn accumulate to a non-negligible global sampling error. A simple fix that guarantees a valid probability distribution while keeping the o(h)o(h) sampling error at the relatively manageable price of potentially more function evaluations is using the following adaptive step size in Algorithm 1 : at time t∈[0,1)t\in[0,1) use
中
按算法 1、式(22)的概率速度采样时,任意步长 h>0 可能使 δXti(⋅)+huti(⋅,Xt)\delta_{X_t^i}(\cdot)+h u_t^i(\cdot,X_t) 的某些概率变负,从而不得不裁剪,额外误差可能累积成不可忽略的全局采样误差。简单修复是使用下列自适应步长:它保证概率分布有效,保留 o(h) 采样误差,代价是可能增加函数评估次数。在 t∈[0,1)t\in[0,1) 时取下式。
h_{\text{\tiny adaptive}}=\min\set{h,\min_{i}\abs{\frac{\kappa_{t}^{i,\ell}}{\dot{\kappa}_{t}^{i,\ell}}}}.

SOURCE PDF p.14 · A2.SS0.SSS0.Px1.p1.2
EN
As can be verified with the general probability velocity formula in ( 22 ), the above choice for hadaptiveh_{\text{\tiny adaptive}} guarantees δXti(⋅)+huti(⋅,Xt)\delta_{X_{t}^{i}}(\cdot)+hu_{t}^{i}(\cdot,X_{t}) is a valid PMF. As mostly used in this paper, for the probability denoiser parameterization (( 24 )) the adaptive step is
中
利用一般概率速度公式(22)可验证,此 h_adaptive 保证更新后的分布为有效 PMF。对于本文主要采用的概率去噪器参数化(式 24),自适应步长如下。
hadaptive=min⁡{ h,1−κtκ˙t }.h_{\text{\tiny adaptive}}=\min\set{h,\frac{1-\kappa_{t}}{\dot{\kappa}_{t}}}.

SOURCE PDF p.15 · A2.SS0.SSS0.Px1.p1.3
EN
With the corrector sampling (equations 26 and 51 ) we have the adaptive step:
中
若采用校正采样(式 26、51),则自适应步长如下。
h_{\text{\tiny adaptive}}=\min\set{h,\brac{\frac{\alpha_{t}\dot{\kappa}_{t}}{1-\kappa_{t}}+\frac{\beta_{t}\dot{\kappa}_{t}}{\kappa_{t}}}^{-1}}.

Conditioning. 条件化

SOURCE PDF p.15 · A2.SS0.SSS0.Px2.p1.1
EN
In our unconditional coupling (U-coupling), see ( 5 ), we define the conditioning pattern based on prefixes of random length N0<NN_{0}<N , i.e. ,
中
在我们的无条件耦合(U-coupling;原文此处引用式 5)中,条件模式按随机长度 N₀<N 的前缀定义如下。
\sI=(1,…,1⏞N0,0,…,0⏞N−N0).\sI=(\overbrace{1,\ldots,1}^{N_{0}},\overbrace{0,\ldots,0}^{N-N_{0}}).

SOURCE PDF p.15 · A2.SS0.SSS0.Px2.p1.2
EN
During the training phase, we sample N0∼U(0,N)N_{0}\sim\mathcal{U}(0,N) and adjust the input sequence in accordance with the mask \sI\sI .
中
训练阶段,采样 N0∼U(0,N)N_0\sim\mathcal U(0,N),按掩码 I 相应调整输入序列。

SOURCE PDF p.15 · A2.SS0.SSS0.Px2.p2.1
EN
During conditional sampling with Algorithm 1 we replace, after each update step, the relevant tokens with the conditioned ones, i.e. , X~=\sI⊙Y+(\one−\sI)⊙X\tilde{X}=\sI\odot Y+(\one-\sI)\odot X , where XX is the current sample, YY is the condition, and \sI\sI is the condition’s mask.
中
条件采样时,每次算法 1 更新之后,把相关词元换回给定条件,即 X~=I⊙Y+(1−I)⊙X\tilde X=I\odot Y+(\mathbf1-I)\odot X;X 是当前样本,Y 是条件,I 是条件掩码。

NFE bound. NFE 上界

SOURCE PDF p.15 · A2.SS0.SSS0.Px3.p1.1
EN
For mask modeling, i.e. , p=δ\dummyp=\delta_{\dummy} , we have seen that the probability denoiser is time-independent (see Proposition 6 ). Consequently, when sampling with Algorithm 1 and utu_{t} from ( 24 ) without corrector sampling one is not required to recompute the forward pass p1∣t(⋅∣Xt)p_{1|t}(\cdot|X_{t}) if XtX_{t} is identical to Xt−hX_{t-h} ( i.e. , no \dummy\dummy has been unmasked). This means that the NFE of Algorithm 1 in this case is bounded by the number of tokens NN .
中
对于掩码建模 p=δM,命题 6 已说明概率去噪器与时间无关。因此,用式(24)且不采用校正采样时,如果 Xₜ 与 Xₜ₋ₕ 相同,即没有 mask 被解开,则不必重新计算 p1∣t(⋅∣Xt)p_{1|t}(\cdot|X_t) 的前向传播。此时算法 1 的 NFE 上界就是词元数 N。

Post training scheduler change. 训练后改变调度器

SOURCE PDF p.15 · A2.SS0.SSS0.Px4.p1.1
EN
For a trained posterior w^t(xi∣z)\hat{w}_{t}(x^{i}|z) of a conditional probability path as in ( 9 ) with a scheduler κt\kappa_{t} , the velocity is given by equations 24 or 25 , where w^t(xi∣z)\hat{w}_{t}(x^{i}|z) is either p1∣t(xi∣z)p_{1|t}(x^{i}|z) or p0∣t(xi∣z)p_{0|t}(x^{i}|z) respectively. In this case, we can apply the velocities in equations 24 and 25 for sampling with any scheduler κt′\kappa^{\prime}_{t} , using the change of scheduler formula for posteriors,
中
若条件路径为式(9)、调度器为 κₜ,其训练好的后验为 w^t(xi∣z)\hat w_t(x^i|z),则式(24)、(25)分别给出速度,后验相应是 p₁|ₜ 或 p₀|ₜ。这时可通过下列后验调度器变换公式,使用任意新调度器 κ′ₜ 按原速度公式采样。
w^t′(xi∣z)=w^t′(xi∣z),\hat{w}_{t}^{\prime}(x^{i}|z)=\hat{w}_{t^{\prime}}(x^{i}|z),

SOURCE PDF p.15 · A2.SS0.SSS0.Px4.p1.2
EN
where w^t′(xi∣z)\hat{w}^{\prime}_{t}(x^{i}|z) , is the posterior of the scheduler κt′\kappa^{\prime}_{t} , t′=κκt′−1t^{\prime}=\kappa^{-1}_{\kappa^{\prime}_{t}} , and κ−1\kappa^{-1} is the inverse of κ\kappa . The scheduler change formula in ( 32 ) is proved in Proposition 8 . We note that by Proposition 6 , for mask modeling, i.e. , p=δ\dummyp=\delta_{\dummy} , the posterior w^t(xi∣z)\hat{w}_{t}(x^{i}|z) is time independent. Hence, in that case, the posterior is not affected by a scheduler change.
中
这里 w^t′(xi∣z)\hat w'_t(x^i|z) 是 κ′ₜ 对应的后验,t′=κ−1(κt′)t'=\kappa^{-1}(\kappa'_t),κ⁻¹ 为 κ 的逆函数。式(32)的调度器变换在命题 8 中证明。根据命题 6,掩码源 p=δM 的后验与时间无关,所以这种情形下,改变调度器不会改变后验。

Appendix C Code infilling 附录 C 代码填空

A3.F4

SOURCE PDF p.15,A3.F4

Figure 4 : Pass@1 and compiles@1 scores for the 1.5B parameter models as a function of the input masking rations on HumanEval. 图 4:HumanEval 上,原文所称 15 亿参数模型的 Pass@1、compiles@1 随输入掩码比例的变化。

SOURCE PDF p.15 · A3.p1.1
EN
We additionally evaluate the proposed method considering the task of code infilling. In which, we are provided with an input prompt that contains various spans of masked tokens, and our goal is to predict them based on the unmasked ones. See Figure 1 (middle and right sub-figures) for a visual example. Notice, this evaluation setup is the most similar to the training process.
中
我们还评估代码填空:输入提示包含若干被掩码的片段,目标是依据未被掩码的部分预测这些片段,图 1 中、右子图提供直观例子。注意,这种评估设置最接近训练过程。

SOURCE PDF p.16 · A3.p2.1
EN
For that, we randomly mask tokens with respect to several masking rations, p∈{0.0,0.1,0.2,…,1.0}p\in\{0.0,0.1,0.2,\dots,1.0\} , from HumanEval and report both pass@1 and compiles@1 metrics. For the purpose of this analysis, we provide the oracle length for each masked span. In other words, the model predicts the masked tokens for already given maks length. Results for the 1.5B parameters models can be seen in Figure 4 . As expected, both pass@1 and compiles@1 keep improving as we decrease the level of input masking. Interestingly, when considering the fully masked sequence, providing the oracle prediction length significantly improves the pass@1 scores (6.7 vs. 11.6).
中
我们按掩码比例 p∈{0.0,0.1,0.2,…,1.0}p\in\{0.0,0.1,0.2,\ldots,1.0\} 随机掩码 HumanEval 的词元,报告 Pass@1 与 compiles@1。此分析给每个掩码片段提供 oracle 长度,即模型只须预测已经给定长度的缺失词元。图 4 给出原文所称 15 亿参数模型的结果。符合预期,输入掩码比例降低时,两项指标都改善。特别是对全掩码序列,提供 oracle 预测长度显著改善了 Pass@1:6.7 对 11.6。

Appendix D Ablations 附录 D 消融实验

A4.fig1

SOURCE PDF p.16,A4.fig1

(a) Path scheduler, cubic poly. (a)路径调度器:三次多项式。

(b) Corrector scheduler t a ( 1 − t ) b . (b)校正调度器 tᵃ(1−t)ᵇ。

(c) Temperature scheduler ( 1 − t ) a . (c)温度调度器 (1−t)ᵃ。

Train and sampling path scheduler choice ( κ t ​ ). 训练与采样路径调度器选择(κₜ)

SOURCE PDF p.16 · A4.SS0.SSS0.Px1.p1.1
EN
We study how the choice of the probability path scheduler affects the model performance. For that, we consider a parametric family of cubic polynomial with parameters a,ba,b :
中
我们研究概率路径调度器的选择如何影响性能,考察由参数 a、b 控制的三次多项式族如下。
κt≜−2t3+3t2+a(t3−2t2+t)+b(t3−t2).\kappa_{t}\triangleq-2t^{3}+3t^{2}+a(t^{3}-2t^{2}+t)+b(t^{3}-t^{2}).

SOURCE PDF p.16 · A4.SS0.SSS0.Px1.p1.2
EN
Note that κ0=0\kappa_{0}=0 and κ1=0\kappa_{1}=0 and aa and bb are setting the derivative of κt\kappa_{t} at t=0t=0 and t=1t=1 , respectively. We visualize this κt\kappa_{t} with choices of a,b∈{0,1,2}a,b\in\{0,1,2\} in Figure 5(a) .
中
原文此处写 κ₀=0、κ₁=0;a、b 分别设置 κₜ 在 t=0、t=1 的导数。图 5(a) 可视化了 a,b∈{0,1,2}a,b\in\{0,1,2\} 的调度器。译注:由上方公式实际得到 κ₁=1,此处是原文端点笔误。

A4.F6

SOURCE PDF p.16,A4.F6

Figure 6 : Path scheduler choice during training using various of constant temperature values. 图 6:不同固定温度下,训练时路径调度器选择的效果。

SOURCE PDF p.16 · A4.SS0.SSS0.Px1.p2.1
EN
To test the effect of path schedulers in training we have trained 150M parameters models for all choices of a,b∈{0,1,2,3}a,b\in\{0,1,2,3\} . We then generate 1000 samples from each model. The samples are computed using Algorithm 1 with the path scheduler the model was trained on, and with temperature levels τ∈{0.8,0.9,1}\tau\in\{0.8,0.9,1\} , where temperature is applied via
中
为检验训练路径调度器的影响,我们对全部 a,b∈{0,1,2,3}a,b\in\{0,1,2,3\} 组合训练 1.5 亿参数模型,每个模型生成 1000 个样本。采样使用算法 1、与训练相同的调度器,以及 τ∈{0.8,0.9,1}\tau\in\{0.8,0.9,1\} 的温度;温度按下式作用于概率。
p1∣tτ(xi∣Xt)=τ−1log⁡p1∣t(xi∣Xt).p^{\tau}_{1|t}(x^{i}|X_{t})=\tau^{-1}\log p_{1|t}(x^{i}|X_{t}).

SOURCE PDF p.16 · A4.SS0.SSS0.Px1.p2.2
EN
We then evaluate the generative perplexity of these samples with GPT-2. Figure 6 shows the results. The graphs indicate that, in the context of text modality, the cubic polynomial scheduler with a≡0,b≡2a\equiv 0,b\equiv 2 (equivalent to a square function) achieves the highest performance. Consequently, we exclusively used this scheduler for the language models.
中
随后用 GPT-2 评估这些样本的生成困惑度,结果见图 6。文本模态下,a=0、b=2 的三次多项式调度器等价于平方函数,表现最佳。因此语言模型统一采用该调度器。

A4.F7

SOURCE PDF p.17,A4.F7

Figure 7 : Corrector scheduler ablation. 图 7:校正调度器消融。

Corrector scheduler. 校正调度器

SOURCE PDF p.16 · A4.SS0.SSS0.Px2.p1.1
EN
In our experiments we only applied corrector sampling to our large models (U-coupling and C-coupling; 1.7B parameters). We used the optimal path schedulers from previous section and considered the following parametric family of schedulers for the corrector sampling:
中
实验只对大模型(U-coupling、C-coupling,17 亿参数)采用校正采样。使用上一节最优路径调度器,并考察下列参数化的校正调度器族。
αt=1+αta(1−t)b,\alpha_{t}=1+\alpha t^{a}(1-t)^{b},

SOURCE PDF p.17 · A4.SS0.SSS0.Px2.p1.2
EN
where, we set βt=αt−1\beta_{t}=\alpha_{t}-1 and generate 1000 samples using Algorithm 1 with parameter values a,b∈{ 0,0.25,0.5 }a,b\in\set{0,0.25,0.5} and α∈{ 10,15,20 }\alpha\in\set{10,15,20} . We then evaluated generative perplexity for these samples with Llama-2, showing results in Figure 7 . These plots indicate that smaller values of aa and bb result in lower perplexity values, albeit with somewhat reduced entropy. We therefore opted for setting a=b=0.25a=b=0.25 that strikes a good balance between perplexity and entropy.
中
其中设 βₜ=αₜ−1,采用 a,b∈{0,0.25,0.5}a,b\in\{0,0.25,0.5\}、α∈{10,15,20}\alpha\in\{10,15,20\},以算法 1 生成 1000 个样本,再用 Llama-2 评估困惑度,结果见图 7。较小 a、b 对应较低困惑度,但熵也略降。因此选取 a=b=0.25,在困惑度与熵之间取得平衡。

Temperature scheduling. 温度调度

SOURCE PDF p.17 · A4.SS0.SSS0.Px3.p1.1
EN
For temperature sampling, we consider the following scheduler:
中
温度采样采用下列调度器。
τt=τ(1−t)2.\tau_{t}=\tau(1-t)^{2}.

Appendix E Theory and proofs 附录 E 理论与证明

E.1 Computation of the discrete divergence E.1 离散散度的计算

SOURCE PDF p.17 · A5.SS1.p1.1
EN
We present the computation of the discrete divergence in ( 18 ), i.e. ,
中
这里计算式(18)的离散散度,即下式。
\divvx(ptut)=−∑z∈\gDpt(z)\brac∑i=1Nδz(xiˉ)uti(xi,z).\divv_{x}(p_{t}u_{t})=-\sum_{z\in\gD}p_{t}(z)\brac{\sum_{i=1}^{N}\delta_{z}(x^{\bar{i}})u_{t}^{i}(x^{i},z)}.

SOURCE PDF p.17 · A5.SS1.p2.1
EN
Computing the discrete divergence (( 18 )) of the flux ptutp_{t}u_{t} at a state xx amounts to adding outgoing flux from xx and subtracting the incoming flux into xx . Using the fact that δz(xiˉ)=1\delta_{z}(x^{\bar{i}})=1 if and only if z=xz=x or zz differs from xx only at the ii -th token, gives:
中
计算状态 x 处通量 pₜuₜ 的离散散度(式 18),就是加上离开 x 的通量、减去进入 x 的通量。利用 δz(xiˉ)=1\delta_z(x^{\bar i})=1 当且仅当 z=x 或 z 与 x 仅在第 i 个词元不同,得到下列计算。
\divvx(ptut)=∑z∈\gD∑i=1Nδx(ziˉ)\parrpt(x)uti(zi,x)−pt(z)uti(xi,z)=pt(x)∑i=1N∑zi\brac∑ziˉδx(ziˉ)⏞=1uti(zi,x)−∑z∈\gD∑i=1Nδx(ziˉ)pt(z)uti(xi,z)=pt(x)∑i=1N\brac∑ziuti(zi,x)⏞=0−∑z∈\gD∑i=1Nδx(ziˉ)pt(z)uti(xi,z)[uses (13)]=−∑z∈\gD∑i=1Nδx(ziˉ)pt(z)uti(xi,z),\displaystyle\divv_{x}(p_{t}u_{t}) \qquad \displaystyle=\sum_{z\in\gD}\sum_{i=1}^{N}\delta_{x}(z^{\bar{i}})\parr{p_{t}(x)u^{i}_{t}(z^{i},x)-p_{t}(z)u_{t}^{i}(x^{i},z)} \qquad \displaystyle=p_{t}(x)\sum_{i=1}^{N}\sum_{z^{i}}{\color{#ff0000}\overbrace{\brac{\sum_{z^{\bar{i}}}\delta_{x}(z^{\bar{i}})}}^{=1}}u^{i}_{t}(z^{i},x)-\sum_{z\in\gD}\sum_{i=1}^{N}\delta_{x}(z^{\bar{i}})p_{t}(z)u_{t}^{i}(x^{i},z) \qquad \displaystyle=p_{t}(x)\sum_{i=1}^{N}{\color{#ff0000}\overbrace{\brac{\sum_{z^{i}}u^{i}_{t}(z^{i},x)}}^{=0}}-\sum_{z\in\gD}\sum_{i=1}^{N}\delta_{x}(z^{\bar{i}})p_{t}(z)u_{t}^{i}(x^{i},z)\quad\text{[uses (13)]} \qquad \displaystyle=-\sum_{z\in\gD}\sum_{i=1}^{N}\delta_{x}(z^{\bar{i}})p_{t}(z)u_{t}^{i}(x^{i},z),

SOURCE PDF p.18 · A5.SS1.p2.2
EN
that gives ( 37 ) after noting that δx(ziˉ)=δz(xiˉ)\delta_{x}(z^{\bar{i}})=\delta_{z}(x^{\bar{i}}) .
中
再注意 δx(ziˉ)=δz(xiˉ)\delta_x(z^{\bar i})=\delta_z(x^{\bar i}),即得到式(37)。

E.2 Conditional velocities lead to marginal velocities E.2 从条件速度到边缘速度

SOURCE PDF p.18 · A5.SS2.p1.1
EN
We provide a simple proof for Theorem 2 , originally proved in Campbell et al. (2024) : Restated theorem Given a conditional probability velocity uti(xi,Xt∣x0,x1)u_{t}^{i}(x^{i},X_{t}|x_{0},x_{1}) generating a conditional probability path pt(x∣x0,x1)p_{t}(x|x_{0},x_{1}) , the marginal velocity defined by
中
这里给出定理 2 的简短证明,该结果最早由 Campbell 等(2024)证明。重述定理:给定生成条件路径 pt(x∣x0,x1)p_t(x|x_0,x_1) 的条件概率速度 uti(xi,Xt∣x0,x1)u_t^i(x^i,X_t|x_0,x_1),下式定义的边缘速度:
uti(xi,Xt)=∑x0,x1∈\gDuti(xi,Xt∣x0,x1)pt(x0,x1∣Xt),u_{t}^{i}(x^{i},X_{t})=\sum_{x_{0},x_{1}\in\gD}u_{t}^{i}(x^{i},X_{t}|x_{0},x_{1})p_{t}(x_{0},x_{1}|X_{t}),

SOURCE PDF p.18 · A5.SS2.p1.2
EN
generates the marginal probability path pt(x)p_{t}(x) , where by Bayes’ rule
中
生成边缘概率路径 pₜ(x),其中由 Bayes 公式可得下式。
pt(x0,x1∣Xt)=pt(Xt∣x0,x1)π(x0,x1)pt(x).p_{t}(x_{0},x_{1}|X_{t})=\frac{p_{t}(X_{t}|x_{0},x_{1})\pi(x_{0},x_{1})}{p_{t}(x)}.

Proof ( Theorem 2 ). 证明(定理 2)

SOURCE PDF p.18 · A5.Thmtheorem1.p1.1
EN
We start by taking the time derivative of the marginal probability path, pt(x)=∑x0,x1pt(xi∣x0,x1)π(x0,x1)p_{t}(x)=\sum_{x_{0},x_{1}}p_{t}(x^{i}|x_{0},x_{1})\pi(x_{0},x_{1}) , as follows,
中
从边缘概率路径对时间求导开始,计算如下。原文此处写 pt(x)=∑x0,x1pt(xi∣x0,x1)π(x0,x1)p_t(x)=\sum_{x_0,x_1}p_t(x^i|x_0,x_1)\pi(x_0,x_1),其展开应按式(7)理解为联合条件路径。
p˙t(x)=∑x0,x1p˙t(x∣x0,x1)π(x0,x1)=∑x0,x1\parr∑zpt(z∣x0,x1)\brac∑i=1Nδz(xiˉ)uti(xi,z∣x0,x1)π(x0,x1)[uses (16)]=∑zpt(z)\brac∑i=1Nδz(xiˉ)\parr∑x0,x1uti(xi,z∣x0,x1)pt(z∣x0,x1)π(x0,x1)pt(z)=∑zpt(z)\brac∑i=1Nδz(xiˉ)uti(xi,z)=−\divvx(ptut)\displaystyle\dot{p}_{t}(x) \qquad \displaystyle=\sum_{x_{0},x_{1}}\dot{p}_{t}(x|x_{0},x_{1})\pi(x_{0},x_{1}) \qquad \displaystyle=\sum_{x_{0},x_{1}}\parr{\sum_{z}p_{t}(z|x_{0},x_{1})\brac{\sum_{i=1}^{N}\delta_{z}(x^{\bar{i}})u_{t}^{i}(x^{i},z|x_{0},x_{1})}}\pi(x_{0},x_{1})\quad\text{[uses (16)]} \qquad \displaystyle=\sum_{z}{\color{#0000ff}p_{t}(z)}\brac{\sum_{i=1}^{N}\delta_{z}(x^{\bar{i}})\parr{\sum_{x_{0},x_{1}}u_{t}^{i}(x^{i},z|x_{0},x_{1})\frac{p_{t}(z|x_{0},x_{1})\pi(x_{0},x_{1})}{{\color{#0000ff}p_{t}(z)}}}} \qquad \displaystyle=\sum_{z}p_{t}(z)\brac{\sum_{i=1}^{N}\delta_{z}(x^{\bar{i}})u_{t}^{i}(x^{i},z)} \qquad \displaystyle=-\divv_{x}(p_{t}u_{t})

SOURCE PDF p.18 · A5.Thmtheorem1.p1.2
EN
Now since uti(xi,z)u_{t}^{i}(x^{i},z) is a convex combinations of uti(xi,z∣x0,x1)u_{t}^{i}(x^{i},z|x_{0},x_{1}) and these satisfy ( 13 ) then also uti(xi,Xt)u_{t}^{i}(x^{i},X_{t}) satisfies ( 13 ).
中
边缘速度 uti(xi,z)u_t^i(x^i,z) 是各条件速度 uti(xi,z∣x0,x1)u_t^i(x^i,z|x_0,x_1) 的凸组合,而后者满足式(13),故 uti(xi,Xt)u_t^i(x^i,X_t) 也满足式(13)。

E.3 Probability velocities generating conditional probability paths E.3 条件路径的生成概率速度

SOURCE PDF p.19 · A5.SS3.p1.1
EN
Equation 22 with the coefficients ati,ja^{i,j}_{t} and btib^{i}_{t} are provided below,
中
下面给出式(22)及其系数 ati,ja_t^{i,j}、btib_t^i。
uti(xi,Xt∣x0,x1)=∑j=1m\bracκ˙ti,j−κti,jκ˙ti,ℓκti,ℓ⏞ati,jwj(xi∣x0,x1)+\bracκ˙ti,ℓκti,ℓ⏞btiδXt(xi),u^{i}_{t}(x^{i},X_{t}|x_{0},x_{1})=\sum_{j=1}^{m}{\color{#0000ff}\overbrace{\brac{\dot{\kappa}_{t}^{i,j}-\kappa_{t}^{i,j}\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}}}^{{\color{#000000}a^{i,j}_{t}}}}w^{j}(x^{i}|x_{0},x_{1})+{\color{#0000ff}\overbrace{\brac{\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}}}^{{\color{#000000}b^{i}_{t}}}}\delta_{X_{t}}(x^{i}),

SOURCE PDF p.19 · A5.SS3.p1.2
EN
where
中
其中系数如下。
ℓ=ℓ(i,t)\defearg min⁡j∈[m]\bracκ˙ti,j/κti,j.\ell=\ell(i,t)\defe\argmin_{j\in[m]}\brac{\dot{\kappa}_{t}^{i,j}/\kappa_{t}^{i,j}}.

SOURCE PDF p.19 · A5.SS3.p1.4
EN
[Probability velocity of conditional paths] A generating probability velocity for the conditional paths pt(x∣x0,x1)p_{t}(x|x_{0},x_{1}) defined in equations 7 and 8 is
中
重述定理 3(条件路径的概率速度):生成式(7)、(8)所定义条件概率路径 pt(x∣x0,x1)p_t(x|x_0,x_1) 的一个概率速度如下。
uti(xi,Xt∣x0,x1)=∑j=1mati,jwj(xi∣x0,x1)+btiδXt(xi),u_{t}^{i}(x^{i},X_{t}|x_{0},x_{1})=\sum_{j=1}^{m}a_{t}^{i,j}w^{j}(x^{i}|x_{0},x_{1})+b_{t}^{i}\delta_{X_{t}}(x^{i}),

SOURCE PDF p.19 · A5.SS3.p1.5
EN
with ati,j=κ˙ti,j−κti,jκ˙ti,ℓ/κti,ℓa_{t}^{i,j}=\dot{\kappa}_{t}^{i,j}-\kappa_{t}^{i,j}\dot{\kappa}_{t}^{i,\ell}/\kappa_{t}^{i,\ell} , and bti=κ˙ti,ℓ/κti,ℓb_{t}^{i}=\dot{\kappa}_{t}^{i,\ell}/\kappa_{t}^{i,\ell} where ℓ=arg min⁡j∈[m]\bracκ˙ti,j/κti,j\ell=\argmin_{j\in[m]}\brac{\dot{\kappa}_{t}^{i,j}/\kappa_{t}^{i,j}} .
中
其中 ati,j=κ˙ti,j−κti,jκ˙ti,ℓ/κti,ℓa_t^{i,j}=\dot\kappa_t^{i,j}-\kappa_t^{i,j}\dot\kappa_t^{i,\ell}/\kappa_t^{i,\ell},bti=κ˙ti,ℓ/κti,ℓb_t^i=\dot\kappa_t^{i,\ell}/\kappa_t^{i,\ell},且 ℓ=arg⁡min⁡j∈[m](κ˙ti,j/κti,j)\ell=\arg\min_{j\in[m]}(\dot\kappa_t^{i,j}/\kappa_t^{i,j})。

Proof ( Theorem 3 ). 证明(定理 3)

SOURCE PDF p.19 · A5.Thmtheorem2.p1.1
EN
First, let us show that ( 40 ) satisfies the conditions in ( 13 ): Fix Xt∈\gDX_{t}\in\gD , and
中
先证明式(40)满足式(13)的条件。固定任意 Xt∈DX_t\in\mathcal D,有下式。
∑xiuti(xi,Xt∣x0,x1)=∑xi\brac∑j=1m\bracκ˙ti,j−κti,jκ˙ti,ℓκti,ℓwj(xi∣x0,x1)+κ˙ti,ℓκti,ℓδXt(xi)=∑j=1m\bracκ˙ti,j−κti,jκ˙ti,ℓκti,ℓ+κ˙ti,ℓκti,ℓ=∑j=1mκ˙ti,j+κ˙ti,ℓκti,ℓ\parr1−∑j=1mκti,j[uses (44)]=0.\displaystyle\sum_{x^{i}}u^{i}_{t}(x^{i},X_{t}|x_{0},x_{1}) \qquad \displaystyle=\sum_{x^{i}}\brac{\sum_{j=1}^{m}\brac{\dot{\kappa}_{t}^{i,j}-\kappa_{t}^{i,j}\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}}{w}^{j}(x^{i}|x_{0},x_{1})+\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}\delta_{X_{t}}(x^{i})} \qquad \displaystyle=\sum_{j=1}^{m}\brac{\dot{\kappa}_{t}^{i,j}-\kappa_{t}^{i,j}\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}}+\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}} \qquad \displaystyle=\sum_{j=1}^{m}\dot{\kappa}^{i,j}_{t}+\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}\parr{1-\sum_{j=1}^{m}\kappa_{t}^{i,j}}\quad\text{[uses (44)]} \qquad \displaystyle=0.

SOURCE PDF p.19 · A5.Thmtheorem2.p1.2
EN
and for xi≠Xtix^{i}\neq X_{t}^{i} we have
中
对 xi≠Xtix^i\ne X_t^i,有下式。
uti(xi,Xt∣x0,x1)=∑j=1m\bracκ˙ti,jκti,j−κ˙ti,ℓκti,ℓκti,jwj(xi∣x0,x1)≥0u_{t}^{i}(x^{i},X_{t}|x_{0},x_{1})=\sum_{j=1}^{m}\brac{\frac{\dot{\kappa}_{t}^{i,j}}{\kappa_{t}^{i,j}}-\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}}\kappa_{t}^{i,j}{w}^{j}(x^{i}|x_{0},x_{1})\geq 0

SOURCE PDF p.19 · A5.Thmtheorem2.p1.3
EN
since κti,j≥0\kappa_{t}^{i,j}\geq 0 , w^t(xi∣z)≥0\hat{w}_{t}(x^{i}|z)\geq 0 , and κ˙ti,jκti,j−κ˙ti,ℓκti,ℓ≥0\frac{\dot{\kappa}_{t}^{i,j}}{\kappa_{t}^{i,j}}-\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}\geq 0 since ℓ=arg min⁡j∈[m]κ˙ti,jκti,j\ell=\argmin_{j\in[m]}\frac{\dot{\kappa}_{t}^{i,j}}{\kappa_{t}^{i,j}} . Second, we show that utu_{t} satisfies the Continuity Equation (( 16 )). To that end we write ( 8 ) as
中
因为 κti,j≥0\kappa_t^{i,j}\ge0、w^t(xi∣z)≥0\hat w_t(x^i|z)\ge0,且由 ℓ 的最小值定义,κ˙ti,j/κti,j−κ˙ti,ℓ/κti,ℓ≥0\dot\kappa_t^{i,j}/\kappa_t^{i,j}-\dot\kappa_t^{i,\ell}/\kappa_t^{i,\ell}\ge0。其次证明 uₜ 满足连续性方程(16),为此把式(8)改写如下。
wℓ(xi∣x0,x1)=1κti,ℓ\bracpt(xi∣x0,x1)−∑j≠ℓκti,jwj(xi∣x0,x1),w^{\ell}(x^{i}|x_{0},x_{1})=\frac{1}{\kappa_{t}^{i,\ell}}\brac{p_{t}(x^{i}|x_{0},x_{1})-\sum_{j\neq\ell}\kappa_{t}^{i,j}w^{j}(x^{i}|x_{0},x_{1})},

SOURCE PDF p.20 · A5.Thmtheorem2.p1.4
EN
where ℓ=arg min⁡j∈[m]κ˙ti,jκti,j\ell=\argmin_{j\in[m]}\frac{\dot{\kappa}_{t}^{i,j}}{\kappa_{t}^{i,j}} . Now by differentiating pt(x∣x0,x1)p_{t}(x|x_{0},x_{1}) we get
中
其中 ℓ=arg⁡min⁡j∈[m](κ˙ti,j/κti,j)\ell=\arg\min_{j\in[m]}(\dot\kappa_t^{i,j}/\kappa_t^{i,j})。对条件路径 pt(x∣x0,x1)p_t(x|x_0,x_1) 求导得到下式。
pt(x∣x0,x1)=∏i=1Npt(xi∣x0,x1)p˙t(x∣x0,x1)=∑i=1Npt(xiˉ∣x0,x1)p˙t(xi∣x0,x1)=∑i=1Npt(xiˉ∣x0,x1)\brac∑j=1mκ˙ti,jwj(xi∣x0,x1)=∑i=1Npt(xiˉ∣x0,x1)\brac∑j≠ℓκ˙ti,jwj(xi∣x0,x1)+κ˙ti,ℓwℓ(xi∣x0,x1)=∑i=1Npt(xiˉ∣x0,x1)\brac∑j=1m\bracκ˙ti,j−κti,jκ˙ti,ℓκti,ℓ⏞ati,jwj(xi∣x0,x1)+κ˙ti,ℓκti,ℓ⏞btipt(xi∣x0,x1)[uses (44)]=∑i=1N\brac∑j=1mati,j\brac∑zδx(ziˉ)pt(z∣x0,x1)⏞=pt(xiˉ∣x0,x1)wj(xi∣x0,x1)+bti\brac∑zδx(ziˉ)δx(zi)pt(z∣x0,x1)⏞=pt(x∣x0,x1)=∑zpt(z∣x0,x1)∑i=1Nδx(ziˉ)\brac∑j=1mati,jwj(xi∣x0,x1)+btiδx(zi)⏞uti(xi,z∣x0,x1)[normalization]=−\divvx(pt(⋅∣x0,x1)ut(⋅∣x0,x1)),\displaystyle p_{t}(x|x_{0},x_{1}) \qquad \displaystyle=\prod_{i=1}^{N}p_{t}(x^{i}|x_{0},x_{1}) \qquad \displaystyle\dot{p}_{t}(x|x_{0},x_{1}) \qquad \displaystyle=\sum_{i=1}^{N}p_{t}(x^{\bar{i}}|x_{0},x_{1})\dot{p}_{t}(x^{i}|x_{0},x_{1}) \qquad \displaystyle=\sum_{i=1}^{N}p_{t}(x^{\bar{i}}|x_{0},x_{1})\brac{\sum_{j=1}^{m}\dot{\kappa}_{t}^{i,j}w^{j}(x^{i}|x_{0},x_{1})} \qquad \displaystyle=\sum_{i=1}^{N}p_{t}(x^{\bar{i}}|x_{0},x_{1})\brac{\sum_{j\neq\ell}\dot{\kappa}_{t}^{i,j}w^{j}(x^{i}|x_{0},x_{1})+\dot{\kappa}_{t}^{i,\ell}w^{\ell}(x^{i}|x_{0},x_{1})} \qquad \displaystyle=\sum_{i=1}^{N}p_{t}(x^{\bar{i}}|x_{0},x_{1})\brac{\sum_{j=1}^{m}{\color{#ff0000}\overbrace{{\color{#000000}\brac{\dot{\kappa}_{t}^{i,j}-\kappa_{t}^{i,j}\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}}}}^{a_{t}^{i,j}}}w^{j}(x^{i}|x_{0},x_{1})+{\color{#ff0000}\overbrace{{\color{#000000}\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}}}^{b_{t}^{i}}}p_{t}(x^{i}|x_{0},x_{1})}\quad\text{[uses (44)]} \qquad \displaystyle=\sum_{i=1}^{N}\brac{\sum_{j=1}^{m}a_{t}^{i,j}{\color{#ff0000}\overbrace{{\color{#000000}\brac{\sum_{z}\delta_{x}(z^{\bar{i}})p_{t}(z|x_{0},x_{1})}}}^{=p_{t}(x^{\bar{i}}|x_{0},x_{1})}}w^{j}(x^{i}|x_{0},x_{1})+b_{t}^{i}{\color{#ff0000}\overbrace{{\color{#000000}\brac{\sum_{z}\delta_{x}(z^{\bar{i}})\delta_{x}(z^{i})p_{t}(z|x_{0},x_{1})}}}^{=p_{t}(x|x_{0},x_{1})}}} \qquad \displaystyle=\sum_{z}{\color{#0000ff}p_{t}(z|x_{0},x_{1})}\sum_{i=1}^{N}\delta_{x}(z^{\bar{i}}){\color{#ff0000}\overbrace{{\color{#000000}\brac{\sum_{j=1}^{m}a_{t}^{i,j}w^{j}(x^{i}|x_{0},x_{1})+b_{t}^{i}\delta_{x}(z^{i})}}}^{u_{t}^{i}(x^{i},z|x_{0},x_{1})}}\quad\quad\text{[normalization]} \qquad \displaystyle=-\divv_{x}(p_{t}(\cdot|x_{0},x_{1})u_{t}(\cdot|x_{0},x_{1})),

SOURCE PDF p.20 · A5.Thmtheorem2.p1.5
EN
as required.
中
这正是所需结论。

E.4 Backward-time generating probability velocity. E.4 反向时间生成概率速度

SOURCE PDF p.20 · A5.SS4.p1.1
EN
Here we prove the equivalent of Theorem 3 for backward-time generating probability field. But first, let us justify the backward sampling formula,
中
这里证明定理 3 对反向时间概率场的对应结论。先说明下列反向采样公式的合理性。
Xt−hi∼δXti(⋅)−huti(⋅,Xt).X_{t-h}^{i}\sim\delta_{X_{t}^{i}}(\cdot)-hu_{t}^{i}(\cdot,X_{t}).

SOURCE PDF p.20 · A5.SS4.p1.2
EN
Similar to ( 20 ) we have
中
类似式(20),有下式。
\EXt∏i=1N\bracδXt(xi)−huti(xi,Xt)=\EXt\bracδXt(x)−h∑i=1NδXt(xiˉ)uti(xi,Xt)+o(h)=pt(x)+h\divvx(ptut)+o(h)=(16)pt(x)−hp˙t(x)+o(h)=pt−h(x)+o(h).\displaystyle\E_{X_{t}}\prod_{i=1}^{N}\brac{\delta_{X_{t}}(x^{i})-hu_{t}^{i}(x^{i},X_{t})}=\E_{X_{t}}\brac{\delta_{X_{t}}(x)-h\sum_{i=1}^{N}\delta_{X_{t}}(x^{\bar{i}})u^{i}_{t}(x^{i},X_{t})}+o(h) \qquad \displaystyle=p_{t}(x)+h\divv_{x}(p_{t}u_{t})+o(h){\color{#ff0000}\overset{(16)}{=}}p_{t}(x)-h\dot{p}_{t}(x)+o(h)=p_{t-h}(x)+o(h).

SOURCE PDF p.20 · A5.SS4.p1.3
EN
Therefore if the Continuity equation holds and −ut-u_{t} satisfies the conditions in ( 13 ) then given Xt∼ptX_{t}\sim p_{t} , ( 45 ) provides an approximation Xt−h∼pt−h+o(h)X_{t-h}\sim p_{t-h}+o(h) . The change to the generating probability velocity in ( 22 ) to accommodate reverse time sampling is to replace the argmin in ( 41 ) with argmax,
中
所以若连续性方程成立且 −uₜ 满足式(13),则给定 Xt∼ptX_t\sim p_t,式(45)近似产生 Xt−h∼pt−h+o(h)X_{t-h}\sim p_{t-h}+o(h)。要让式(22)的生成概率速度用于反向采样,只须将式(41)的 argmin 改为 argmax。
ℓ=ℓ(i,t)≜arg max⁡j∈[m]\bracκ˙ti,j/κti,j.\ell=\ell(i,t)\triangleq\argmax_{j\in[m]}\brac{\dot{\kappa}_{t}^{i,j}/\kappa_{t}^{i,j}}.

SOURCE PDF p.20 · A5.SS4.p1.4
EN
An analogous result to Theorem 3 for backward-time sampling is therefore,
中
由此得到与定理 3 对应的反向时间采样结论。

Theorem 7 (Probability velocity of conditional paths, backward time) . 定理 7(反向条件路径概率速度)

SOURCE PDF p.21 · A5.Thmtheorem3.p1.1
EN
The probability velocity −ut-u_{t} , where utu_{t} defined in ( 21 ) with ℓ=arg max⁡j∈[m]\bracκ˙ti,j/κti,j\ell=\argmax_{j\in[m]}\brac{\dot{\kappa}_{t}^{i,j}/\kappa_{t}^{i,j}} is a backward-time generating probability velocity for the conditional paths pt(x∣x0,x1)p_{t}(x|x_{0},x_{1}) defined in equations 7 and 8 .
中
在式(21)中取 ℓ=arg⁡max⁡j∈[m](κ˙ti,j/κti,j)\ell=\arg\max_{j\in[m]}(\dot\kappa_t^{i,j}/\kappa_t^{i,j}) 所得 uₜ,其相反数 −uₜ 是式(7)、(8)定义的条件路径 pt(x∣x0,x1)p_t(x|x_0,x_1) 的反向时间生成概率速度。

Proof ( Theorem 7 ). 证明(定理 7)

SOURCE PDF p.21 · A5.Thmtheorem4.p1.1
EN
We follow the proof of Theorem 3 and indicate the relevant changes. First, for arbitrary Xt∈\gDX_{t}\in\gD ,
中
沿用定理 3 的证明,仅说明需要修改之处。首先,对任意 Xt∈DX_t\in\mathcal D,有下式。
∑xiuti(xi,Xt)=0,\sum_{x^{i}}u_{t}^{i}(x^{i},X_{t})=0,

SOURCE PDF p.21 · A5.Thmtheorem4.p1.2
EN
exactly using the same arguments as the forward-time case. Now, for xi≠Xtix^{i}\neq X_{t}^{i} we have
中
此处所用论证与前向时间完全相同。再对 xi≠Xtix^i\ne X_t^i 考察下式。
uti(xi,Xt∣x0,x1)=∑j=1m\bracκ˙ti,jκti,j−κ˙ti,ℓκti,ℓκti,jwtj(xi∣x0,x1)≤0u_{t}^{i}(x^{i},X_{t}|x_{0},x_{1})=\sum_{j=1}^{m}\brac{\frac{\dot{\kappa}_{t}^{i,j}}{\kappa_{t}^{i,j}}-\frac{\dot{\kappa}_{t}^{i,\ell}}{\kappa_{t}^{i,\ell}}}\kappa_{t}^{i,j}w_{t}^{j}(x^{i}|x_{0},x_{1})\leq 0

SOURCE PDF p.21 · A5.Thmtheorem4.p1.3
EN
due to ℓ\ell being now the argmax of κ˙ti,jκti,j\frac{\dot{\kappa}_{t}^{i,j}}{\kappa_{t}^{i,j}} . Therefore −ut-u_{t} satisfies ( 13 ). Lastly, we notice that the proof of the Continuity Equation follows through exactly the same also in this case.
中
因为此时 ℓ 使 κ˙ti,j/κti,j\dot\kappa_t^{i,j}/\kappa_t^{i,j} 最大,所以 −uₜ 满足式(13)。最后,连续性方程的证明仍然逐步成立,不需其他改动。

E.5 Backward-time generating velocity for i.i.d. source p ( x 0 ​ ) and simple paths E.5 独立同分布源与简单路径的反向速度

SOURCE PDF p.21 · A5.SS5.p1.1
EN
Here we consider the case of probability paths defined via the conditionals in ( 9 ) with independent coupling π(x0,x1)=p(x0)q(x1)\pi(x_{0},x_{1})=p(x_{0})q(x_{1}) and i.i.d. source distribution p(x0)=∏i=1Np(x0i)p(x_{0})=\prod_{i=1}^{N}p(x_{0}^{i}) , where p(x0i)p(x_{0}^{i}) is some PMF over [d][d] . In this case one can simplify the time-backward sampling formula in ( 25 ) by using the following one which is equivalent ( i.e. , their difference is divergence free and consequently generate the same probability path ptp_{t} ):
中
这里考虑由式(9)条件分布定义的路径,使用独立耦合 π(x0,x1)=p(x0)q(x1)\pi(x_0,x_1)=p(x_0)q(x_1),且源分布独立同分布 p(x0)=∏ip(x0i)p(x_0)=\prod_i p(x_0^i),每个分量是 [d] 上某个 PMF。此时可用下列等价公式简化式(25)的反向采样;“等价”指二者的差是无散的,因此生成相同的概率路径 pₜ。
uˇt(xi,Xt)=κ˙tκt\bracδXt(xi)−p(xi).\check{u}_{t}(x^{i},X_{t})=\frac{\dot{\kappa}_{t}}{\kappa_{t}}\brac{\delta_{X_{t}}(x^{i})-p(x^{i})}.

SOURCE PDF p.21 · A5.SS5.p1.2
EN
The benefit in this equation is that it does not require the posterior p0∣tp_{0|t} , which needs to be learned in general cases.
中
该公式的好处是不需要通常必须学习的后验 p₀|ₜ。

SOURCE PDF p.21 · A5.SS5.p2.1
EN
To show that ( 49 ) is indeed a generating probability velocity it is enough to show that
中
要证明式(49)确实是生成概率速度,只需证明下式。
\divvx\bracpt\parruˇt−uˇt⋆=0,\divv_{x}\brac{p_{t}\parr{\check{u}_{t}-\check{u}^{\star}_{t}}}=0,

SOURCE PDF p.21 · A5.SS5.p2.2
EN
where uˇt⋆\check{u}^{\star}_{t} is the probability velocity in ( 25 ). Let us verify using ( 19 ):
中
其中 uˇt⋆\check u_t^\star 是式(25)的概率速度。使用式(19)验证如下。
\divvx\bracpt\parruˇt−uˇt⋆=∑i,zpt(z)δz(xiˉ)\bracp(xi)−∑x0,x1δx0(xi)pt(z∣x0,x1)p(x0)q(x1)pt(z)[normalization]=∑i,zδz(xiˉ)\bracp(xi)pt(z)−∑x0,x1δx0(xi)pt(z∣x0,x1)p(x0)q(x1)=∑i,x0,x1\bracp(xi)−δx0(xi)\parr∑zδz(xiˉ)pt(z∣x0,x1)p(x0)q(x1)=∑i,x0,x1\bracp(xi)−δx0(xi)pt(xiˉ∣x0,x1)p(x0iˉ)p(x0i)q(x1)=∑i,x0iˉ,x1\parr∑x0i\bracp(xi)p(x0i)−δx0(xi)p(x0i)pt(xiˉ∣x0,x1)p(x0iˉ)q(x1)=0,\displaystyle\divv_{x}\brac{p_{t}\parr{\check{u}_{t}-\check{u}^{\star}_{t}}} \qquad \displaystyle=\sum_{i,z}p_{t}(z)\delta_{z}(x^{\bar{i}})\brac{p(x^{i})-\sum_{x_{0},x_{1}}\delta_{x_{0}}(x^{i})\frac{p_{t}(z|x_{0},x_{1})p(x_{0})q(x_{1})}{p_{t}(z)}}\quad\text{[normalization]} \qquad \displaystyle=\sum_{i,z}\delta_{z}(x^{\bar{i}})\brac{p(x^{i})p_{t}(z)-\sum_{x_{0},x_{1}}\delta_{x_{0}}(x^{i})p_{t}(z|x_{0},x_{1})p(x_{0})q(x_{1})} \qquad \displaystyle=\sum_{i,x_{0},x_{1}}\brac{p(x^{i})-\delta_{x_{0}}(x^{i})}\parr{\sum_{z}\delta_{z}(x^{\bar{i}})p_{t}(z|x_{0},x_{1})}p(x_{0})q(x_{1}) \qquad \displaystyle=\sum_{i,x_{0},x_{1}}\brac{p(x^{i})-\delta_{x_{0}}(x^{i})}p_{t}(x^{\bar{i}}|x_{0},x_{1})p(x^{\bar{i}}_{0})p(x_{0}^{i})q(x_{1}) \qquad \displaystyle=\sum_{i,x_{0}^{\bar{i}},x_{1}}\parr{\sum_{x_{0}^{i}}\brac{p(x^{i})p(x_{0}^{i})-\delta_{x_{0}}(x^{i})p(x_{0}^{i})}}p_{t}(x^{\bar{i}}|x_{0},x_{1})p(x^{\bar{i}}_{0})q(x_{1}) \qquad \displaystyle=0,

SOURCE PDF p.21 · A5.SS5.p2.3
EN
where in the second to last equality we used the fact that the paths we are considering have the form: pt(xiˉ∣x0,x1)=∏j∈[N]∖i\bracκtδx1(xj)+(1−κt)δx0(xj)p_{t}(x^{\bar{i}}|x_{0},x_{1})=\prod_{j\in[N]\setminus i}\brac{\kappa_{t}\delta_{x_{1}}(x^{j})+(1-\kappa_{t})\delta_{x_{0}}(x^{j})} , and therefore do not depend on the ii -th source token, x0ix_{0}^{i} .
中
倒数第二个等号利用了此处路径的乘积形式:pt(xiˉ∣x0,x1)=∏j≠i[κtδx1(xj)+(1−κt)δx0(xj)]p_t(x^{\bar i}|x_0,x_1)=\prod_{j\ne i}[\kappa_t\delta_{x_1}(x^j)+(1-\kappa_t)\delta_{x_0}(x^j)],因而不依赖源端第 i 个词元 x0ix_0^i。

E.6 Corrector steps E.6 校正步骤

SOURCE PDF p.22 · A5.SS6.p1.2
EN
For perfectly trained posteriors and αt,βt>0\alpha_{t},\beta_{t}>0 , t∈(0,1)t\in(0,1) , uˉt\bar{u}_{t} in ( 26 ) is a probability velocity, i.e. , satisfies ( 13 ), and: (i) For αt−βt=1\alpha_{t}-\beta_{t}=1 , uˉt\bar{u}_{t} provides a probability velocity generating ptp_{t} ; (ii) For αt−βt=0\alpha_{t}-\beta_{t}=0 , repeatedly sampling with uˉt\bar{u}_{t} at fixed t∈(0,1)t\in(0,1) and sufficiently small hh is guaranteed to converge to a sample from ptp_{t} .
中
重述定理 4:对于完全训练好的后验,若 αₜ、βₜ>0 且 t∈(0,1)t\in(0,1),式(26)的 uˉt\bar u_t 满足式(13);(i)αₜ−βₜ=1 时生成 pₜ;(ii)αₜ−βₜ=0 时,在固定 t、足够小 h 下反复采样,保证收敛至服从 pₜ 的样本。

Proof ( Theorem 4 ). 证明(定理 4)

SOURCE PDF p.22 · A5.Thmtheorem5.p1.1
EN
First let us write explicitly uˉt\bar{u}_{t} from ( 26 ):
中
首先将式(26)的 uˉt\bar u_t 显式写成下式。
uˉti(xi,Xt)=αtu^ti(xi,Xt)−βtuˇti(xi,Xt)=αtκ˙t1−κtp1∣t(xi∣Xt)+βtκ˙tκtp0∣1(xi∣Xt)−\bracαtκ˙t1−κt+βtκ˙tκtδXt(xi).\displaystyle\bar{u}_{t}^{i}(x^{i},X_{t}) \qquad \displaystyle=\alpha_{t}\hat{u}_{t}^{i}(x^{i},X_{t})-\beta_{t}\check{u}_{t}^{i}(x^{i},X_{t}) \qquad \displaystyle={\color{#000000}\frac{\alpha_{t}\dot{\kappa}_{t}}{1-\kappa_{t}}p_{1|t}(x^{i}|X_{t})+\frac{\beta_{t}\dot{\kappa}_{t}}{\kappa_{t}}p_{0|1}(x^{i}|X_{t})-\brac{\frac{\alpha_{t}\dot{\kappa}_{t}}{1-\kappa_{t}}+\frac{\beta_{t}\dot{\kappa}_{t}}{\kappa_{t}}}\delta_{X_{t}}(x^{i})}.

SOURCE PDF p.22 · A5.Thmtheorem5.p1.2
EN
Since ( 51 ) is a sum of PMFs with coefficients that sum up to zero the first condition in ( 13 ), i.e. , ∑xiuˉti(xi,Xt)=0\sum_{x^{i}}\bar{u}^{i}_{t}(x^{i},X_{t})=0 holds. The second condition in ( 13 ) holds since for t∈(0,1)t\in(0,1) we have αtκ˙t1−κt,βtκ˙tκt≥0\frac{\alpha_{t}\dot{\kappa}_{t}}{1-\kappa_{t}},\frac{\beta_{t}\dot{\kappa}_{t}}{\kappa_{t}}\geq 0 . Now,
中
式(51)是若干 PMF 的线性组合,其系数之和为零,因此式(13)的第一条件 ∑xiuˉti(xi,Xt)=0\sum_{x^i}\bar u_t^i(x^i,X_t)=0 成立。第二条件也成立,因为 t∈(0,1)t\in(0,1) 时,αtκ˙t/(1−κt)\alpha_t\dot\kappa_t/(1-\kappa_t) 与 βtκ˙t/κt\beta_t\dot\kappa_t/\kappa_t 都非负。接下来有下式。
\divvx(ptuˉt)=αt\divvx(ptu^t)−βt\divvx(ptuˇt)[normalization]=−αtp˙t(x)+βtp˙t(x)      [uses (16)]=−(αt−βt)p˙t(x).\displaystyle\divv_{x}(p_{t}\bar{u}_{t}) \qquad \displaystyle=\alpha_{t}\divv_{x}(p_{t}\hat{u}_{t})-\beta_{t}\divv_{x}(p_{t}\check{u}_{t})\qquad\quad\text{[normalization]} \qquad \displaystyle=-\alpha_{t}\dot{p}_{t}(x)+\beta_{t}\dot{p}_{t}(x)\qquad\qquad\quad\ \ \ \ \ \ \quad\text{[uses (16)]} \qquad \displaystyle=-(\alpha_{t}-\beta_{t})\dot{p}_{t}(x).

SOURCE PDF p.22 · A5.Thmtheorem5.p2.1
EN
For (i): Using ( 52 ) with αt−βt=1\alpha_{t}-\beta_{t}=1 we get that
中
对于(i),将 αₜ−βₜ=1 代入式(52),得到下式。
\divvx(ptuˉt)=−p˙t(x),\divv_{x}(p_{t}\bar{u}_{t})=-\dot{p}_{t}(x),

SOURCE PDF p.22 · A5.Thmtheorem5.p2.3
EN
, uˉt\bar{u}_{t} satisfies the continuity equation and therefore generates ptp_{t} .
中
因此 uˉt\bar u_t 满足连续性方程,进而生成 pₜ。

SOURCE PDF p.22 · A5.Thmtheorem5.p3.1
EN
For (ii): Setting αt−βt=0\alpha_{t}-\beta_{t}=0 in ( 52 ) we get \divvx(ptuˉt)=0\divv_{x}(p_{t}\bar{u}_{t})=0 and therefore similar to ( 20 ) we have
中
对于(ii),将 αₜ−βₜ=0 代入式(52),得到 div⁡x(ptuˉt)=0\operatorname{div}_x(p_t\bar u_t)=0,因此类似式(20)可得下式。
pt(x)=pt(x)−h\divvx(ptuˉt)=\EXt\bracδXt(x)+h∑i=1NδXt(xiˉ)uˉti(xi,Xt)=∑zp(x∣z)pt(z),\displaystyle p_{t}(x) \qquad \displaystyle=p_{t}(x)-h\divv_{x}(p_{t}\bar{u}_{t}) \qquad \displaystyle=\E_{X_{t}}\brac{\delta_{X_{t}}(x)+h\sum_{i=1}^{N}\delta_{X_{t}}(x^{\bar{i}})\bar{u}^{i}_{t}(x^{i},X_{t})} \qquad \displaystyle=\sum_{z}p(x|z)p_{t}(z),

SOURCE PDF p.22 · A5.Thmtheorem5.p3.2
EN
where using ( 51 ) we have
中
其中利用式(51),有下式。
p(x∣z)=h∑i=1Nαtκ˙t1−κtδz(xiˉ)p1∣t(xi∣z)+h∑i=1Nβtκ˙tκtδz(xiˉ)p0∣1(xi∣z)+\parr1−h∑i=1N\bracαtκ˙t1−κt+βtκ˙tκtδz(xi).\displaystyle p(x|z) \qquad \displaystyle=h\sum_{i=1}^{N}\frac{\alpha_{t}\dot{\kappa}_{t}}{1-\kappa_{t}}{\color{#ff0000}\delta_{z}(x^{\bar{i}})p_{1|t}(x^{i}|z)}+h\sum_{i=1}^{N}\frac{\beta_{t}\dot{\kappa}_{t}}{\kappa_{t}}{\color{#ff0000}\delta_{z}(x^{\bar{i}})p_{0|1}(x^{i}|z)} \qquad \displaystyle+\parr{1-h\sum_{i=1}^{N}\brac{\frac{\alpha_{t}\dot{\kappa}_{t}}{1-\kappa_{t}}+\frac{\beta_{t}\dot{\kappa}_{t}}{\kappa_{t}}}}{\color{#ff0000}\delta_{z}(x^{i})}.

SOURCE PDF p.22 · A5.Thmtheorem5.p3.3
EN
For sufficiently small h>0h>0 therefore p(x∣z)p(x|z) is a convex combination of PMFs (in red) xx and consequently is itself a PMF in xx , that is p(x∣z)p(x|z) is a probability transition matrix, and pt(x)p_{t}(x) is its stationary distribution, i.e. , it is an eigenvector of p(x∣z)p(x|z) with eigenvalue 11 , which is maximal. To prove convergence of the iterations in ( 53 ) we are left with showing that p(x∣z)p(x|z) is irreducible and a-periodic, see Norris (1998) (Theorem 1.8.3). Irreducibly of p(x∣z)p(x|z) can be shown by connecting each two states z,z′z,z^{\prime} by changing one token at a time, and assuming that p1∣tp_{1|t} or p0∣tp_{0|t} are strictly positive (which is usually the case since as at-least one of them is defined as soft-max of finite logits); a-periodicity is proved by showing p(x∣x)>0p(x|x)>0 which is true as the coefficient of δz(x)\delta_{z}(x) is greater than zero for sufficiently small h>0h>0 . Lastly, note that the iteration in ( 53 ) changes one token at a time. An approximation to this sampling can be achieved using our standard parallel sampling via ( 12 ), justified by ( 20 ).
中
当 h>0 足够小时,p(x|z) 是各个 PMF(原式红色部分)的凸组合,因而本身也是关于 x 的 PMF。于是 p(x|z) 是概率转移矩阵,pₜ(x) 为其平稳分布,即对应最大特征值 1 的特征向量。为证明式(53)的迭代收敛,还需证明转移矩阵不可约、非周期,见 Norris(1998)定理 1.8.3。若假设 p₁|ₜ 或 p₀|ₜ 严格为正,可通过每次改变一个词元连接任意状态 z、z′,从而说明不可约;通常至少一个后验由有限 logits 的 softmax 定义,满足此正性。充分小 h 时 δz(x) 的系数大于零,所以 p(x|x)>0,证明非周期性。最后,式(53)每次只改变一个词元;可以用标准并行采样式(12)近似,式(20)为该近似提供依据。

E.7 Training E.7 训练

SOURCE PDF p.23 · A5.SS7.p1.2
EN
The minimizer of \gL\gL (( 28 )) is w^tj(xi∣Xt)\hat{w}_{t}^{j}(x^{i}|X_{t}) (( 23 )).
中
重述命题 5:损失 L(式 28)的极小化解是式(23)的后验 w^tj(xi∣Xt)\hat w_t^j(x^i|X_t)。

Proof ( Proposition 5 ). 证明(命题 5)

SOURCE PDF p.23 · A5.Thmtheorem6.p1.1
EN
It is enough to prove the claim for m=1m=1 , with a single w(xi∣x0,x1)w(x^{i}|x_{0},x_{1}) .
中
只需证明 m=1、即只有一个 w(xi∣x0,x1)w(x^i|x_0,x_1) 时的结论。
\gL(θ)=−1N∑i=1N\Et∑x0,x1,z,yilog⁡w^t(yi∣z;θ)w(yi∣x0,x1)pt(z∣x0,x1)π(x0,x1)=−1N∑i=1N\Et∑zpt(z)\brac∑yilog⁡w^t(yi∣z;θ)\parr∑x0,x1w(yi∣x0,x1)pt(z∣x0,x1)π(x0,x1)pt(z)=−\Et,Xt1N∑i=1N\brac∑yilog⁡w^t(yi∣Xt;θ)w^t(yi∣Xt),\displaystyle\gL(\theta) \qquad \displaystyle=-\frac{1}{N}\sum_{i=1}^{N}\E_{t}\sum_{x_{0},x_{1},z,y^{i}}\log\hat{w}_{t}(y^{i}|z;\theta)w(y^{i}|x_{0},x_{1})p_{t}(z|x_{0},x_{1})\pi(x_{0},x_{1}) \qquad \displaystyle=-\frac{1}{N}\sum_{i=1}^{N}\E_{t}\sum_{z}{\color{#0000ff}p_{t}(z)}\brac{\sum_{y^{i}}\log\hat{w}_{t}(y^{i}|z;\theta)\parr{\sum_{x_{0},x_{1}}w(y^{i}|x_{0},x_{1})\frac{p_{t}(z|x_{0},x_{1})\pi(x_{0},x_{1})}{{\color{#0000ff}p_{t}(z)}}}} \qquad \displaystyle=-\E_{t,X_{t}}\frac{1}{N}\sum_{i=1}^{N}\brac{\sum_{y^{i}}\log\hat{w}_{t}(y^{i}|X_{t};\theta)\hat{w}_{t}(y^{i}|X_{t})},

SOURCE PDF p.23 · A5.Thmtheorem6.p1.2
EN
that amounts to minimizing the Cross Entropy loss between w^t(xi∣Xt;θ)\hat{w}_{t}(x^{i}|X_{t};\theta) and w^t(xi∣Xt)\hat{w}_{t}(x^{i}|X_{t}) for all i∈[N]i\in[N] , the minimizer of which satisfies w^t(xi∣Xt;θ)≡w^t(xi∣Xt)\hat{w}_{t}(x^{i}|X_{t};\theta)\equiv\hat{w}_{t}(x^{i}|X_{t}) .
中
上述计算等价于对所有 i 最小化 w^t(xi∣Xt;θ)\hat w_t(x^i|X_t;\theta) 与 w^t(xi∣Xt)\hat w_t(x^i|X_t) 之间的交叉熵,极小化解满足 w^t(xi∣Xt;θ)≡w^t(xi∣Xt)\hat w_t(x^i|X_t;\theta)\equiv\hat w_t(x^i|X_t)。

E.8 Time-independent posterior for masked modeling E.8 掩码模型中与时间无关的后验

SOURCE PDF p.23 · A5.SS8.p1.2
EN
For paths defined by equations 7 and 9 with source p(x)=δ\dummy(x)p(x)=\delta_{\dummy}(x) the posterior pt(x0,x1∣z)=p(x0,x1∣z)p_{t}(x_{0},x_{1}|z)=p(x_{0},x_{1}|z) is time-independent. Consequently, the probability denoiser p1∣t(xi∣z)=p1(xi∣z)p_{1|t}(x^{i}|z)=p_{1}(x^{i}|z) is also time-independent.
中
重述命题 6:对式(7)、(9)定义且源分布为 p(x)=δM(x)p(x)=\delta_M(x) 的路径,端点后验 pt(x0,x1∣z)=p(x0,x1∣z)p_t(x_0,x_1|z)=p(x_0,x_1|z) 与时间无关;因此概率去噪器 p1∣t(xi∣z)=p1(xi∣z)p_{1|t}(x^i|z)=p_1(x^i|z) 也与时间无关。

Proof ( Proposition 6 ). 证明(命题 6)

SOURCE PDF p.23 · A5.Thmtheorem7.p1.1
EN
First,
中
首先有下式。
pt(zi∣x0,x1)=(1−κt)δ\dummy(zi)+κtδx1(zi)={(1−κt)zi=\dummyκtδx1(zi)zi≠\dummyp_{t}(z^{i}|x_{0},x_{1})=(1-\kappa_{t})\delta_{\dummy}(z^{i})+\kappa_{t}\delta_{x_{1}}(z^{i})=\begin{cases}(1-\kappa_{t})&z^{i}=\dummy\\ \kappa_{t}\delta_{x_{1}}(z^{i})&z^{i}\neq\dummy\end{cases}

SOURCE PDF p.23 · A5.Thmtheorem7.p1.2
EN
and therefore
中
因此可得下式。
pt(z∣x0,x1)=\brac∏i:zi=\dummy(1−κt)∏i:zi≠\dummyκt∏i:zi≠\dummyδx1(zi).p_{t}(z|x_{0},x_{1})=\brac{\prod_{i:z^{i}=\dummy}(1-\kappa_{t})\prod_{i:z^{i}\neq\dummy}\kappa_{t}}\prod_{i:z^{i}\neq\dummy}\delta_{x_{1}}(z^{i}).

SOURCE PDF p.23 · A5.Thmtheorem7.p1.3
EN
The posterior now gives
中
后验由此给出下式。
pt(z∣x0,x1)π(x0,x1)pt(z)=\brac∏i=1Npt(zi∣x0,x1)π(x0,x1)∑x~0,x~1\brac∏j=1Npt(zj∣x~0,x~1)π(x~0,x~1)=\brac∏i:zi=\dummy(1−κt)∏i:zi≠\dummyκt\brac∏i:zi≠\dummyδx1(zi)π(x0,x1)∑x~0,x~1\brac∏j:zj=\dummy(1−κt)∏j:zj≠\dummyκt\brac∏j:zj≠\dummyδx~1(zj)π(x~0,x~1)=p(x0,x1∣z).\displaystyle\frac{p_{t}(z|x_{0},x_{1})\pi(x_{0},x_{1})}{p_{t}(z)} \qquad \displaystyle=\frac{\brac{\prod_{i=1}^{N}p_{t}(z^{i}|x_{0},x_{1})}\pi(x_{0},x_{1})}{\sum_{\tilde{x}_{0},\tilde{x}_{1}}\brac{\prod_{j=1}^{N}p_{t}(z^{j}|\tilde{x}_{0},\tilde{x}_{1})}\pi(\tilde{x}_{0},\tilde{x}_{1})} \qquad \displaystyle=\frac{{\color{#ff0000}\cancel{{\color{#000000}\brac{\prod_{i:z^{i}=\dummy}(1-\kappa_{t})\prod_{i:z^{i}\neq\dummy}\kappa_{t}}}}}\brac{\prod_{i:z^{i}\neq\dummy}\delta_{x_{1}}(z^{i})}\pi(x_{0},x_{1})}{\sum_{\tilde{x}_{0},\tilde{x}_{1}}{\color{#ff0000}\cancel{{\color{#000000}\brac{\prod_{j:z^{j}=\dummy}(1-\kappa_{t})\prod_{j:z^{j}\neq\dummy}\kappa_{t}}}}}\brac{\prod_{j:z^{j}\neq\dummy}\delta_{\tilde{x}_{1}}(z^{j})}\pi(\tilde{x}_{0},\tilde{x}_{1})} \qquad \displaystyle=p(x_{0},x_{1}|z).

SOURCE PDF p.23 · A5.Thmtheorem7.p1.4
EN
showing that the posterior is time-independent for dummy source distributions and convex paths. Consequently also the probability denoiser,
中
这表明,对 dummy 源分布和凸路径,后验与时间无关。因此概率去噪器也如下式。
p1∣t(xi∣z)=∑x0,x1δx1(xi)pt(z∣x0,x1)π(x0,x1)pt(z)=∑x0,x1δx1(xi)p(x0,x1∣z),\displaystyle p_{1|t}(x^{i}|z) \qquad \displaystyle=\sum_{x_{0},x_{1}}\delta_{x_{1}}(x^{i})\frac{p_{t}(z|x_{0},x_{1})\pi(x_{0},x_{1})}{p_{t}(z)}=\sum_{x_{0},x_{1}}\delta_{x_{1}}(x^{i})p(x_{0},x_{1}|z),

SOURCE PDF p.23 · A5.Thmtheorem7.p1.5
EN
is time-independent.
中
同样与时间无关。

E.9 Continuous Flow Matching E.9 连续流匹配

SOURCE PDF p.24 · A5.SS9.p1.1
EN
For completeness we provide the formulas for denoiser ( xx -prediction) and noise-prediction ( \eps\eps -prediction) parameterizations of the generating velocity field u:[0,1]×\RealN\too\RealNu:[0,1]\times\Real^{N}\too\Real^{N} appearing in Table 1 .
中
为完整起见,这里给出表 1 中生成速度场 u:[0,1]×RN→RNu:[0,1]\times\mathbb R^N\to\mathbb R^N 的去噪器(x 预测)及噪声预测(ε 预测)参数化公式。

SOURCE PDF p.24 · A5.SS9.p2.1
EN
In Continuous Flow Matching one can chose several ways to define the probability paths ( Lipman et al., 2022 ; Liu et al., 2022 ; Albergo and Vanden-Eijnden, 2022 ; Pooladian et al., 2023 ; Tong et al., 2023 ) :
中
连续流匹配中有若干定义概率路径的方式(Lipman 等,2022;Liu 等,2022;Albergo 与 Vanden-Eijnden,2022;Pooladian 等,2023;Tong 等,2023),如下列公式。
pt(x)=∫pt(x∣x0,x1)π(x0,x1)dx0dx1=∫p1∣t(x∣x1)q(x1)dx1=∫p0∣t(x∣x0)p(x0)dx0.\displaystyle p_{t}(x) \qquad \displaystyle=\int p_{t}(x|x_{0},x_{1})\pi(x_{0},x_{1})dx_{0}dx_{1} \qquad \displaystyle=\int p_{1|t}(x|x_{1})q(x_{1})dx_{1} \qquad \displaystyle=\int p_{0|t}(x|x_{0})p(x_{0})dx_{0}.

Denoiser parameterization. 去噪器参数化

SOURCE PDF p.24 · A5.SS9.SSS0.Px1.p1.1
EN
The conditional generating velocity field ut(x∣x1)u_{t}(x|x_{1}) for pt(x∣x1)p_{t}(x|x_{1}) , i.e. , satisfy the Continuity Equation 16 , takes the form ( Lipman et al., 2022 )
中
生成条件路径 pt(x∣x1)p_t(x|x_1)、即满足连续性方程(16)的条件速度场 ut(x∣x1)u_t(x|x_1) 具有下式形式(Lipman 等,2022)。
ut(x∣x1)=κ˙t1−κt(x1−x),u_{t}(x|x_{1})=\frac{\dot{\kappa}_{t}}{1-\kappa_{t}}(x_{1}-x),

SOURCE PDF p.24 · A5.SS9.SSS0.Px1.p1.2
EN
and the marginal generating velocity field is therefore given by the marginalization with the posterior pt(x1∣x)p_{t}(x_{1}|x) ,
中
因此,边缘生成速度场由后验 pt(x1∣x)p_t(x_1|x) 边缘化得到下式。
ut(x)=∫κ˙t1−κt(x1−x)p1∣t(x∣x1)q(x1)pt(x)dx1=κ˙t1−κt\bracx^1∣t(x)−x,\displaystyle u_{t}(x) \qquad \displaystyle=\int\frac{\dot{\kappa}_{t}}{1-\kappa_{t}}(x_{1}-x)\frac{p_{1|t}(x|x_{1})q(x_{1})}{p_{t}(x)}dx_{1} \qquad \displaystyle=\frac{\dot{\kappa}_{t}}{1-\kappa_{t}}\brac{\hat{x}_{1|t}(x)-x},

SOURCE PDF p.24 · A5.SS9.SSS0.Px1.p1.3
EN
where
中
其中去噪器定义如下。
x^1∣t(x)=∫x1p1∣t(x∣x1)q(x1)pt(x)dx1=\EX1∼pt(⋅∣x)X1.\hat{x}_{1|t}(x)=\int x_{1}\frac{p_{1|t}(x|x_{1})q(x_{1})}{p_{t}(x)}dx_{1}=\E_{X_{1}\sim p_{t}(\cdot|x)}X_{1}.

SOURCE PDF p.24 · A5.SS9.SSS0.Px1.p1.4
EN
This shows the continuous Flow Matching denoiser parameterization of the generating velocity field in Table 1 .
中
这便得到表 1 中连续流匹配生成速度场的去噪器参数化。

Noise-prediction parameterization. 噪声预测参数化

SOURCE PDF p.24 · A5.SS9.SSS0.Px2.p1.1
EN
The conditional generating velocity field for pt(x∣x0)p_{t}(x|x_{0}) takes the form
中
生成 pt(x∣x0)p_t(x|x_0) 的条件速度场具有下式形式。
ut(x∣x0)=κ˙tκt(x−x0),u_{t}(x|x_{0})=\frac{\dot{\kappa}_{t}}{\kappa_{t}}(x-x_{0}),

SOURCE PDF p.24 · A5.SS9.SSS0.Px2.p1.2
EN
and the marginal generating velocity field in this case is given by marginalization with the posterior pt(x0∣x)p_{t}(x_{0}|x) ,
中
此时边缘生成速度由后验 pt(x0∣x)p_t(x_0|x) 边缘化得到下式。
ut(x)=∫κ˙tκt(x−x0)p0∣t(x∣x0)p(x0)pt(x)dx0=κ˙tκt\bracx−x^0∣t(x),\displaystyle u_{t}(x) \qquad \displaystyle=\int\frac{\dot{\kappa}_{t}}{\kappa_{t}}(x-x_{0})\frac{p_{0|t}(x|x_{0})p(x_{0})}{p_{t}(x)}dx_{0} \qquad \displaystyle=\frac{\dot{\kappa}_{t}}{\kappa_{t}}\brac{x-\hat{x}_{0|t}(x)},

SOURCE PDF p.24 · A5.SS9.SSS0.Px2.p1.3
EN
where
中
其中噪声预测器定义如下。
x^0∣t(x)=∫x0p0∣t(x∣x0)p(x0)pt(x)dx0=\EX0∼pt(⋅∣x)X0.\hat{x}_{0|t}(x)=\int x_{0}\frac{p_{0|t}(x|x_{0})p(x_{0})}{p_{t}(x)}dx_{0}=\E_{X_{0}\sim p_{t}(\cdot|x)}X_{0}.

SOURCE PDF p.24 · A5.SS9.SSS0.Px2.p1.4
EN
This shows the continuous Flow Matching noise-prediction parameterization of the generating velocity field in Table 1 .
中
这便得到表 1 中连续流匹配生成速度场的噪声预测参数化。

E.10 Scheduler change formula E.10 调度器变换公式

Proposition 8 . 命题 8

SOURCE PDF p.24 · A5.Thmtheorem8.p1.1
EN
Assume a conditional probability path as in ( 9 ), then for any two schedulers κt,κt′\kappa_{t},\kappa^{\prime}_{t} , and w^t(xi∣z),w^t′(xi∣z)\hat{w}_{t}(x^{i}|z),\hat{w}^{\prime}_{t}(x^{i}|z) their corresponding posteriors as in ( 23 ),
中
假设条件概率路径为式(9),则任意两个调度器 κₜ、κ′ₜ,以及其对应的式(23)后验 w^t(xi∣z)\hat w_t(x^i|z)、w^t′(xi∣z)\hat w'_t(x^i|z),满足下式。
w^t′(xi∣z)=w^t′(xi∣z),\hat{w}_{t^{\prime}}(x^{i}|z)=\hat{w}_{t}^{\prime}(x^{i}|z),

SOURCE PDF p.24 · A5.Thmtheorem8.p1.2
EN
where t′=κκt′−1t^{\prime}=\kappa^{-1}_{\kappa^{\prime}_{t}} , and κ−1\kappa^{-1} is the inverse of κ\kappa .
中
其中 t′=κ−1(κt′)t'=\kappa^{-1}(\kappa'_t),κ⁻¹ 是 κ 的逆函数。

Proof ( Proposition 8 ). 证明(命题 8)

SOURCE PDF p.25 · A5.Thmtheorem9.p1.1
EN
For a conditional probability path as in ( 9 ),
中
对于式(9)的条件概率路径,有下式。
pt′(xi∣x0,x1)=∏i=1Npt′(xi∣x0,x1)=∏i=1N\brac(1−κt′)δx0(xi)+κt′δx1(xi)=∏i=1N\brac(1−κt′)δx0(xi)+κt′δx1(xi)=∏i=1Npt′(xi∣x0,x1)=pt′(xi∣x0,x1),\displaystyle p_{t^{\prime}}(x^{i}|x_{0},x_{1}) \qquad \displaystyle=\prod_{i=1}^{N}p_{t^{\prime}}(x^{i}|x_{0},x_{1}) \qquad \displaystyle=\prod_{i=1}^{N}\brac{(1-\kappa_{t^{\prime}})\delta_{x_{0}}(x^{i})+\kappa_{t^{\prime}}\delta_{x_{1}}(x^{i})} \qquad \displaystyle=\prod_{i=1}^{N}\brac{(1-\kappa^{\prime}_{t})\delta_{x_{0}}(x^{i})+\kappa^{\prime}_{t}\delta_{x_{1}}(x^{i})} \qquad \displaystyle=\prod_{i=1}^{N}p^{\prime}_{t}(x^{i}|x_{0},x_{1}) \qquad \displaystyle=p^{\prime}_{t}(x^{i}|x_{0},x_{1}),

SOURCE PDF p.25 · A5.Thmtheorem9.p1.2
EN
where in the 3rd equality we used κt′=κt′\kappa_{t^{\prime}}=\kappa^{\prime}_{t} . Thus, also for the marginal probability path as in ( 7 ),
中
第三个等号使用 κt′=κt′\kappa_{t'}=\kappa'_t。因此,式(7)的边缘概率路径也满足下式。
pt′(x)=∑x0,x1∈\gDpt′(x∣x0,x1)π(x0,x1)=∑x0,x1∈\gDpt′(x∣x0,x1)π(x0,x1)=pt′(x),\displaystyle p_{t^{\prime}}(x) \qquad \displaystyle=\sum_{x_{0},x_{1}\in\gD}p_{t^{\prime}}(x|x_{0},x_{1})\pi(x_{0},x_{1}) \qquad \displaystyle=\sum_{x_{0},x_{1}\in\gD}p^{\prime}_{t}(x|x_{0},x_{1})\pi(x_{0},x_{1}) \qquad \displaystyle=p^{\prime}_{t}(x),

SOURCE PDF p.25 · A5.Thmtheorem9.p1.3
EN
where in the 2nd equality we used pt′(x∣x0,x1)=pt′(x∣x0,x1)p_{t^{\prime}}(x|x_{0},x_{1})=p^{\prime}_{t}(x|x_{0},x_{1}) . Finally the change of scheduler for a posterior as defined in ( 23 ),
中
第二个等号使用 pt′(x∣x0,x1)=pt′(x∣x0,x1)p_{t'}(x|x_0,x_1)=p'_t(x|x_0,x_1)。最后,对式(23)的后验进行调度器变换得到下式。
w^t′(xi∣z)=∑x0,x1∈\gDw(xi∣x0,x1)pt′(x0,x1∣z)=∑x0,x1∈\gDw(xi∣x0,x1)pt′(z∣x0,x1)π(x0,x1)pt′(z)=∑x0,x1∈\gDw(xi∣x0,x1)pt′(z∣x0,x1)π(x0,x1)pt′(z)=∑x0,x1∈\gDw(xi∣x0,x1)pt′(x0,x1∣z)=w^t′(xi∣z)\displaystyle\hat{w}_{t^{\prime}}(x^{i}|z) \qquad \displaystyle=\sum_{x_{0},x_{1}\in\gD}w(x^{i}|x_{0},x_{1})p_{t^{\prime}}(x_{0},x_{1}|z) \qquad \displaystyle=\sum_{x_{0},x_{1}\in\gD}w(x^{i}|x_{0},x_{1})\frac{p_{t^{\prime}}(z|x_{0},x_{1})\pi(x_{0},x_{1})}{p_{t^{\prime}}(z)} \qquad \displaystyle=\sum_{x_{0},x_{1}\in\gD}w(x^{i}|x_{0},x_{1})\frac{p^{\prime}_{t}(z|x_{0},x_{1})\pi(x_{0},x_{1})}{p^{\prime}_{t}(z)} \qquad \displaystyle=\sum_{x_{0},x_{1}\in\gD}w(x^{i}|x_{0},x_{1})p^{\prime}_{t}(x_{0},x_{1}|z) \qquad \displaystyle=\hat{w}^{\prime}_{t}(x^{i}|z)

SOURCE PDF p.25 · A5.Thmtheorem9.p1.4
EN
where in the 3rd equality we used both pt′(z∣x0,x1)=pt′(z∣x0,x1)p_{t^{\prime}}(z|x_{0},x_{1})=p^{\prime}_{t}(z|x_{0},x_{1}) and pt′(z)=pt′(z)p_{t^{\prime}}(z)=p^{\prime}_{t}(z) .
中
第三个等号同时使用 pt′(z∣x0,x1)=pt′(z∣x0,x1)p_{t'}(z|x_0,x_1)=p'_t(z|x_0,x_1) 与 pt′(z)=pt′(z)p_{t'}(z)=p'_t(z)。

Appendix F Inference time 附录 F 推断时间

SOURCE PDF p.25 · A6.p1.1
EN
One potential benefit of non-autoregressive decoding is improved latency due to a significantly lower number of decoding steps. To demonstrate that, we measure the average latency of the proposed method compared with the autoregressive alternative using a single A100 GPU with 8080 GB of RAM. We calculate the average latency time on the HumanEval benchmark using a batch size of 1. When considering 256 NFEs, the proposed method was found to be ∼\sim 2.5x faster than the autoregressive model (19.97 vs. 50.94 seconds on average per example). However, when considering 512 NFEs, both methods reach roughly the same latency. These results make sense as the number of tokens in most of the examples in HumanEval are below 512. Notice, that these results analyze latency and not model throughput. Due to the kv-caching mechanism following the autoregressive approach will result in significantly better throughput compared to the proposed approach Ziv et al. (2024) . We leave the construction of a kv-cache mechanism to the proposed approach for future research.
中
非自回归解码的潜在优点是解码步数明显更少,从而减少延迟。作者使用一块 80 GB A100 GPU,在 HumanEval、批量大小 1 上比较平均延迟。256 NFE 时,本文方法比自回归模型快约 2.5 倍:每例平均 19.97 对 50.94 秒;512 NFE 时,二者延迟大致相同。这与 HumanEval 多数例子的词元数少于 512 相符。这里分析的是延迟而非吞吐量;由于 KV-cache 机制,自回归方案的吞吐量会明显更好(Ziv 等,2024)。为本文方法构建 KV-cache 留待后续研究。译注:这是论文报告的 GPU 实验,本次整理未运行该实验。

Appendix G Experimental setup 附录 G 实验设置

G.1 Text G.1 文本

Data. 数据

SOURCE PDF p.26 · A7.SS1.SSS0.Px1.p1.1
EN
We use three splits of data. First is OpenWebText ( Gokaslan and Cohen, 2019 ) . Second is the same mix used in Llama-2 ( Touvron et al., 2023 ) , including textual and code data. For the code-focused models we use the same split used in CodeLlama ( Roziere et al., 2023 ) . For the small models, we use OpenWebText. For the big models we use the Llama-2 and CodeLlama mixes.
中
我们使用三类数据。第一类是 OpenWebText(Gokaslan 与 Cohen,2019);第二类是 Llama-2(Touvron 等,2023)使用的相同混合数据,包括文本与代码;偏重代码的模型使用与 CodeLlama(Roziere 等,2023)相同的数据划分。小模型用 OpenWebText,大模型用 Llama-2 与 CodeLlama 混合数据。

Models. 模型

SOURCE PDF p.26 · A7.SS1.SSS0.Px2.p1.1
EN
We train two sizes of models: small (150M parameters) and large (1.7B parameters). For the small model we used a DiT transformer architecture ( Peebles and Xie, 2022 ) with 12 layers, 12 attention heads, and hidden dimension of 768. We also used GPT2 tokenizer. The small models were trained on OpenWebText. For the large model, we use also used a DiT transformer architecture but with 48 layers, 24 attention heads, and hidden dimension of 1536 ( Peebles and Xie, 2022 ) . For these models we used a tiktoken tokenizer. The large models were trained on the Llama-2 mix and the CodeLlama mix. For both models we used ROPE ( Su et al., 2024 ) embedding with θ=10000\theta=10000 . Models are trained with Adam optimizer with β1=0.9\beta_{1}=0.9 and β2=0.999\beta_{2}=0.999 . We use dropout rate of 0.1. Models are trained with a warm-up of 2500 steps, with a peak learning rate of 3e-4. We train the big models with batch size of 4096 for 1.3 million iterations and the big models with batch size of 512 for 400 thousand iterations.
中
训练两种规模:小模型 1.5 亿参数、大模型 17 亿参数。小模型为 DiT Transformer(Peebles 与 Xie,2022),有 12 层、12 个注意力头、隐藏维度 768,使用 GPT2 tokenizer,在 OpenWebText 训练。大模型也采用 DiT,但有 48 层、24 个头、隐藏维度 1536,使用 tiktoken,在 Llama-2 与 CodeLlama 混合数据训练。两者均用 θ=10000 的 ROPE 嵌入(Su 等,2024),Adam 的 β₁=0.9、β₂=0.999,dropout=0.1,预热 2500 步,峰值学习率 3×10⁻⁴。原文末句先写“大模型以批量 4096 训练 130 万次迭代”,又写“大模型以批量 512 训练 40 万次迭代”;两处都写 big models,未自行改成 small。

Entropy metric. 熵指标

SOURCE PDF p.26 · A7.SS1.SSS0.Px3.p1.1
EN
We report the entropy of tokens within a sequence, averaged over all generated sequences. This intuitively quantifies the diversity of tokens within a given sequence. It’s important to note that when computing sequence entropy, tokens not present in the sequence are excluded from consideration.
中
我们报告每个序列内部词元熵,再对所有生成序列取平均。直观上,它度量单个序列内的词元多样性。计算序列熵时,不计入该序列中未出现的词元。

Generative perplexity metric. 生成困惑度指标

SOURCE PDF p.26 · A7.SS1.SSS0.Px4.p1.1
EN
The generative perplexity metric is the average likelihood of generated text evaluated with a second (usually stronger) model. We report the generative perplexity when averaged over 1000 samples.
中
生成困惑度指标是用第二个(通常更强)模型评估生成文本的平均似然。本文报告对 1000 个样本平均的生成困惑度。

Double precision sampling. 双精度采样

SOURCE PDF p.26 · A7.SS1.SSS0.Px5.p1.1
EN
Zheng et al. (2024) demonstrated that sampling from a high-dimensional distribution with full precision can lead to a similar affect as sampling with temperature. We evaluate our model using a categorical sampler in double precision. Table 5 presents the results of baselines compared to our method.
中
Zheng 等(2024)表明,从高维分布全精度采样可能产生类似温度采样的效果。我们以双精度类别采样器评估模型,表 5 比较本文方法与基线。

A7.T5

SOURCE PDF p.26,A7.T5

Table 5: Double precision sampling. Generative perplexity on unconditional text generation compared to prior work. All models are sampled without the use of temperature or corrector steps. 表 5:双精度采样的无条件文本生成困惑度比较;所有模型均不使用温度或校正步骤。

G.2 Image G.2 图像

Models. 模型

SOURCE PDF p.26 · A7.SS2.SSS0.Px1.p1.1
EN
For all our experiments on CIFAR10 we use the U-Net architecture as in Dhariwal and Nichol (2021) , with following three changes to make it fully discrete and time independent (as we used mask modeling): (i) We replace the first layer with an embedding table of size 257×96257\times 96 , and we stack the channel features such that the input to the U-Net is of shape 288×32×32288\times 32\times 32 . (ii) We enlarge the size of the final layer to output a tensor of shape 3×32×32×2573\times 32\times 32\times 257 . (iii) We remove the time dependency from architecture. The hyper-parameters of the architecture: channels 96 , depth 5, channels multiple [3,4,4], heads channels 64, attention resolution 16, dropout 0.4, which gives a total parameters count of 113M. We optimize the network using Adam optimizer with β1=0.9\beta_{1}=0.9 and β2=0.999\beta_{2}=0.999 , a learning rate of 1e-4. We trained with an effective batch size pf 512 for roughly 300K iterations.
中
所有 CIFAR10 实验采用 Dhariwal 与 Nichol(2021)的 U-Net,并做三项改动,使其完全离散且与时间无关(使用掩码建模):(i)首层换成 257×96 的嵌入表,堆叠通道特征,使输入形状为 288×32×32;(ii)末层增大为输出 3×32×32×257 的张量;(iii)移除架构的时间依赖。架构超参数为通道数 96、深度 5、通道倍数 [3,4,4]、每头通道数 64、注意力分辨率 16、dropout 0.4,总参数 1.13 亿。Adam 使用 β₁=0.9、β₂=0.999、学习率 10⁻⁴,有效批量 512,训练约 30 万次迭代。

Scheduler ablation. 调度器消融

SOURCE PDF p.27 · A7.SS2.SSS0.Px2.p1.1
EN
Figure 8 shows FID of our method with four different schedulers: Linear, Quadratic, Cubic, Cosine, both for training and evaluation. That is, for each scheduler we trained a model and evaluate FID with all four schedulers. We observe a high variance in FID between different schedulers, with the Cubic scheduler generally performing the best on both training and evaluation.
中
图 8 比较线性、二次、三次、余弦四种调度器在训练与评估时的 FID;对每种训练调度器训练一个模型,再用全部四种调度器评估。不同调度器之间的 FID 变化很大,三次调度器总体在训练、评估中均最好。

A7.F8

SOURCE PDF p.27,A7.F8

Figure 8 : Comparison of FID on CIFAR10 with four schedulers: Linear, Quadratic, Cubic, Cosine, for both train and evaluation. Corrector sampling is not used in this experiment ( i.e. , α t ​ = 0 in ( 26 )), and temperature is set to 1. 图 8:CIFAR10 上四种调度器(线性、二次、三次、余弦)在训练与评估组合下的 FID。此实验不使用校正采样(原文写式 26 的 αₜ=0),温度为 1。

Comparison with baselines. 基线比较

SOURCE PDF p.27 · A7.SS2.SSS0.Px3.p1.1
EN
In the following, we provide implementation details for producing Figure 3(a) , that compares our schedulers and sampling algorithm with those employed by previous works.
中
下面给出图 3(a) 的实现细节,该图比较本文调度器、采样算法与先前方法的设置。

Cubic Scheduler (Ours). 三次调度器(本文)

SOURCE PDF p.27 · A7.SS2.SSS0.Px4.p1.1
EN
For the Cubic scheduler we set the corrector scheduler as above to,
中
对于三次调度器,校正调度器按前述方式设置如下。
αt=1+αta(1−t)b,βt=αt−1,\alpha_{t}=1+\alpha t^{a}(1-t)^{b},\quad\beta_{t}=\alpha_{t}-1,

SOURCE PDF p.27 · A7.SS2.SSS0.Px4.p1.2
EN
and we search over the parameters a,b∈{ 0,0.25,0.5,1,2,2.5,3 }a,b\in\set{0,0.25,0.5,1,2,2.5,3} , and α∈{ 6,8,10,12,14 }\alpha\in\set{6,8,10,12,14} . Additionally, we search over the temperature ∈{ 1,0.9,0.8 }\in\set{1,0.9,0.8} . We find that a=2a=2 , b=0.25b=0.25 , α=12\alpha=12 give best FID.
中
搜索 a,b∈{0,0.25,0.5,1,2,2.5,3}a,b\in\{0,0.25,0.5,1,2,2.5,3\} 及 α∈{6,8,10,12,14}\alpha\in\{6,8,10,12,14\},同时搜索温度 {1,0.9,0.8}。发现 a=2、b=0.25、α=12 时 FID 最佳。

Linear Scheduler ( Campbell et al., 2024 ) . 线性调度器(Campbell 等,2024)

SOURCE PDF p.27 · A7.SS2.SSS0.Px5.p1.1
EN
For the linear scheduler we search over two additional hyper-parameters of the method: (i) For corrector scheduler as in ( 26 ), we set αt=1+tη\alpha_{t}=1+t\eta , βt=αt−1\beta_{t}=\alpha_{t}-1 , where η\eta is the stochasticity parameter as in Campbell et al. (2024) , and search over η∈{ 0,1,2,5,10,15 }\eta\in\set{0,1,2,5,10,15} . (ii) We search over temperature in { 1,0.9,0.8 }\set{1,0.9,0.8} . Finally, we find that the best FID is a achieved by η=10\eta=10 and temperature 0.90.9 .
中
对于线性调度器,另外搜索两类超参数:(i)式(26)的校正调度器设为 αₜ=1+tη、βₜ=αₜ−1,η 是 Campbell 等(2024)的随机性参数,搜索 η∈{0,1,2,5,10,15};(ii)搜索温度 {1,0.9,0.8}。最终 η=10、温度 0.9 时 FID 最佳。

MaskGIT ( Chang et al., 2022 ) . MaskGIT(Chang 等,2022)

SOURCE PDF p.27 · A7.SS2.SSS0.Px6.p1.1
EN
For the MaskGIT we train and sample with the Cosine scheduler κ(t)=1−cos⁡\parrπ2t\kappa(t)=1-\cos\parr{\frac{\pi}{2}t} which is reported to achieve best results by Chang et al. (2022) . For sampling we adjust the code from the re-implementation of Besnier and Chen (2023) . In addition, we also search over the temperature in { 1,0.9,0.8,0.7,0.6,0.5 }\set{1,0.9,0.8,0.7,0.6,0.5} , and we find the best FID is achieved by temperature 1.
中
MaskGIT 的训练与采样采用余弦调度器 κ(t)=1−cos⁡(πt/2)\kappa(t)=1-\cos(\pi t/2),Chang 等(2022)报告它表现最佳。采样代码由 Besnier 与 Chen(2023)的复现修改而来。我们还搜索温度 {1,0.9,0.8,0.7,0.6,0.5},发现温度 1 时 FID 最佳。

Appendix H Code generation - qualitative examples 附录 H 代码生成定性例子

H.1 Success cases H.1 成功案例

A8.SS1.fig1

SOURCE PDF p.28,A8.SS1.fig1

函数说明:账户余额从零开始,依次执行给定存取款操作;只要任一时刻余额低于零立即返回 True,否则返回 False。示例 below_zero([1,2,3]) 为 False;below_zero([1,2,-4,5]) 为 True。

A8.SS1.fig2

SOURCE PDF p.28,A8.SS1.fig2

encode_shift:把每个字母沿字母表移动 5 位,返回编码字符串。decode_shift:输入由 encode_shift 编码的字符串,返回解码结果。原 PDF 中的取模 % 26 保持不变。

A8.SS1.fig3

SOURCE PDF p.29,A8.SS1.fig3

函数说明:给定包含任意 Python 值的列表,只筛选整数。示例 [a,3.14,5] 得 [5];[1,2,3,abc,{},[]] 得 [1,2,3]。测试中的字符串仍以原代码引号为准。

A8.SS1.fig4

SOURCE PDF p.29,A8.SS1.fig4

函数说明:返回两个列表中共有的、去重且排序后的元素。示例 common([1,4,3,34,653,2,5],[5,7,1,5,9,653,121]) 得 [1,5,653];common([5,3,2,8],[3,2]) 得 [2,3]。

A8.SS1.fig5

SOURCE PDF p.29,A8.SS1.fig5

函数说明:FibFib 类似 Fibonacci,定义 fibfib(0)=0、fibfib(1)=0、fibfib(2)=1,且 fibfib(n)=fibfib(n−1)+fibfib(n−2)+fibfib(n−3)。请高效计算第 n 项。示例 fibfib(1)=0、fibfib(5)=4、fibfib(8)=24。

H.2 Failure cases H.2 失败案例

A8.SS2.fig1

SOURCE PDF p.30,A8.SS2.fig1

函数说明:给定字符串 s,若 s[i] 是字母,则大小写互换,否则原样保留;若完全没有字母,则反转字符串,返回结果。例 solve("1234")="4321"、solve("ab")="AB"、solve("#a@C")="#A@c"。代码注释:result string=结果字符串;to lower case=转为小写。黄色输出是失败案例,保留其实现错误。

A8.SS2.fig2

SOURCE PDF p.30,A8.SS2.fig2

函数说明:从整数列表生成逐位置的历史最大值列表。例 rolling_max([1,2,3,2,3,4,2]) 应得 [1,2,3,3,3,4,4]。黄色代码保留失败输出。

A8.SS2.fig3

SOURCE PDF p.31,A8.SS2.fig3

函数说明:正浮点数可以分成整数部分(小于给定数的最大整数)与小数部分(剩余部分,总小于 1);返回小数部分。例 truncate_number(3.5)=0.5。原生成代码返回 floor,按失败样例保留。

A8.SS2.fig4

SOURCE PDF p.31,A8.SS2.fig4

函数说明:给定整数列表,返回全部整数之和与积组成的元组;空和为 0,空积为 1。例 sum_product([])=(0,1),sum_product([1,2,3,4])=(10,24)。

A8.SS2.fig5

SOURCE PDF p.31,A8.SS2.fig5

函数说明:将给定整数分解为质因数,按从小到大返回列表;每个因数按其分解重数重复,所有因数之积应等于输入。例 factorize(8)=[2,2,2],factorize(25)=[5,5],factorize(70)=[2,5,7]。

A8.SS2.fig6

SOURCE PDF p.32,A8.SS2.fig6

函数说明:返回字符串列表中最长者;并列时返回第一个;空列表返回 None。例 longest([]) 无值,longest([a,b,c]) 得 a,longest([a,bb,ccc]) 得 ccc;字符串按原代码引号理解。

H.3 Infilling H.3 代码填空

A8.SS3.fig1

SOURCE PDF p.33,A8.SS3.fig1

代码注释逐项:优化算法,使已排序数组无需走完整过程;遍历全部数组元素;range(n) 也能用,但外循环会多执行一次;最后 i 个元素已就位;遍历下标 0 到 n−i−1;若当前元素大于下一个则交换;若一次交换都不需要,可直接退出主循环。黄色为填空生成片段。

A8.SS3.fig2

SOURCE PDF p.34,A8.SS3.fig2

代码注释逐项:对邻接表表示的图做广度优先搜索;建立 BFS 队列;标记当前节点已访问并入队;遍历队列;出队一个顶点并打印;获取该顶点全部相邻顶点;未访问的邻点标记后入队。

A8.SS3.fig3

SOURCE PDF p.34,A8.SS3.fig3

代码注释逐项:若 x 存在于 arr,返回其下标,否则 −1;检查基本情形;若元素就在中间直接返回;若元素小于中间值,则只可能在左半数组;否则只可能在右半数组;若数组中不存在该元素,则返回 −1。

A8.SS3.fig4

SOURCE PDF p.35,A8.SS3.fig4

代码注释逐项:Python 实现 Dijkstra 单源最短路,图用邻接矩阵表示;辅助函数从尚未进入最短路树的顶点里寻找距离最小者;初始化下一节点的最小距离;搜索未进入最短路树的最近顶点;实现邻接矩阵图的单源最短路;从尚未处理的顶点中选最小距离顶点,首次迭代 u 总等于 src;将该顶点加入最短路树;仅当现有距离大于新距离、且邻点未进入树时,更新所选顶点的相邻顶点距离。输出表头 Vertex / Distance from Source=顶点/距源点距离。原生成代码中的索引等实现保持原样。

Appendix I Textual generations 附录 I 文本生成例子

SOURCE PDF p.36 · A9.p1.1
EN
We present below example generations for the proposed method together with several baseline methods. We provide both conditional and unconditional generations. For the conditional generations, we mark the prompt in gray.
中
下文展示本文方法及若干基线的生成例子,包括条件与无条件生成。条件生成中的提示用灰色标出。译注:以下是模型生成样例,保留了原样例的错误、断裂和事实混淆,不能作为新闻或人物事实使用。

I.1 Conditional generation I.1 条件生成

SOURCE PDF p.36 · A9.SS1.fig1.1
EN
The United States on Wednesday asked the UN Security Council to slap an oil embargo on North Korea and freeze the assets of leader Kim Jong-un, in response to Pyongyang’s response to the revelations it had restarted its nuclear work in March. “We will continue working to use maximum international pressure on North Korea to agree to the suspension of its nuclear program and reinstate sanctions,” said John Bolton, who served as National Security Advisor and Secretary of State under US President Bill Clinton. “Here is North Korea’s response to our sanctions,” Bolton wrote in a letter to House Minority Leader Nancy Pelosi. “We want you to know that the international community is seriously monitoring North Korea at this time. North Korea is still complying with our requests from the past few days,” Bolton said on Monday. “We have been working through the United Nations to provide the information that they gave us.” Asked to whether any international pressure will be put in place for North Korea to give up its nuclear weapons, Bolton said the United States can use maximum pressure to get North Korea to abandon its nuclear weapons if it wants. “We’ve been working to use maximum pressure on North Korea, through the Security Council, and we will continue to do so,” said White House Deputy Press Secretary Sarah Huckabee Sanders in Washington. “We’re committed to taking any steps necessary to help North Korea pursue its only option for peace, including in this period,” she added. The United States did not plan to produce any more oil at this time last year and had not planned to do so this year. “We believe that the North Korea approach is misguided in moving forward with its nuclear program to endanger peace and security in its homeland and neighbors in Asia,” said Bolton, adding that the US supplies its nuclear weapons. “We don’t want them to sell their nuclear weapons to other nations,” he said. Bolton said the US would look for pressure on North Korea, which has been known to use nuclear weapons, as leverage to negotiations with the US. “I will reiterate what I have said before. So, the US has to put pressure on North Korea. But who else is going to hold the cards? Somebody else has to hold the cards,” Mr Bolton said. Bolton described what the United States is prepared to do to get North Korea to agree to give up its weapons and asks for sanctions. “As far as I know, we have to use the pressure the reason for putting sanctions on North Korea,” he said, adding that the US does not plan to ask the UN Security Council for sanctions alone.
中
美国周三要求联合国安理会对朝鲜实施石油禁运,并冻结领导人金正恩的资产,以回应平壤对“它在三月重启核工作”这一披露的回应。约翰·博尔顿说:“我们将继续通过最大国际压力,让朝鲜同意暂停核计划并重新实施制裁。”样例称,他曾在美国总统比尔·克林顿任内担任国家安全顾问与国务卿。博尔顿在给众议院少数党领袖南希·佩洛西的信里写道:“这是朝鲜对我们制裁的回应。”他周一说:“我们希望你知道,国际社会此时正在严密关注朝鲜。朝鲜仍在遵守我们过去几天的要求。我们一直通过联合国提供他们给我们的信息。”被问及是否会以国际压力促使朝鲜放弃核武器,他说美国可以使用最大压力,只要朝鲜愿意,就让它放弃核武器。白宫副新闻秘书莎拉·赫卡比·桑德斯在华盛顿说:“我们一直通过安理会向朝鲜施加最大压力,并将继续这么做。”她补充:“包括这段时期在内,我们致力于采取一切必要步骤,帮助朝鲜追求它唯一的和平选择。”美国去年此时没有计划增加石油产量,今年也没有。博尔顿说:“我们认为,朝鲜推进核计划、危及本土及亚洲邻国和平安全的做法是误入歧途”,并补充称美国向它提供核武器。他说:“我们不希望他们把核武器卖给其他国家。”他称美国会对已知使用核武器的朝鲜寻找压力,作为对美谈判的筹码。“我重申之前的话。美国必须施压朝鲜。但还有谁来掌握筹码?必须由另一个人掌握筹码。”博尔顿描述美国准备怎样促使朝鲜同意放弃武器并要求制裁:“据我所知,我们必须利用压力——这就是制裁朝鲜的原因。”他补充,美国并不打算只要求联合国安理会制裁。

SOURCE PDF p.36 · A9.SS1.fig2.1
EN
The defender is available for the Maribor first leg but his club believed he should be suspended. SNS Group Celtic made an administrative blunder which saw Efe Ambrose left behind in the midfield in the Maribor department and has given him a potential three-match ban today. Although Efe Ambrose will be suspended next Friday, according to reports in Scottish media, the Celtic defender will still be fit for the Champions League first leg at Celtic Stadium in the middle of August. However, the Celtic club wrongly thought that Efe should only receive a three-match ban because he is available for the first leg. Although Efe Ambrose may receive a three-match ban next Friday, Efe Ambrose was part of the Celtic squad for the last match against Liverpool. However, says SNS Group Celtic he was making a tactical error and was left behind in midfield. It is understood that Efe Ambrose did not make the final squad and only played 11 games for the club this season. Efe Ambrose made his professional debut for Celtic in 2008 but spent nine months looking for a new club to return to. With a career-high 72 Celtic appearances, Efe is among Celtic’s most capped players ever.
中
这名后卫可参加对马里博尔的首回合,但其俱乐部认为他应被停赛。SNS Group:凯尔特人犯了行政错误,把埃菲·安布罗斯留在马里博尔部门的中场,并在今天使他面临三场禁赛。苏格兰媒体称,尽管他下周五将被停赛,这名凯尔特人后卫仍可在八月中旬于凯尔特人球场参加欧冠首回合。然而俱乐部错误地认为,既然他可以踢首回合,就只应受到三场禁赛。虽然他可能下周五收到三场禁赛,安布罗斯仍在上次对利物浦的大名单内。但 SNS Group 凯尔特人说,他犯了战术错误,被留在中场。据了解,他未进入最终名单,本赛季只为俱乐部踢了 11 场。样例称,他在 2008 年为凯尔特人完成职业首秀,却用九个月寻找可回归的新俱乐部;以生涯最高的 72 次凯尔特人出场,他属于俱乐部史上出场最多的球员之一。

SOURCE PDF p.37 · A9.SS1.fig3.1
EN
Carl Jara aka Grain Damaged is an award-winning, professional sand sculptor from Cleveland, Ohio. Jara says he has known since high-school that he wanted to be an artist. After studying English and Art History at the Northeastern University, Jara says one semester he started carving a custom sculpture into sand molds, but didn’t know how to do it. With the help of an instructor, he found out and learned how to use rubber molds to make art. Later, he made the decision to learn how to use sand and sculpt himself. In addition to how he makes his own sculptures, Jara says he does special events for comics companies such as Stan Lee and also for institutions like local community colleges and universities. In November of this year, he won the WWHS, The Very Art Of The Very Things Cleveland competition. Afterward, he will continue carving for clients in the comics industry and looks forward to sand sculpting in Cleveland. The Artist is professional sculptor who has been making art, for over 25 years, in various shapes and sizes.The artist says art is all about relationships and the best way to go into the heart is to create art. The artist has taught in various high schools in the Cleveland area and has taught a full time Honors Studio for High School students in grades 6, 7, and 8 time for over 20 years. Since Art is a personal form of artistic expression, he works individually in a way that allows the student that his work engages their imagination and presents ideas in ways that inform and challenge their own paths. Miguel Romano is a professional artist who worked in 3D modeling and animation in the areas of web design and production. The artist currently works as a digital artist in the ad and mass communication industries. In coming to Concrete Cleveland, he is excited to apply the 3D development and production skills he have to his work. The artist has a BFA in sculpture from Ohio University, along with an MFA in sculpture. We look forward to seeing his work very soon! Designed and installed by Concrete This Week. He is a guy originally from Cleveland, Ohio where he pursued a career as a nurse. He then moved to the Atlanta, GA area where he returned to school with a BSN and a BS in nursing and is a licensed nurse. He is a proud sorority brother and still has extra-curricular, as well as taking music lessons and the occasional play. He is a lovely asset at Concrete Cleveland and looks forward to seeing concrete
中
卡尔·哈拉,别名 Grain Damaged,是来自俄亥俄州克利夫兰的获奖职业沙雕艺术家。他说自己高中起就想做艺术家。在东北大学学习英语和艺术史后,有一个学期开始在沙模中雕刻定制作品,却不知道如何下手;在教师帮助下学会用橡胶模具创作,后来决定学习亲手用沙雕刻。除制作个人雕塑外,他说自己为斯坦·李等漫画公司及当地社区学院、大学等机构举办特殊活动。今年十一月,他赢得 WWHS“克利夫兰万物之艺术”比赛,此后会继续为漫画行业客户雕刻,并期待在克利夫兰从事沙雕。这位艺术家是专业雕塑家,二十五年多以来制作各种形状、尺寸的艺术品。他说艺术关乎关系,走入内心的最好方式是创作。他曾在克利夫兰多所高中授课,并为六、七、八年级学生教授全日制荣誉工作室二十多年。艺术是个人表达,他以个别方式工作,使学生的想象力受到调动,用能启发、挑战他们自身道路的方式呈现观念。米格尔·罗马诺是一名专业艺术家,曾在网页设计与制作领域从事三维建模、动画,现于广告及大众传播行业任数字艺术家。来到 Concrete Cleveland,他期待把三维开发制作技能应用于工作。他拥有俄亥俄大学雕塑 BFA 及雕塑 MFA。我们期待很快看到他的作品!由 Concrete This Week 设计并安装。他原籍俄亥俄州克利夫兰,曾从事护理;后迁至佐治亚州亚特兰大,返校获得护理 BSN 与 BS 学位,并取得护士执照。他为自己是联谊会兄弟感到自豪,仍有课外活动、音乐课与偶尔的戏剧。他是 Concrete Cleveland 的可贵成员,期待看到混凝土——(原样例至此中断)。

I.2 Unconditional generation I.2 无条件生成

SOURCE PDF p.38 · A9.SS2.fig1.1
EN
Here’s how that strategy works for your job: 1) You now plan upon what you accomplish to fulfill your goals. Management cannot plan what happens to you. This may not be your ultimate personal decision, but it’s perfectly fine to look at it. You just need to make sure you want to achieve this. Now, because you’ve worked at goal, you don’t have to talk about your status tomorrow, after all, you have to do your job and take care of yourself. Next steps, there may be some work to do. There is a company down the road you right – literally millions of things that would have to be done. But of course it would have a different outlook. If you’re going to do something, the customer might not be able to tell you. 2) Between those two steps are the plan in step so that your actions will be executed. Then you have taken other steps (usually a few less important changes), like delivery. If you already know what that means, and you’re having to stay up and take action you can make sure you don’t have to point out in the moment to plan the action. With business goals, it is not easy to pick up what appears best for us. We have to see what really is. What we do. We can’t make a plan on the floor and come back up with exactly what you’re doing. If you want to work every step, then you need to differentiate from the action and what the next step represents. Eventually, you’ll be less motivated to focus on this step and the previous one. Unfortunately if you don’t change your main thing, you may be able to lose your motivation to work on “pivot.” Unless that’s possible, and if you don’t change something, then the task may not be at the right time. Instead of doing something, it is just in advance of your ultimate goal. Although you might make a mistake with every single day to day plan, it still is a great opportunity to correct your mistake, become new and commit to working extra hours and meeting your goals promptly. The truth is, everything goes right for you no matter how quick a decision you become. The customer will never allow you to make the worst decisions. Otherwise, you make the very first decision. 3) Take timing as part of action. If you don’t feel like you can keep it, a plan without help of timing stops you from doing. When it’s like your plan in action can lead to something such as this: Now that you know what to do. For example, you might live in a place in the building that serves every customer, has 3 employees per team, and 3 clients on one. You will get things done the next day. Change your performance is the first step towards greater success, for example. Your team, at this point in the Customer department, will know how the customer deal with a single employee, the level chain, and more. Make sure you take action now that you change it. As a company, it won’t be hard but you will have lots of work to do when you change. 4) Make sure it’s your night.
中
以下是这种策略如何用于你的工作:1)现在你会规划完成什么来实现目标。管理层不能规划发生在你身上的事。这也许不是最终个人决定,但看看它完全没问题;只需确认你想实现它。现在,因为你已经朝目标工作,明天便不必谈自己的状态,毕竟你必须工作、照顾自己。下一步也许还有事要做。前方有一家你右边的公司——确实有数百万件事要做。当然它会有不同看法。如果你要做某事,客户可能无法告诉你。2)这两步之间有计划中的步骤,使行动得以执行。然后你又采取其他步骤,通常是少量较不重要的变化,例如交付。如果已经知道这意味着什么,而你必须熬夜行动,就能确保不必在那个时刻指出要规划行动。有商业目标时,很难拿起看上去最适合我们的东西。必须看清实际是什么、我们做什么。不能在地板上订计划,再回上来时恰好知道你在做什么。若想每一步都工作,就必须区分行动以及下一步代表什么。最终,你会较少有动力关注这一步和上一步。遗憾的是,若不改变主要事情,可能会失去去做“转向”的动力。除非那是可能的,而你没有改变什么,任务也许就不在合适的时机。不是做某事,而只是提前于最终目标。尽管每天的计划都可能出错,它仍是纠错、焕新、承诺加班并及时达标的好机会。事实是,不管你多快变成一个决定,一切都会顺利。客户绝不容许你做最差决定;否则你就做第一个决定。3)把时机当作行动的一部分。若觉得无法坚持,缺乏时机帮助的计划会阻止行动。当你的计划付诸行动可能产生这样的结果:现在你知道该做什么。例如,你可能住在一栋为每位客户服务的建筑里,每队有三名员工、每一组有三位客户。你会在第二天完成工作。例如改变表现,是迈向更大成功的第一步。客户部门的团队会知道客户如何与单个员工打交道、等级链条等。确保现在就采取行动去改变。作为公司,这并不难,但改变时会有很多工作。4)确保这是属于你的夜晚。

SOURCE PDF p.38 · A9.SS2.fig2.1
EN
Watch the humour but also the humanity behind the work we’re doing. The truth is something very tragic and delicate in the middle of a very fractured world. It’s the one thing that makes me proud. I feel like a singular individual has had to come together with this story. There’s a lot of people who I’ve worked with for the very beginning, because I have got people, you’ve got people who have just had these eyes on this story, and this sense of what we are, that run through our final movie. It’s the very beginning we’re at. The very beginning, we’re not there, we will get there but we won’t need. This is a story and these amazing actors, these fantastic violence, violence, that was just are elements and a complex world of conflict. When something like that is set to build this narrative and you’re directing the world of these characters based around their individual needs it’s very, extremely confusing, very heartbreaking — it’s really quite intense—this was all built within it, and what it is, it’s a 35-year old period that was slavery and still was very strong, these guys were operating to the edge and going to the point where we ended up setting up a big narrative, OK, that’s good, it’s okay, in some ways heroism is a noble imperative that we are fighting against, and recognize maturity as the mercurial nature and these are all human and we’ve got to clean it up so that that stuff is there and we’ve got to restore it. And the project we’re looking at here is our common goal is that anything can be done to make that happen and everybody can do whatever their want to do and do it as they please. That’s the spirit of it. That’s the movie I’ve made with Steven Wright in writing.
中
看看我们工作的幽默,也看看其中的人性。事实是在一个非常破碎的世界里,有某种十分悲惨而微妙的东西。这是唯一让我自豪的事。我觉得一个独特个体不得不与这个故事走到一起。很多人从最初便与我共事,因为我有这些人,你也有这些人,他们一直以这样的目光看着故事,而“我们是什么”的这种感受贯穿最终电影。我们处在最初,最初;还没到那里,会到,但我们不需要。这是一个故事,这些惊人的演员、这些奇妙的暴力——暴力——只是元素,是复杂的冲突世界。当这些东西被设置来构建叙事,而你又根据人物的个人需求去导演他们的世界时,会非常、极其困惑,非常令人心碎——真的很强烈——这一切都建在其中;它是什么呢,是一段三十五年的时期,那是奴役,仍很强烈;这些人行至边缘,走到我们最后搭建宏大叙事的地方。好,那很好,也没关系。从某些方面说,英雄主义是我们对抗的高尚命令,要把成熟理解为易变本性;这些都是人的,我们必须整理好,使那些东西存在,必须恢复它。我们在这里看的项目,共同目标是任何事都能为使其发生而做,每个人都可以做想做的事、随意去做。精神就在这里。这就是我与史蒂文·赖特在写作中制作的电影。

术语表

English 中文
probability velocity 概率速度
probability path 概率路径
corrector sampling 校正采样
probability denoiser 概率去噪器
CTMC 连续时间马尔可夫链
generative perplexity 生成困惑度
NFE 函数评估次数
Show Translation & Notation Audit Notes

固定底本与许可

  • Itai Gat、Tal Remez、Neta Shaul、Felix Kreuk、Ricky T. Q. Chen、Gabriel Synnaeve、Yossi Adi、Yaron Lipman:Discrete Flow Matching,NeurIPS 2024。
  • 固定底本:arXiv:2407.15595v2,2024-11-05;英文 PDF 38 页。官方入口:https://arxiv.org/abs/2407.15595v2 。
  • arXiv 官方条目的许可为 CC BY 4.0(work/abs.html 保存该链接);翻译与排版属于改编,原作版权归作者。许可:https://creativecommons.org/licenses/by/4.0/ 。
  • 成品 DiscreteFlowMatching_全文中英精译.pdf 为 63 页。172 个正文/附录/生成文本段落逐段中英配对;附录 A–I、56 项书目及 29 个原 PDF 图表/算法/代码裁图均保留。

编号以英文印本为准

官方 HTML 转换器给定理、命题和证明误加了分层编号。本次正文、标题、中英 Markdown、HTML、PDF 及 source_map 的展示字段统一使用印本编号;原 HTML anchor 与原始 source.html 保留,便于溯源。

官方 HTML 标签 英文印本标签 英文 PDF 页
Definition 2.1 Definition 1 4
Theorem 2.2 Theorem 2 5
Theorem 2.3 Theorem 3 6
Theorem 2.4 Theorem 4 7
Proposition 2.5 Proposition 5 7
Proposition 3.1 Proposition 6 8
Theorem E.3 Theorem 7 21
Proposition E.8 Proposition 8 24

证明标题改为 Proof (Theorem 2/3/7/4) 或 Proof (Proposition 5/6/8),对应原 PDF 第 18、19、21、22、23、23、25 页;不再显示 HTML 的 Proof E.1/E.2/E.4/E.5/E.6/E.7/E.9。

附录小节编号与定理编号不是同一计数器,E.1–E.10 保持原样。逐项核对源页:E.1 p.17,E.2 p.18,E.3 p.19,E.4 p.20,E.5 p.21,E.6 p.22,E.7/E.8 p.23,E.9/E.10 p.24。source_map.json 的 numbering_map、proof_map、appendix_E_subsection_pages 保留对应表。

源页与符号说明

  • 源页定位以长原文片段、印本小节边界及相邻带编号公式共同确定,不再用短词首次出现位置自动推进。短公式段落记录其确切 HTML anchor 和经核验的印本页。
  • S122 对应英文 PDF p.22、E.6 校正步骤、Proof (Theorem 4) 的 “First let us write explicitly” 与其后式 (51),不是早期相似短语所在页。
  • source_map 的 original 字段使用印本编号;source_original_html 保留 HTML 原始编号与文本作为审计源,不参与成品展示。
  • S009 首次明确:译文简写 M 指原文双线体小写 m 的同一 mask/dummy 掩码词元。S058/059/063/080/082/132 沿用此简写,不是另一种源分布。
  • 原 PDF 的百分号、斜杠分隔表值及代码由 29 个裁图保留。附录失败代码仍按原文保留失败,未将模型错误“修正”为成功;生成文本中的事实或病句也按原样译述。
  • 书目英文标题和作者名保留为文献标识,术语表附在 paper.md 末尾。

数学渲染与分页修复

此前构建器在 KaTeX 渲染后删除全部内联 style,误删分式、上下标和求和上下限的定位。现仅清除 KaTeX 之外的原网页布局 style,完整保留 KaTeX 定位与嵌入字体。最终 807 个数学片段均严格解析成功。

S130 的长训练证明对照英文 p.23 与最终译本 p.39 实际抽帧,分数线、括号、求和符和下标均正常;最终 p.4 和 p.37 检查了简单分式、源目标下标与式 (51)。旧第 33 页的孤立温度调度由连续章排版消除,最终第 31 页与附录 E 连排。多行公式可逐行跨页,单行不拆。

最终 Edge 无头印刷关闭 GPU,退出码 0。PyMuPDF 检查 63 页、172 段锚点及完整中文、29 个资产、56 项书目、内部链接与越页文字;未发现替换乱码、裸宏、旧定理展示编号或 .tmp.html。

含内联分式的 PDF 在 sort=True 下会被按字形几何位置重排,造成汉字顺序误报;完整段落检查采用 PDF 原生绘制顺序,再以实际抽帧确认版面。

重建与证据

  • work/build_reader.py:从保留的官方 HTML、translations.json 和原 PDF 重建 HTML、Markdown、source_map;保持印本编号及源锚点。
  • work/print_final.py:Edge CPU 无头印刷;work/verify_final.py:文本、资产、公式及链接核验与抽帧。
  • verification.json:最终 63 页验收记录;work/final_key_pages.json:关键段落所在译本页。
  • work/final_math_S130_p39.png:长证明修复后图;work/final_math_S123_p37.png:简单分式与校正证明图;work/final_math_S091_p31.png:原留白问题的最终排版。
  • 原始 HTML 与印刷源 reader.html 是保留的可重建材料,不是临时 .tmp.html 文件。未删除或绕过浏览器配置。