Forward Process (adding noise)
Start with a clean image
적은 양의 Gaussian noise를 steps에 걸쳐 점진적으로 추가
steps이후 는 완전히 noise만 남은 이미지가 됨(정규분포를 따름) ~

Reverse Process (removing noise)
key idea: 모든 단계에서 noise를 정확히 예측할 수 있다면, backward 과정을 통해 random noise를 realistic data로 바꿀 수 있다.
neural network 를 train시켜, 각 시점 T에서 추가된 noise를 예측하도록 함
예측된 noise를 제거하여 조금 더 clean한 sample 을 얻음
이 과정을 0 step까지 반복

forward에서 noise가 어떻게 넣어졌는지 이미 알고있기에 이를 label삼아 supervised learning을 진행하며 noise를 제거함 (farward noise를 예측하는 방식)
set variance (usually 1e-4…0.02) such that

→ 정보 손실을 최소화하기 위해 초기 단계에서는 noise를 조금만 추가(아주 작은 값)하여 세부 정보를 최대한 보존하고, 후반 단계로 갈 수록 noise를 더 많이 추가(큰 값)함
A clever trick lets us jump directly to any step (순차적으로 noise를 추가하지 않고 수학적으로 한번에 계산할 수 있음 → 학습 속도 빨라짐)

where

→ 를 얻게 되면 해당값 얻을 수 있음
⇒ We can sample noisy pairs (, ) without running T steps, speeding up training

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 학습

학습된 noise model을 가지고 순차적으로 noise를 제거하는 과정
The one-step reverse Markov kernel is Gaussian with

모델이 예측한 noise
는 이미 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이 올래 걸림
