๐ [The Principles of Diffusion Models] ์๋ฆฌ์ฆ
- 1๏ธโฃ ( Part A ) ์ดํดํ๊ธฐ
- 2๏ธโฃ ( Part B ) CH 2. VAE
- 3๏ธโฃ ( Part B ) CH 2. DDPM (with VAE)
์์ํ๊ธฐ์ ์์ ..
์ต๊ทผ ์ผํ๋ฉด์ , ๋ ผ๋ฌธ ์์ฑํ๊ณ , ๊ต์ก๋ฃ๊ณ .... (์๋ฒ๋ฅผ ๋ ๋ ค๋จน๋ ์ฌ๊ณ ๋ฅผ..) ํ๋ค๋ณด๋๊น ์ ์ ์ด ํ๋๋ ์์ด์ ๊ณต๋ถ ์์ฒด๋ฅผ ๊น๊ฒ ๋ชปํ๋๋ฐ ํํํ ์๊ฐ์ ๋น๋ ค์ The Principles of Diffusion Models ๋ผ๋ ์ต์ ๋ ผ๋ฌธ์ ์ญ ์ก๊ณ ์ฝ์ด๋ณผ๊น ํ๋ค. ๋, ๊ธฐ๋ก์ ๋จ๊ฒจ์ ๋ง์ ์ฌ๋๋ค์ด ์ฐธ๊ณ ํ์ผ๋ฉด ์ข๊ฒ ๋ค๋ ์๊ฐ์ผ๋ก ์ ๋ฆฌํ๊ณ ์ ํ๋ค. ๋ํจ์ ๋ฟ๋ง ์๋๋ผ ์์ฑํ ๋ชจ๋ธ์ ๊น๊ฒ ๋น ์ ธ๋ณด๋ ์๊ฐ์ ๊ฐ์ง๊ณ , ์ธ์ฌ์ดํธ๋ฅผ ์ป๊ณ ์ ํ๋ค. ( ์ฌ์ฌ ๋ํจ์ ์ ๋ํด์ ๊ธฐ์ต์ด ๊ฐ๋ฌผ๊ฐ๋ฌผํ๋ค.. )
์ผ๋จ ์ ๋ ผ๋ฌธ์ ๋ํจ์ ์ ์ ๋ช ํ ์ ์๋ค์ด ์ํ์ ์๋ฆฌ์ ๋ฐ์ ๊ณผ์ ์ ๋งค์ฐ ์ฒด๊ณ์ ์ผ๋ก ์ ๋ฆฌํ ๋ ผ๋ฌธ์ด๋ค. VAE , EBM , Nomrlaizing Flow ์์ ์ถ๋ฐํด variational, score-based, flow-based ๊ด์ ์ผ๋ก ์ฐ๊ฒฐ์ํค๋ฉฐ ์ค๋ช ํ๋ค. ๋ , ๋ํจ์ ์ ์ํ๋ง ์๋๋ ์ง์ ํ์ตํ๊ณ ๊ตฌํํ๋ ๋ฐฉ๋ฒ์ ๊ตฌ์กฐ์ ์ผ๋ก ์ ๋ฆฌํ๊ณ ์๋ค.
( ์ต๊ทผ์ ์ง์ ๋ํจ์ ์ ๊ตฌํํ๋ ํด์ธ ์คํฐ๋๋ฅผ ์ฐธ๊ฐํ ์ ์ด ์๋๋ฐ ๊ธ ์์ฑํ๋ฉด์ ์ถ๊ฐ์ ์ผ๋ก ์ ๋ฆฌํ๋๋ก ํ๊ฒ ๋ค. )
์ฝ๋ค๊ฐ ์ดํด๊ฐ ์๊ฐ๊ฑฐ๋ ์คํ๊ฐ ์๊ฑฐ๋ , ๋ ผ๋ฆฌ์ ์ผ๋ก ํ๋ฆฐ ๋ถ๋ถ์ด ์์ผ๋ฉด ๋ง์ํด์ฃผ์ธ์
๋จผ์ ๋
ผ๋ฌธ์์๋ ํฌ๊ฒ 3๊ฐ์ง๋ฅผ ํตํด์ diffusion model ์ ์ดํดํ๊ณ ์ฌ์ธต์ ์ผ๋ก ์ดํดํ ์ ์๋๋ก ๋๋๋ค๊ณ ๋ช
์๋์ด ์๋ค.
- Varitational View
- Score-Based View
- Flow-Based View
์ด 3๊ฐ๋ฅผ ๊ฐ๊ฐ ๋ฐฐ์ด ๋ค ch6 ์์ ์ 3๊ฐ์ง ํํธ๊ฐ ๊น๊ฒ ์ฐ๊ด๋์ด ์์์ ๋ฐฐ์ธ ์ ์๋ค.

cf. ๊ธฐํธ๊ฐ ์ดํด๊ฐ ๊ฐ์ง ์๋๋ค๋ฉด Notations ์ ์ฐธ๊ณ ํ๋ฉด ์ข๋ค. ( ๋ ผ๋ฌธ๋ค๋ง๋ค ๊ธฐํธ์ ๋ํ ์๋ฏธ๊ฐ ์กฐ๊ธ์ฉ ๋ค๋ฅด๊ฑฐ๋ ์๊ธฐ ์คํ์ผ๋๋ก ์ฐ๋ ๊ฒฝ์ฐ๊ฐ ์์ด์ ํท๊ฐ๋ฆฐ๋ค๋ฉด ์ฐธ๊ณ ํ๋๊ฒ ์ข๋ค. )
๋ค ์ค๋ช ํ๊ธฐ ๋ณด๋ค ์ต๋ํ ํต์ฌ ๋ด์ฉ ์์ฃผ๋ก ์ ๋ฆฌํ๊ณ ์ํ๋ค ( ์์ด ์ข ๋ง๋ค. )
Part A : Introduction to Deep Generative Modeling
Deep Generative Models ( DGM )
- ์ ๋ ฅ : high-dimension data ( ์ด๋ฏธ์ง , ํ ์คํธ , ์ค๋์ค ๋ฑ.. )
- ์ญํ : ํด๋น ๋ฐ์ดํฐ๋ค์ด ๋ฐ๋ฅด๋ ํ๋ฅ ๋ถํฌ ์ ์ฒด๋ฅผ ํ์ตํ๋ค.
- ํ๋ฅ ๋ถํฌ ( probaility distribution ) : ๋ฐ์ดํฐ๊ฐ ์์ฑ๋๋ ๊ท์น
ex )
P_data : ์ง์ง ์ธ์์ ๋ถํฌ ( ์ด์ธ์์ ์กด์ฌํ๋ ๋ชจ๋ ๊ณ ์์ด ์ด๋ฏธ์ง์ ๊ท์น ) -> ์ฐ๋ฆฐ ์ด๊ฑธ ์ ์ ์์
P_phi (๋ชจ๋ธ๋ถํฌ) : ๋ชจ๋ธ์ด ์์ฑํ ๋ถํฌ ( ์ฌ๊ธฐ์ phi = ๋ชจ๋ธ์ ๋ชจ๋ ํ์ต๊ฐ๋ฅํ ํ๋ผ๋ฏธํฐ )
1. P_data ๋ฅผ ์ ์ ์์ผ๋ ( ํ์ค์ ์ผ๋ก ๋ถ๊ฐ๋ฅํ๋ )
2. ์ ํ๊ฐ์ ๋ฐ์ดํฐ์ํ(P_data_hat) ์ ๊ฐ์ง๊ณ P_data ๋ฅผ ์ถ์ ํ๊ฒ ๋ค ์ด๋ป๊ฒ ?
3. loss function ์ ํตํด์ P_phi ๋ฅผ ์ฐพ๋๋ค.
์ด๋ ๊ฒ ํ๋ฉด P_phi ๊ฐ P_data ๋ฅผ ๊ทผ์ฌํ ์ ์๋ค .
( P_phi(x) , P_Data(x) ๋ ๋ชจ๋ ํ๋ฅ "๋ถํฌ". )
๊ทธ๋์ ์ด ๋ชจ๋ธ (DGM) ์ ๋จ์ํ ๋ถ๋ฅ๊ฐ์ ๊ฑธ ํ๋๊ฒ ์๋๋ผ
- ์ถ๋ ฅ/๋ฅ๋ ฅ : ๊ทธ ๋ถํฌ์์ ์๋ก์ด ์ํ x ๋ฅผ ๋ฝ์ ์ ์๊ฒ ํด์ฃผ๋ ๋ชจ๋ธ์ด๋ค.
๋ฐ์ดํฐ์์ ์จ๊ฒจ์ง ๋ถํฌ๋ฅผ ํ์ตํ๋ค ๋ถํฌ๋ฅผ ๊ทผ์ฌํด์ ์ ๋ฐ์ดํฐ๋ ๋ง๋ค์ด ๋ผ ์ ์๋ ๊ฒ์ด๋ค !
( ์ด๊ฑธ ์ผ๋ง๋ ์ ํ๋๋์ ๋ฐ๋ผ์ ์์ฑ๋ชจ๋ธ์ ๋ฅ๋ ฅ์ด ๋ฌ๋ผ์ง๋ค.
๋ฐ์ดํฐ๊ฐ ์ ํํ๊ธฐ ๋๋ฌธ์ ๋ฐ์ดํฐ๋ discrete ํ ์๋ฐ์ ์๋๋ฐ ํ์ต์ ํตํด์ ์ด ๋ฐ์ดํฐ์ ๋ถํฌ๋ฅผ ํ์ตํ๋ฉด ํ์ต๋ ๋ชจ๋ธ์ discrete ํ์ง ์์ ๋ฐ์ดํฐ์ ๋ํด์๋ ์์ฑํ๋ ๋ฅ๋ ฅ์ด ์๊ธด๋ค๊ณ ์ดํดํ๋ฉด ํธํ ๋ฏ? )
+ ์ถ๊ฐ๋ก ๋ฐ์ดํฐ์ ์ ์ง์ง ๋ถํฌ P_data(x) ์์ ๋ ๋ฆฝ ์ผ๋ก ๋์จ๊ฒ์ด๋ผ๊ณ ๊ฐ์ ( i.i.d sample )
1.1 what is Deep Generative Modeling ?
DGM ์ ๋ชฉํ
1. Realistic Generation : ์ง์ง ๋ฐ์ดํฐ ์ฒ๋ผ ๋ณด์ด๋ ์ํ ์์ฑ
2. Controllable Generation : ๋๋คํ๊ฒ ๋ฝ๋๊ฒ ์๋๋ผ ์ํ๋ ๋ฐฉํฅ์ผ๋ก ์ ์ดํ ์ ์๋๋ก ํ๋๊ฒ.
1.1.1 mathematical Setup

Goal of DGM.
์์์๋ ์ด์ผ๊ธฐ ํ๋ฏ์ด P_t(X) ๋ก P_data(x) ๋ฅผ ๊ทผ์ฌํ๋๊ฒ์ด ๋ชฉ์ ์ด๋ค. ์ด๋ tractable ํ ์์์ด์ผํ๋ค ( ์ํ์ ( ๊ณ์ฐ์ ์ผ๋ก ) ๋ค๋ฃฐ ์ ์์ด์ผํจ - P_theta(x) ๋ฅผ ๊ณ์ฐํ๋ค๋๊ฐ , ์ํ๋ง ํ๋ค๋์ง ) .

Capability of DGM.
P_theta(x) ๊ฐ ์์ผ๋ฉด ํ ์ ์๋ ๊ฒ๋ค
1. ์ํ๋ง
2. Likelihood ํ๊ฐ
Training of DGM

DGM ์ ํ์ต๋ฐฉ๋ฒ์ ๋ชจ๋ธ ํ๋ผ๋ฏธํฐ๋ฅผ ์ง์ง๋ถํฌ(P_data) ์ ๊ฐ์ง๋ชจ๋ธ (P_theta ) ์ฌ์ด์ ์ฐจ์ด๋ฅผ ์ค์ด๋ ๊ฒ์ด๋ค.
๋ฐ๋ผ์ ๋์ ์ต์๊ฐ ๋๋๋ก ํ๋ผ๋ฏธํฐ๋ฅผ ํ์ต์ํค๋ ๊ฒ์ด๋ค.
Forward KL and Maximum Likelihood Estimation (MLE).
๊ฐ์ฅ ๊ธฐ๋ณธ์ด ๋๋ ์์๋ค์ ์๊ฐํ๊ณ ๊ฐ๋ค.

๊ฐ์ฅ ๊ธฐ๋ณธ์ด ๋๋ KL divergence ์ ์์์ด๋ค.

< minimizing D_kl(pdataโฅpฯ) encourages mode covering >
๊ทธ๋ฅ ์ดํดํ๊ธฐ๋ ์ด๋ ค์ธ ์ ์์ด์ ์ ๋นํ ํด์ค์ ๋ฌ์๋ณผ๊นํ๋ค.
๋ง์ฝ์ ๋ฐ์ดํฐ ๋ถํฌ์์ P_data(A) > 0 ์ธ ์ด๋ค ์งํฉ A ๊ฐ ์๋๋ฐ , ๋ชจ๋ธ ๋ถํฌ๊ฐ ๊ทธ ์์ญ์์ P_t(x) = 0 ์ด๋ผ๋ฉด ์์์
log(P_data(A) / 0 ) -> +inf ๋ก ๋ฐ์ฐํ๊ฒ ๋๊ณ KL ์ด ๋ฌดํ๋๊ฐ ๋๋ค.
์ด๊ฒ ์ฝ๊ฒ ์ค๋ช ํด์ ๋ฌด์จ๋ง์ด๋๊ณ ํ๋ฉด
- ์ด๋ค ์์ญ A ์์ ๋ฐ์ดํฐ๊ฐ ์์ฃผ ๊ฐ๋ ๋์ค๋๋ฐ ( P_data(A) > 0 )
- ๋ชจ๋ธ์ด ์ฌ๊ธฐ์๋ ๋ฐ์ดํฐ๊ฐ ์๋์จ๋ค๊ณ ํ๋ฉด ( P_t(x) = 0 ) ์ผ๋ก ์ค์ ๋๊ณ ( ์ด๋ผ ๋ก๊ทธ๊ฐ ๋ฐ์ฐํด๋ฒ๋ฆผ )
- ๊ทธ ์์ญ์์ KL ์ด ๋ฌดํ๋๊ฐ ๋์ด๋ฒ๋ฆฐ๋ค.
์ด๋ ๊ฒ ๋๋ฉด KL ์ ์ต์ํํด์ผํ๋ ์ ์ฅ์์ "๋ฐ์ดํฐ๊ฐ ์ค์ ๋ก ๋์ค๋๊ณณ P_data(x) > 0 ์ ์ ๋ ํ๋ฅ 0์ ๋๋ฉด ์๋๊ฒ ํ๋ค. "
( ์? ๋๋ฌด ์ปค์ง๋๊น ! )
์ด๋ฐ ํ๋์ mode covering ์ด๋ผ๊ณ ๋ถ๋ฅธ๋ค.
mode ๋ ๋ด์ฐ๋ฆฌ๋ฅผ ๋งํ๋๋ฐ forward KL ์ ๋ชจ๋ ๋ด์ฐ๋ฆฌ๋ฅผ ์ ์งํ๋ ค๊ณ ๋ ธ๋ ฅํ๋ค ( ์์ผ๋ฉด ๋๋ฌด ํฐ ํจ๋ํฐ๊ฐ ์๊ธฐ ๋๋ฌธ )
๋ค์ ๋์๊ฐ์. ๊ทธ๋์ ์ด๋ฌํ ์ด์ ๋ก D_KL(p_data || p_t ) ๋ฅผ ์ฌ์ฉํ๊ฒ ๋๋๊ฒ์ด๋ค.
cf. kl divergence & moe covering ์ ๋ํด์๋ ์ถ๊ฐ์ ์ผ๋ก ๋ธ๋ก๊ทธ ์ฐธ์กฐ.
https://angeloyeo.github.io/2020/10/27/KL_divergence.html
https://process-mining.tistory.com/147


๋ค์ KL ๋ก ๋์์์ ์๊น๋ ๋ณด์ง ๋ชปํ๋ H(p_data) ๊ฐ ์๊ฒผ๋๋ฐ ์ด๋ ๋ฐ์ดํฐ ๋ถํฌ์ ์ํธ๋กํผ๋ผ์ ํ๋ผ๋ฏธํฐ์ ์๊ด์๋ ์์์ด๋ค. ๋ฐ๋ผ์ ์ฐ๋ฆฌ๊ฐ ์กฐ์ ํ ์ ์๋ ๋ถ๋ถ์ log(P_t(x)) ์ ๊ธฐ๋๊ฐ์ด๋ค.

๊ทธ๋ ๋ค๋ฉด ์์์ ์ด๋ ๊ฒ ๋ฐ๊ฟ ์ ์๋๋ฐ
Forward KL ์ ์ต์ํ ํ๋๊ฒ <=> ๋ฐ์ดํฐ์ ๋ํ ํ๊ท log-likelihood ๋ฅผ ์ต๋ํ ํ๋ ๊ฒ๊ณผ ๊ฐ๋ค.
(Kl min <-> MLE)
cf.
forward KL ์์ ๊ฒฐ๊ตญ ์ํฅ์ ์ฃผ๋ ํญ์ ํ๋๋ฐ์ ์๋ค ( E_pdata(...))
KL ์ด ๋ชจ๋ธ์๊ฒ ๋ฐ์ดํฐ๊ฐ ์์ฃผ ๋์ค๋ X ์์ ๋ชจ๋ธ๋ ํฐ log prob ๋ฅผ ์ฃผ๋ผ๋ ๋ป์ด๋ค.
-> ๋ฐ์ดํฐ๊ฐ ์์ฃผ ๋์ค๋ ํฌ์ธํธ๊ฐ ์ค์๋๊ฐ ๋๋ค -> ๊ทธ๋ผ ๊ทธ x ์ ๋ํด์ ๋ชจ๋ธ ํ๋ฅ ์ ํฌ๊ฒ ๋ง๋ ๋ค -> logP(x) ๋ฅผ ํฌ๊ฒ ๋ง๋ ๋ค. ( max log p(x) )
์ฆ, forward KL ์ ๋ฐ์ดํฐ๊ฐ ์์ฃผ ๋์ค๋ ๊ณณ์์ ๋ชจ๋ธ ํ๋ฅ ์ ํฌ๊ฒ ํ๋๋ก ๋ง๋ค๊ฒ ๋๋ค.


๊ฒฐ๊ตญ ์ด๋ฐ์์ผ๋ก ์ ๋ฆฌํ ์ ์๊ฒ ๋๋ค.
์ง๊ด์ ์ธ ๋ชฉ์ ์ผ๋ก ๋ค์ ์ ๋ฆฌํ๋ฉด (with gpt )
MLE์ ์ง๊ด์ ๋ชฉ์ :
๋ชจ๋ธ์ด ์ด ๋ฐ์ดํฐ๋ฅผ ‘๊ฐ์ฅ ์ ์ค๋ช ํ๊ฒ’ ํ๋ผ.
Forward KL์ ์๋ฏธ๋:
๋ชจ๋ธ์ด ๋ฐ์ดํฐ ๋ถํฌ์ ๊ฐ์ ๋ถํฌ๊ฐ ๋๋๋ก ๋ง๋ค๋ผ.
๋ ๋ค “๋ฐ์ดํฐ ๋ถํฌ๋ฅผ ์ต๋ํ ๋ชจ๋ฐฉ”ํ๋ค.
Fisher Divergence
fisher divergence ๋ score based diffusion modeling ์์ ์ค์ํ ์ปจ์
์ด๋ค.


--> ์ฌ๊ธฐ์ ๋ค ํ๊ณ ๊ฐ๋ฉด ๋๋ฌด ๋ฌด๊ฑฐ์์ chapter 3 ๋ฅผ ํ ๋ ๋ค์ ์ ๋ฆฌํ๊ณ ์ํ๋ค. (score ๊ฐ๋ ๋ถํฐํด์ ... ์ ๋ถ๋ค ์ ๋ฆฌ )
์ด์จ๋ ํ๋ ์์์ผํ ์ ์ diffusion ์ญ์ score base ๋ผ๋๊ฑฐ
-> ( noise ๋ฅผ ์์ธกํ๋ ๋ฐฉ์์ผ๋ก ๋ฐ์ดํฐ๋ถํฌ์ score ๋ฅผ ํ์ตํ๋ ๋ชจ๋ธ )
Beyond KL
-> ch 7 ์์ ๋ค์ ์ ๋ฆฌ
1.1.2 Challenges in Modeling Distributions
๋ค์ ์ ๋ฆฌ๋ฅผ ํ์๋ฉด ์ฐ๋ฆฌ๊ฐ ์ง์ง๋ก ํ๊ณ ์ถ์์ผ์
- ์ง์ง ๋ฐ์ดํฐ ๋ถํฌ P_data(x)
- ๋ง๋๋ ๋ชจ๋ธ P_t(x)
๋ชฉํ : P_t(x) ๊ฐ P_data(x) ๋ฅผ ์ต๋ํ ์ ๊ทผ์ฌํ๋๋ก ์ข์ pdf ๋ฅผ ์ ๊ฒฝ๋ง์ผ๋ก ๋ง๋ ๋ค. ๊ทธ๋ฆฌ๊ณ ์ด๊ฑธ๋ก ์ํ๋งํ๊ณ likelihood ๋ ๊ณ์ฐ์ ํ์. ํ์ง๋ง pdf ๊ฐ ๋๋ ค๋ฉด ์๋์ ๊ฐ์ ๋๊ฐ์ง ์กฐ๊ฑด์ ๋ง์กฑํด์ผํ๋ค.
๋๊ฐ์ง ์กฐ๊ฑด

step 1 : Ensuring Non-Negativity

๊ฐ์ฅ ํํ๊ฒ ์ฐ๋๊ฒ exponential ์ด๋ผ์ ์ด๋ ๊ฒ ๋์์๋๋ฏ. ๊ทธ๋์ ์ด p~โฯโ(x) ๋ ํญ์ 0๋ณด๋ค ํฌ๋ค.
ํ์ง๋ง ์์ง ์ ๋ถ์ด 1 ์ ์๋๋ค ( unnormalized dnesity )
Step 2: Enforcing Normalization.
์ด์ p~โฯโ(x) ์ด ํญ์ positive ์ธ๊ฒ์ ํด๊ฒฐํ์ง๋ง ์์ง ํ๋ฅ ๋ฐ๋ (pdf) ๋ ์๋๋ค. ๊ทธ๋์ ์ด๊ฑธ ์ง์ง ํ๋ฅ ๋ฐ๋ ํจ์ (pdf) ๋ก ๋ง๋ค๊ธฐ ์ํด์

๋ค์๊ณผ ๊ฐ์ด ์ค์ผ์ผ์ ๋ง์ถฐ์ค๋ค

๋ถ๋ชจ๋ ๋ค์๊ณผ ๊ฐ์ด ์๊ธฐ๊ณ ,

๊ทธ๋ฆฌ๊ณ ์ด๊ฑธ normalizing constant / partition function์ด๋ผ๊ณ ๋ถ๋ฅธ๋ค.
์ด๋ ๊ฒ ๊ตฌ์ฑํ๋ฉด
๋ถ์ : ํญ์ ์์
๋ถ๋ชจ : ์ ์ฒด ์ ๋ถ๊ฐ
๋ค์ ์ ๋ฆฌํด๋ณด๋ฉด
1. ์ ๊ฒฝ๋ง์ด (Eฯ(x) ) ๋ฅผ ๋ง๋ฌ.
2. exp ์์์ p~โฯโ(x) ๋ง๋ฌ.
3. ์ ์ฒด์ ๋ถ ๋ก ๋๋ ์ ์ ์์ ์ธ pdf pฯ(x) ๋ฅผ ๋ง๋ ๋ค.
๊ฐ๋จํด ๋ณด์ด์ง๋ง ์ฌ๊ธฐ์ ๋ค์ ๋ฌธ์ ๊ฐ ์๊ธด๋ค.
๋ฌธ์ . high-demension problem
- ์ ๋ ฅ ์ฐจ์์ด ๋๋ฌด ํฌ๋ค -> ์ฝ์ฐจ์ ๊ณต๊ฐ์ ๋ํด์ ์ ๋ถํด์ผ Z(ฯ) ์ ์ ์๋ค. ํ์ง๋ง ์ด ๊ณ์ฐ์ด ๋งค์ฐ ์ด๋ ต๋ค.
๊ทธ๋์ ๊ฒฐ๊ตญ partition function Z(ฯ) ๋๋ฌธ์ ๋ชจ๋ ๊ฒ ๋งํ๊ฒ ๋๋ค.
์ด๊ฒ ๋ชจ๋ธ๋ง์ ๋์ ์ด๋ค.
๊ทธ๋์ ์ด๊ฒ์ ์ ํด๊ฒฐํด ๋ณด๊ณ ์ ์ฌ๋ฌ๊ฐ์ง DGM ๋ค์ด ๋์์ z ๋ฌธ์ ๋ฅผ ์ฐํํ๊ฑฐ๋ ์ค์ด๋ ๋ฐฉ์์ผ๋ก ๋ชจ๋ธ์ด ๋ฐ์ ๋๋ค.
์ด์ ๋ํ ๋ ์์ธํ ์ด์ผ๊ธฐ๋ ์ด์ผ๊ธฐ๋ฅผ ์งํํ๋ฉด์ ๋ ์ค๋ช ํด๋ณด๋๋ก ํ๊ฒ ๋ค .
1.2 Prominent Deep Generative Models

high-dimensional data ์ ํ๋ฅ ๋ถํฌ๋ฅผ ์ ๋ชจ๋ธ๋ง ํ๊ณ ์ถ์๊ฒ์ด ์์ฑํ ๋ชจ๋ธ์ ํฐ ์ฑ๋ฆฐ์ง์ด๋ค.
๊ทธ๋ฐ๋ฐ normalization , efficiency , expressiveness ์ ๋ํ trade-off ๊ฐ ๊ฐ ๋ชจ๋ธ๋ง๋ค ๋ชจ๋ ๋ค๋ฅด๋ค. ์ฐ์ ๊ทธ๋ฆผ ์ฒ๋ผ ๋ค์ํ ๋ชจ๋ธ๋ค์ด ์กด์ฌํ๋ค. ์ฌ๊ธฐ์ ๋ค ์์ธํ๊ฒ ๋ค๋ฃจ์ง๋ ์๊ณ part B ์ ๊ฐ์์ผ ๊ฐ ์ฑํฐ๋ณ๋ก ๊น๊ฒ ๋ค์ด๊ฐ๋ค.
์ ๋ชจ๋ธ๋ค์ด ๋งค์ฐ ์ ๋ช ํ๊ธฐ๋ ํ๊ณ ๊ธฐ๋ณธ์ ์ธ ๋ชจ๋ธ์ด๊ธฐ ๋๋ฌธ์ gpt ๋ฅผ ๋๋ ค์ ์ ๊น ์ ๋ฆฌ๋ง ํ๊ณ ๋ค์์ผ๋ก ๋์ด๊ฐ๊นํ๋ค. ( ์ดํ์ part b ์์๋ ์กฐ๊ธ ๋ ์์ธํ ์ค๋ช ํด๋ณด๊ฒ ๋ค . )

-> ๊ถ๊ธํ๋ค๋ฉด ํด๋น ๋ถ๋ถ์ ๊ทธ๋๋ก ๋ถ์ฌ๋ฃ๊ธฐํด์ gpt ์๊ฒ ์ค๋ช ํด๋ฌ๋ผ๊ณ ํ์.
[role] ์๋ ๋ณธ๋ฌธ์ ์์ธํ๊ฒ ์ค๋ช ํ ๊ฒ. ๊ทธ๋ฆฌ๊ณ ์๋ ๋ช ์ํ ๋ด์ฉ์ ๋ฐ๋์ ์ค๋ช ํ ๊ฒ.
(๋ฐ๋์ ์ค๋ช
์ ํฌํจ์์ผ์ผ ๋ ๋ถ๋ถ )
1. EBMs -> diffusion ๊ณผ ์ฐ๊ฒฐ๋๋ ๋ถ๋ถ
2. VAE ์์ elbo ์ ๋ํ ๊ฐ๋จํ ์ค๋ช
3. “flow-based ๊ฐ๋
(์ฐ์์ ์ธ ๋ณํ, ODE/SDE)์ ๋น๋ฆฌ๋,
invertible ์ ์ฝ์ด๋ Jacobian ๊ณ์ฐ ๋ถ๋ด์ ์ค์ด๊ณ ,
ํ๋ฅ ๋ถํฌ๋ score ๊ธฐ๋ฐ์ผ๋ก ๋ค๋ฃจ๋ ๋ฐฉ์” --> ์ด ๋ถ๋ถ์ ๋ํด์
[๋ณธ๋ฌธ]
Energy-Based Models (EBMs). EBMs (Ackley et al., 1985; LeCun et al.,
2006) define a probability distribution through an energy function Eฯ(x) that
assigns lower energy to more probable data points. The probability of a data
point is defined as:
pฯ(x) := 1
Z(ฯ) exp(−Eฯ(x)),
where
Z(ฯ) = exp(−Eฯ(x))dx
is the partition function. Training EBMs typically involves maximizing the
log-likelihood of the data. However, this requires techniques to address the
computational challenges arising from the intractability of the partition func
tion. In the following chapter, we will explore how Diffusion Models offer an
alternative by generating data from the gradient of the log density, which does
not depend on the normalizing constant, thereby circumventing the need for
partition function computation.
Autoregressive Models. Deep autoregressive (AR) models (Frey et al., 1995;
Larochelle and Murray, 2011; Uria et al., 2016) factorize the joint data
distribution pdata into a product of conditional probabilities using the chain
rule of probability:
D
pdata(x) =
i=1
pฯ(xi|x<i),
where x = (x1,...,xD) and x<i = (x1,...,xi−1).
Each conditional pฯ(xi|x<i) is parameterized by a neural network, such as a
Transformer, allowing flexible modeling of complex dependencies. Because each
term is normalized by design (e.g., via softmax for discrete or parameterized
Gaussian for continuous variables), global normalization is trivial.
1.2. Prominent Deep Generative Models
23
Training proceeds by maximizing the exact likelihood, or equivalently
minimizing the negative log-likelihood,
While AR models achieve strong density estimation and exact likelihoods,
their sequential nature limits sampling speed and may restrict flexibility due
to fixed ordering. Nevertheless, they remain a foundational class of likelihood
based generative models and key approaches in modern research.
Variational Autoencoders (VAEs). VAEs (Kingma and Welling, 2013) ex
tend classical autoencoders by introducing latent variables z that capture
hidden structure in the data x. Instead of directly learning a mapping between
x and z, VAEs adopt a probabilistic view: they learn both an encoder, qθ(z|x),
which approximates the unknown distribution of latent variables given the
data, and a decoder, pฯ(x|z), which reconstructs data from these latent vari
ables. To make training feasible, VAEs maximize a tractable surrogate to the
true log-likelihood, called the Evidence Lower Bound (ELBO):
LELBO(θ,ฯ;x) = Eqθ(z|x) [logpฯ(x|z)] − DKL (qθ(z|x)โฅpprior(z)).
Here, the first term encourages accurate reconstruction of the data, while the
second regularizes the latent variables by keeping them close to a simple prior
distribution pprior(z) (often Gaussian).
VAEs provide a principled way to combine neural networks with latent
variable models and remain one of the most widely used likelihood-based
approaches. However, they also face practical challenges, such as limited
sample sharpness and training pathologies (e.g., the tendency of the encoder
to ignore latent variables). Despite these limitations, VAEs laid important
foundations for later advances, including diffusion models.
Normalizing Flows. Classic flow-based models, such as Normalizing Flows
(NFs) (Rezende and Mohamed, 2015) and Neural Ordinary Differential Equa
tions (NODEs) (Chen et al., 2018), aim to learn a bijective mapping fฯ
between a simple latent distribution z and a complex data distribution x via
an invertible operator. This is achieved either through a sequence of bijective
transformations (in NFs) or by modeling the transformation as an Ordinary Dif
ferential Equation (in NODEs). These models leverage the “change-of-variable
formula for densities”, enabling MLE training:
log pฯ(x) = logp(z) +logdet ∂f−1
ฯ (x)
∂x ,
24
Deep Generative Modeling
where fฯ represents the invertible transformation mapping z to x. NFs explicitly
model normalized densities using invertible transformations with tractable
Jacobian determinants. The normalization constant is absorbed analytically
via the change-of-variables formula, making likelihood computation exact and
tractable.
Despite their conceptual elegance, classic flow-based models often face prac
tical limitations. For instance, NFs typically impose restrictive architectural
constraints to ensure bijectivity, while NODEs may encounter training ineffi
ciencies due to the computational overhead of solving ODEs. Both approaches
face challenges when scaling to high-dimensional data. In later chapters, we
will explore how Diffusion Models relate to and build upon these classic
f
low-based methods.
Generative Adversarial Networks (GANs). GANs (Goodfellow et al., 2014)
consist of two neural networks, a generator Gฯ and a discriminator Dζ, that
compete against each other. The generator aims to create realistic samples
Gฯ(z) from random noise z ∼ pprior, while the discriminator attempts to
distinguish between real samples x and generated samples Gฯ(z). The objective
function for GANs can be formulated as:
min
Gฯ
max
Dζ
Ex∼pdata(x)[logDζ(x)]
real
+Ez∼pprior(z) [log(1 − Dζ (Gฯ(z)))]
fake
.
GANsdonot define an explicit density function and therefore bypass likelihood
estimation entirely. Instead of computing a normalization constant, they focus
on generating samples that closely mimic the data distribution.
From a divergence perspective, the discriminator implicitly measures
the discrepancy between the true data distribution pdata and the generator
distribution pGฯ
, where pGฯ
denotes the distribution of generated samples
Gฯ(z) obtained from noise z ∼ pprior. With an optimal discriminator for a
f
ixed generator Gฯ computed as
pdata(x)
pdata(x) + pGฯ
(x) ,
the generator’s minimization reduces to
min
Gฯ
2DJS pdataโฅpGฯ
−log4.
Here, DJS denotes the Jensen–Shannon divergence, defined as
DJS(pโฅq) := 1
2DKL p p+q
2 + 1
2DKL q p+q
2 .
1.2. Prominent Deep Generative Models
25
This shows that GANs implicitly minimize DJS(pdata โฅpGฯ
). More broadly,
extensions such as f-GANs (Nowozin et al., 2016) generalize this view by
demonstrating that adversarial training can minimize a family of f-divergences,
placing GANs within the same divergence-minimization framework as other
generative models.
Although GANs are capable of generating high-quality data, their min-max
training process is notoriously unstable, often requiring carefully designed
architectures and engineering techniques to achieve satisfactory performance.
However, GANs have since been revived as an auxiliary component to enhance
other generative models, particularly Diffusion Models
1.3 Taxonomy of Modelings
DGM ์ ์ด๋ป๊ฒ ํ๋ฅ ๋ถํฌ๋ฅผ ์ ์ํ๋๊ฐ ? ๋ฅผ ๊ธฐ์ค์ผ๋ก ๋ ๊ทธ๋ฃน์ผ๋ก ๋๋๋ค.
DGM ์ ๊ฒฐ๊ตญ ๋์ค ํ๋์ด๋ค.
1. Explicit model
2. Implicit model
-> ๋์ ์ฐจ์ด๋ P(x) ๋ฅผ ๋ช ์์ ์ผ๋ก ์ ์ํ๋ ์๋๋ฉด msapling ์ ํตํด์ ํ๋๋ง ์ ์ํ๋์ ์ฐจ์ด์ด๋ค. ์กฐ๊ธ ๋ ์์ธํ ์์๋ณด์.

1) Explicit models
์ ์ : ๋ชจ๋ธ์ด ์ง์ pฯ(x) ๋ฅผ ์ ์ํ๋ค. ( p(x) ๊ฐ ์์์ผ๋ก ์กด์ฌ ! )
์์ : AR , NF , VAE , Diffusion model
1. ์ ํํ ํ๋ฅ ๋ฐ๋๋ฅผ ๊ณ์ฐํ ์ ์๊ฑฐ๋
2. ํ๋ฅ ์ ๋ํ tractable bound ๋ฅผ ๊ณ์ฐ ( diffusion ์์ ํ์ต์ ELBO / ์ถ๋ก ์์ p(x) ๋ ์ด๋ ค์๋ bound ์กด์ฌ )
3. ํ๋ฅ ์ ๋ํ approximation ์ ๊ณ์ฐ. ( VAE ์์ ELBO )
2) Implicit model
์ ์ : ์ง์ ์ ์ ํ์ง ์๊ณ "์ํ ์์ฑ ๊ณผ์ "๋ง ์ ์ํ๋ค.
์์ : GAN
GAN ๊ฐ์ ๊ฒฝ์ฐ๋ ํ๋ฅ ๋ฐ๋๊ฐ ์กด์ฌํ์ง ์๊ณ / ๋ฏธ๋ถ(๊ณ์ฐ) ์ด ๋ถ๊ฐ๋ฅํ๋ค ( intractable )
๊ทธ๋์ ์ด ๋ชจ๋ธ์ ํ๋ฅ ์ ์ ์ํ์ง ์๊ณ ๊ทธ๋ฅ ์ํ์ ๋ง๋ค์ด ๋ด๋ ํจ์๋ง ์ ์ํ๋ค.
-> ๊ทธ๋์ gan ์ ๊ตฌํํ๋๊ฒ ๊ฝค๋ ์ด๋ ค์ด ์ผ์ด์์์ง๋.
-> ์ํ์ ์ฃผ์ง๋ง likelihood ๋ ์์ .
๊ทธ๋์ ๋ํจ์ ์ ์ด๋์ ์๋๊ฐ ?
- ์์์๋ ์ด์ผ๊ธฐ ํ์ง๋ง diffusion ์ explicit ๋ชจ๋ธ์ด๋ค.
- ํ์ต์์ EBLO ์ฌ์ฉํ๋ค.
๋ ผ๋ฌธ์๋ ์กฐ๊ธ ๋ ๋ง์ ๋ด์ฉ์ด ์กด์ฌํ๊ธฐ๋ ํ๋. ์ง๊ธ ๋ชจ๋ ๋ค ์ค๋ช ํ๊ธฐ๋ ์ฝ์ง ์๊ธฐ ๋๋ฌธ์ ํจ์ค.
๊ทธ๋๋ ์ ๊น ์ด์ผ๊ธฐ ํ์๋ฉด diffusion ์ "latent VAE + Energy base score + flow-like " ์ ๊ฒฐํฉ์ด๋ค.
(with gpt )
Diffusion์ด ๋ค์ ์ธ ๊ฐ์ง๋ฅผ ๋ชจ๋ ๊ฒฐํฉํ๋ค:
- VAE์์
- variational training (ELBO ๊ธฐ๋ฐ)
- EBM์์
- score = ∇ log p(x)
- ์ ๊ทํ ์์(Partition function) ํ์ ์๋ ์
- Flow์์
- ์ฐ์-time ๋ณํ (ODE/SDE ๊ธฐ๋ฐ ์ญํ์ฐ)
- invertible mapping์ continuous analog
(์ด์ฐจํผ ์ฌ๊ธฐ์๋ ์ดํด๊ฐ ์๊ฐ๋๊ฒ ์ ์์ด๋ค. -> ํ๋ํ๋์ฉ ๋ฐฐ์ฐ๊ณ ch6 ์์ ์ด ๋ด์ฉ๋ค์ ํฉ์น๋ค๊ณ ํ์ผ๋ ๊ฑฑ์ ๋ง์. )
์ด์ part a ์ ๋ด์ฉ์ ๋ง๋ฌด๋ฆฌ ์ง๊ณ ํ๋ํ๋์ฉ ๋ ๋ฅ๋ค์ด๋ธ ํด๋ณด์.
< Part A ์ ๋ง๋ฌด๋ฆฌ >
์์ฝ
- ์์ฑํ ๋ชจ๋ธ์ด ํ๊ณ ์ ํ๋ ๊ฒ : p_data ์ ๊ทผ์ฌํ p_t ๋ฅผ ๋ฐฐ์ฐ์
- ๊ทธ๋ฆฌ๊ณ ๊ฑฐ๊ธฐ์ ๋ฌธ์ ๋ ์ ๊ทํ ์์ Z( ฯ ) ๊ฐ ๊ณ ์ฐจ์์์ intractable ํ๊ฒ
- ๊ทธ๋์ ์ด๊ฑธ ํด๊ฒฐํ๊ณ ์ ๋ง์ ๋ฐฉ์๋ค์ด ๋ฑ์ฅํ๋ค.
- diffusion ์ ํต์ฌ์ VAE + EBM + NF(normalizing flow) ์ด๋ค.
๊ทธ๋์ ์ฐ๋ฆฌ๋
1) VAE + ELBO ์ ๋ํ ๊ฐ๋ ์ ๋ฐฐ์์ DDPM ์ด VAE ์ ํ์ฅ ํํ์์ ๋ฐฐ์ธ ๊ฒ์ด๊ณ
2) SCORE-BASE DIFFUSION = EMB + score matching ์์ ๋ฐฐ์ฐ๊ณ
3) diffusion ์ด ๊ฒฐ๊ตญ normalizing flow ์ ์ผ๋ฐํ ์์ ๋ฐฐ์ธ๊ฒ์ด๋ค.
๋๋ ๋ํจ์ ์ ๊ณต๋ถํ๋ฉด์ ๋ํจ์ ๋ ผ๋ฌธ์ ๋ฑ ์ฝ๊ณ ์.. ๋ญ๊ฐ ์ด๋์ ์ผ๋ ๊ฐ๋ ์ด์๋๊ฑฐ ๊ฐ์๋ฐ ? ์ด๊ฑฐ ์ด๋์ ๋ดค๋๋ฐ ?
๋ผ๊ณ ์๊ฐ์ ํ์๊ณ ๊ทธ๋ฐ ๊ฐ๋ ๋ค์ด ์กฐ๊ธ ํํธํ๋์ด ์์ด์ ๋ช ํํ๊ฒ ์ดํด๊ฐ ์๋๋ ๋ถ๋ถ๋ค์ด ๊ฝค๋ ๋ง์๋๋ฐ ์ด๋ฒ ๊ธฐํ๋ก ์กฐ๊ธ ๋ ๋ช ๋ฃํ๊ฒ ์ดํดํ ์ ์๋ ๋ฐฉํฅ์ ์ก์ ๊ฒ ๊ฐ์์ ๋งค์ฐ ์ข์๋ค.
๋, ์ด ํฐ ํ๋ฆ๋ค์ ๋ณด๋ค๋ณด๋๊น ์ด ์ธ๊ฐ์ง ํฐ ์์ฑ๋ชจ๋ธ์์์ ํจ๋ฌ๋ค์์ ์ ํฉ์ณ๋์ ๋ ผ๋ฌธ์ธ diffusion ์ด ๊ฝค๋ ๋น์ฐํ๊ฒ ๋์จ๊ฒ์ธ๊ฒ ๊ฐ๋ค๋ ( ๋ง์ด ์ฝ์ง ) ์๊ฐ๋ ๋ค๊ณ , transformer ์ ๋ํด์ ๊ต์๋์๊ฒ ๊ฐ์๋ฅผ ๋ฃ๋ค๊ฐ ์๊ธฐ๋ ๋ญ๊ฐ ํน๋ณํ์ง ๋ชฐ๋์๋ค ๋น์ฐํ ํ๋ฆ์์ ๋์๋๊ฑฐ ๊ฐ๋ค๋ ๋ง์ด ๋ญ๊ฐ ์๋ฟ์ง ์์์๋๋ฐ ์ด๋ฐ ๊ฐ๋ ์ ๋ชจ๋ ์์งํ ์ฌ๋์๊ฒ์๋ ์ด์ฉ๋ฉด ๋ํจ์ ์ด๋ผ๋๊ฒ ๊ฝค๋ ์๊ฐ์ ํ๋ฆ์ด ๊ฝค๋ ์์ฐ์ค๋ฝ๊ฒ ๋์์๊ฑฐ๋ผ๋ ์๊ฐ์ด ( ํ์ง๋ง ๋ค์๋ด๋ ๋๋จํ๋ค . ) ๋ ๋ค.
part B ๋ถํฐ๋ ๋ด์ฉ์ด ๋ง์์ ํ๋์ ์ฑํฐ๋ณ๋ก ๋์ด์ ์ค๋ช ํ ๊น ํ๋ค.
๊ทธ๋ผ ๋ค์ ์ฅ์์๋ VAE ์ ๋ํด์ ๊น๊ฒ ์์๋ณด๊ณ , VAE ๋ ๊ณต๋ถํ์ง ์ผ๋ง ์๋์ด์ ํ๊ธฐ๋ฐ ์ ํ๋ธ์์ ๋ดค๋ ์๊ฐ์ ์ธ ์๋ฃ๋ค์ ์ฌ๋ฆฌ๋ฉด์ ๊ฐ์ด ์ค๋ช ํด๋ณด๊ฒ ๋ค.
'Paper' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| TRELLIS ๋ฐํ์๋ฃ (0) | 2025.11.26 |
|---|---|
| [The Principles of Diffusion Models] ์ดํดํ๊ธฐ - ( Part B ) CH 2. VAE (1) | 2025.11.19 |
| DINO v3 ๋ฐํ์๋ฃ (0) | 2025.08.30 |
| VGGT ๋ฐํ์๋ฃ (0) | 2025.08.16 |
| MMaDA ๋ ผ๋ฌธ ๋ฐํ์๋ฃ (2) | 2025.08.06 |