Post · 2 min read· p. 77
In the DALL-E paper, we want to model the joint likelihood of the model distribution over images x, captions y, and tokens z for an encoded RGB image[^1].
The joint likelihood is modelled using the factorization
\begin{equation}
\label{eq:factorization}
p_{\theta, \psi}(x, y, z) = p_\theta(x | y, z) p_\psi(y, z)
\end{equation}
The paper presents this lower bound
\begin{equation}
\label{eq:lower-bound}
\ln p_{\theta, \psi}(x, y) \geq \mathbb{E}{z \thicksim q\phi(z |x)} \left( \ln p_\theta (x | y, z) - D_{KL}(q_\phi(y, z | x), p_\psi(y, z))\right)
\end{equation}
It was unclear to me how this was derived (and apparently unclear to others), so I thought I’d try to derive it myself.
The evidence lower bound lets us write
lnpθ,ψ(x,y)≥Ez∼qϕ[lnqϕ(z)pθ,ψ(x,y,z)]
From the factorization of the joint likelihood, we can rewrite this as
Ez∼qϕ[lnqϕ(z)pθ,ψ(x,y,z)]=Ez∼qϕ[lnqϕ(z)pθ(x∣y,z)pψ(y,z)]=Ez∼qϕ[lnpθ(x∣y,z)+lnpψ(y,z)−lnqϕ(z)]=Ez∼qϕ[lnpθ(x∣y,z)]+Ez∼qϕ[lnpψ(y,z)−lnqϕ(z)]=Ez∼qϕ[lnpθ(x∣y,z)]+Ez∼qϕ[lnqϕ(z)pψ(y,z)]
Note that the term on the right is precisely the KL-divergence between qϕ and pψ:
DKL(qψ(y,z∣x)∣∣pψ(y,z))=E[lnpψ(y,z)qψ(y,z∣x)]=−E[lnqψ(y,z∣x)pψ(y,z)]
So we can write:
Ez∼qϕ[lnqϕ(z)pθ,ψ(x,y,z)]=Ez∼qϕ[lnpθ(x∣y,z)]−DKL(qψ(y,z∣x)∣∣pψ(y,z))
Which, combined with Equation \eqref{eq:lower-bound}, gives us our lower bound.
[^1]: Encoded using a dVAE— see the DALL-E paper for details.