Diffusion Model이란?

2한나·2026년 1월 31일

The Core Intuition (Without Heavy Math)

  • Forward Process (adding noise)

    • Start with a clean image x0x_0

    • 적은 양의 Gaussian noise를 TT steps에 걸쳐 점진적으로 추가

    • TT steps이후 xTx_T는 완전히 noise만 남은 이미지가 됨(정규분포를 따름) xTx_T~N(0,I)N(0,I)

  • Reverse Process (removing noise)

    • key idea: 모든 단계에서 noise를 정확히 예측할 수 있다면, backward 과정을 통해 random noise를 realistic data로 바꿀 수 있다.

    • neural network ϵθ(xt,t)\epsilon_\theta(x_t,t)를 train시켜, 각 시점 T에서 추가된 noise를 예측하도록 함

    • 예측된 noise를 제거하여 조금 더 clean한 sample xt1x_{t-1}을 얻음

    • 이 과정을 0 step까지 반복

      forward에서 noise가 어떻게 넣어졌는지 이미 알고있기에 이를 label삼아 supervised learning을 진행하며 noise를 제거함 (farward noise를 예측하는 방식)

Forward (Noise) Schedule

  • set variance β1,...,βT\beta_1,...,\beta_T (usually 1e-4…0.02) such that

    → 정보 손실을 최소화하기 위해 초기 단계에서는 noise를 조금만 추가(아주 작은 β\beta값)하여 세부 정보를 최대한 보존하고, 후반 단계로 갈 수록 noise를 더 많이 추가(큰 β\beta 값)함

  • A clever trick lets us jump directly to any step (순차적으로 noise를 추가하지 않고 수학적으로 한번에 계산할 수 있음 → 학습 속도 빨라짐)

    where

    β\beta를 얻게 되면 해당값 얻을 수 있음

⇒ We can sample noisy pairs (xtx_t, x0x_0) without running T steps, speeding up training

Training Objective (Samplified)

  • Diffusion Model은 noise를 학습함

  • minimize

for epoch
	for batch <- iteration
		pick a random time t
		clean img <- batch에서 가져온 이미지
		noise $\epsilon$ <- f(img, t)
		noisy한 img $x_t$ ← $\sqrt{\bar{\alpha}_t}\, x_0 + \sqrt{1 - \bar{\alpha}_t}\,\epsilon$
		NN를 통해 $\epsilon_\theta$ 예측
		Loss <- MSE Loss ($\epsilon, \epsilon_\theta$)
		Loss backward 학습

Sampling / Inference

  • 학습된 noise model을 가지고 순차적으로 noise를 제거하는 과정

  • The one-step reverse Markov kernel pθ(xt1xt)p_\theta(x_{t-1}|x_t) is Gaussian with

    모델이 예측한 noise

    α,β\alpha, \beta는 이미 training 단계에서 모두 결정되어 있음

  • Becasue the variance is known in clsed-from, we sample

    denoising 식

    except at t=1 where we usally skip the noise to finish exactly on the image

  • denoising 단계가 1000번이라면, step 1000 → step1 이 과정을 반복하므로 sampling이 올래 걸림

0개의 댓글