隱變量的內插
還記得經典的 word embedding 特性嗎? 在當時 Mikolov 這篇經典的 word2vec 論文可讓人震驚了
$$\mathbf{e}_{king}+(\mathbf{e}_{man}-\mathbf{e}_{woman})\approx\mathbf{e}_{queen}$$ 這樣看起來 embedding space 似乎滿足某些線性特性, 使得我們後來在做 embedding 的內插往往採用線性內插:
$$\mathbf{e}_{new}=t\mathbf{e}_1+(1-t)\mathbf{e}_2$$ 讓我們把話題轉到 generative model 上面
不管是 VAE, GAN, flow-based, diffusion-based or flow matching models 都是利用 NN 學習如何從一個”簡單容易採樣”的分布, e.g. standard normal distribution $\mathcal{N}(\mathbf{0},\mathbf{I})$, 到資料分布 $p_{data}$ 的一個過程.
$$\mathbf{x}=\text{Decoder}_\theta(\mathbf{z}),\quad \mathbf{z}\sim\mathcal{N}(\mathbf{0},\mathbf{I})$$
Lil’Log “What are Diffusion Models?” Fig. 1. 的 variable $\mathbf{z}$ 實務上大多使用 $\mathcal{N}(\mathbf{0},\mathbf{I})$ 的設定
(借用 Jia-Bin Huang 影片的圖 How I Understand Diffusion Models 來舉例)
因此如果我們想產生狗和牛的混合體, 是不是可以這樣作?
$$\text{Decoder}_\theta(t\mathbf{z}_{dog}+(1-t)\mathbf{z}_{cow}), \quad t\in[0,1]$$ 答案是不行, 效果不好. 那具體怎麼做呢? 其實應該這麼做 [1]
$$\text{Decoder}_\theta(\cos(t\pi/2)\mathbf{z}_{dog}+\sin(t\pi/2)\mathbf{z}_{cow}), \quad t\in[0,1]$$ 要使用 spherical linear interpolation [2] 這種內插方式