生成模型分类
已有的生成模型大致可以分为两类
- likelihood-based model:以 VAE 和 normalizing flow model 为主,直接拟合数据分布,但通常对网络模型的结构设计提出了较大限制
- implicit generative model:以 GAN 为主,使用判别器间接判断输出的数据是否符合数据分布,存在训练困难,容易训练失败以及模式崩塌等问题
Score Matching & Non-Normalized Distribution
Score Matching 最早在 2005 年《Estimation of Non-Normalized Statistical Models by Score Matching》提出,主要是用于解决概率分布的归一化的问题。在生成模型中,我们常希望使用含参模型 p θ ( x ) p_\theta(x) pθ(x) 给出的概率密度函数能够拟合真实的概率密度函数 p ( x ) p(x) p(x), p θ ( x ) p_\theta(x) pθ(x) 作为一个概率密度函数须满足归一化性质 ∫ x p θ ( x ) d x = 1 \int_x p_{\theta}(x)dx = 1 ∫xpθ(x)dx=1,因此,我们通常使用模型 q θ ( x ) q_\theta(x) qθ(x) 给出一个未归一化的概率密度函数,然后使用归一化项 Z ( θ ) Z(\theta) Z(θ) 来保证 p θ ( x ) p_\theta(x) pθ(x) 的性质,即
p θ ( x ) = 1 Z ( θ ) q θ ( x ) p_\theta(x) = \frac{1}{Z(\theta)}q_\theta(x) pθ(x)=Z(θ)1qθ(x)
其中 Z ( θ ) Z(\theta) Z(θ) 为与样本无关的一个常量。由于 Z ( θ ) Z(\theta) Z(θ) 的存在,无论是基于梯度的优化过程还是正向推理都变得很难计算,因此,考虑使 p θ ( x ) p_\theta(x) pθ(x) 关于输入的梯度逼近 p ( x ) p(x) p(x) 关于输入的梯度

▽ x q θ ( x ) = ▽ x p θ ( x ) ≈ ▽ x p ( x ) \triangledown_x q_\theta(x) = \triangledown_x p_\theta(x) \approx \triangledown_x p(x) ▽xqθ(x)=▽xpθ(x)≈▽xp(x)
形式化地,我们定义分数函数 ψ : R n → R n \psi : \R^n\rightarrow \R^n ψ:Rn→Rn 如下
ψ ( x ) = ▽ x p ( x ) \psi(x) = \triangledown_x p(x) ψ(x)=▽xp(x)
我们利用MSE损失函数找到最优参数 θ \theta θ 的过程称作是 Score Matching,损失函数定义为
J ESM ( θ ) = 1 2 ∫ x p ( x ) ∣ ∣ ψ θ ( x ) − ψ ( x ) ∣ ∣ 2 2 d x = E x ∼ p ( x ) [ 1 2 ∣ ∣ ψ θ ( x ) − ψ ( x ) ∣ ∣ 2 2 ] \begin{align} J_\text{ESM}(\theta) &= \frac{1}{2} \int_{x} p(x) ||\psi_\theta(x) - \psi(x)||_2^2 dx \nonumber \\ &= \mathbb E_{x\sim p(x)} [\frac{1}{2}||\psi_\theta(x) - \psi(x)||_2^2] \end{align} JESM(θ)=21∫xp(x)∣∣ψθ(x)−ψ(x)∣∣22dx=Ex∼p(x)[21∣∣ψθ(x)−ψ(x)∣∣22]
这种损失函数的表达形式也被称为显式分数匹配 (Explicit Score Matching)
对 J ESM J_\text{ESM} JESM 进行展开,有
J ( θ ) = 1 2 ∫ x p ( x ) ∣ ∣ ψ θ 2 ( x ) ∣ ∣ 2 2 d x − ∫ x p ( x ) ψ θ T ( x ) ψ ( x ) d x + 1 2 ∫ x p ( x ) ∣ ∣ ψ 2 ( x ) ∣ ∣ 2 2 d x = 1 2 ∫ x p ( x ) ∣ ∣ ψ θ 2 ( x ) ∣ ∣ 2 2 d x − ∫ x p ( x ) ψ θ T ( x ) ψ ( x ) d x + C \begin{align} J(\theta) &= \frac{1}{2} \int_{x} p(x) ||\psi_\theta^2(x)||^2_2dx - \int_{x} p(x) \psi_\theta^T(x)\psi(x)dx + \frac{1}{2} \int_{x} p(x) ||\psi^2(x)||^2_2dx \nonumber \\ &= \frac{1}{2} \int_{x} p(x) ||\psi_\theta^2(x)||^2_2dx - \int_{x} p(x) \psi_\theta^T(x)\psi(x)dx + C \end{align} J(θ)=21∫xp(x)∣∣ψθ2(x)∣∣22dx−∫xp(x)ψθT(x)ψ(x)dx+21∫xp(x)∣∣ψ2(x)∣∣22dx=21∫xp(x)∣∣ψθ2(x)∣∣22dx−∫xp(x)ψθT(x)ψ(x)dx+C
对于第二项进行维度展开,有
∫ x p ( x ) ψ θ T ( x ) ψ ( x ) d x = ∑ i = 1 n ∫ x p ( x ) ψ θ ( i ) ( x ) ψ ( i ) ( x ) d x = ∑ i = 1 n ∫ x p ( x ) ψ θ ( i ) ( x ) ∂ log p ( x ) ∂ x ( i ) d x = ∑ i = 1 n ∫ x ψ θ ( i ) ( x ) ∂ p ( x ) ∂ x ( i ) d x \begin{align} \int_{x} p(x) \psi_\theta^T(x)\psi(x)dx &= \sum_{i=1}^n \int_{x} p(x) \psi_\theta^{(i)}(x)\psi^{(i)}(x)dx \nonumber \\&= \sum_{i=1}^n \int_{x} p(x) \psi_\theta^{(i)}(x)\frac{\partial \log p(x)}{\partial x^{(i)}}dx \nonumber \\&= \sum_{i=1}^n \int_{x} \psi_\theta^{(i)}(x)\frac{\partial p(x)}{\partial x^{(i)}}dx \end{align} ∫xp(x)ψθT(x)ψ(x)dx=i=1∑n∫xp(x)ψθ(i)(x)ψ(i)(x)dx=i=1∑n∫xp(x)ψθ(i)(x)∂x(i)∂logp(x)dx=i=1∑n∫xψθ(i)(x)∂x(i)∂p(x)dx
我们考虑 i = 1 i=1 i=1 时的情况,由分部积分公式
lim a → ∞ , b → − ∞ f ( a , x ( 2 ) , . . . , x ( n ) ) g ( a , x ( 2 ) , . . . , x ( n ) ) − f ( b , x ( 2 ) , . . . , x ( n ) ) g ( b , x ( 2 ) , . . . , x ( n ) ) = ∫ − ∞ ∞ f ( x ) ∂ g ( x ) ∂ x ( 1 ) d x ( 1 ) + ∫ − ∞ ∞ g ( x ) ∂ f ( x ) ∂ x ( 1 ) d x ( 1 ) \lim_{a\rightarrow \infty , b\rightarrow -\infty} f(a, x^{(2)}, ... , x^{(n)}) g(a, x^{(2)}, ... , x^{(n)}) - f(b, x^{(2)}, ... , x^{(n)}) g(b, x^{(2)}, ... ,

文章介绍了生成模型的两大类:基于似然的模型(如VAE、正则化流模型)和隐式生成模型(如GAN)。重点讨论了ScoreMatching技术,这是一种用于估计非规范化统计模型的方法,解决了概率分布归一化问题。ScoreMatching通过优化模型参数使其输出的梯度逼近真实数据分布的梯度。此外,文章还提到了SlicedScoreMatching和DenoisingScoreMatching,它们是ScoreMatching的变体,分别解决了计算效率和噪声样本分布的问题。DenoisingScoreMatching通过在原始数据上添加噪声来优化模型,从而生成更准确的数据分布。
最低0.47元/天 解锁文章
1万+






