← Back to AI Math Mind Map
📐 AI MathID: elbo-vi

Variational Inference & ELBO

变分推断与 ELBO
🎯Core Definition
Variational inference approximates an intractable posterior p(z∣x)p(z|x) with a tractable distribution q(z∣x)q(z|x) via the evidence lower bound (ELBO). Exact decomposition of the log-evidence: log⁡p(x)=ELBO(q)+DKL(q(z∣x)∥p(z∣x))\log p(x) = \text{ELBO}(q) + D_{KL}(q(z|x) \Vert p(z|x)), where ELBO(q)=Eq(z∣x)[log⁡p(x,z)q(z∣x)]=Eq[log⁡p(x,z)]+H(q)=Eq[log⁡p(x∣z)]−DKL(q(z∣x)∥p(z))\text{ELBO}(q) = \mathbb{E}_{q(z|x)}\left[\log\frac{p(x,z)}{q(z|x)}\right] = \mathbb{E}_q[\log p(x,z)] + H(q) = \mathbb{E}_q[\log p(x|z)] - D_{KL}(q(z|x) \Vert p(z)). The bound is constructed via Jensen: since log⁡\log is concave, log⁡p(x)=log⁡Eq[p(x,z)q(z∣x)]≥Eq[log⁡p(x,z)q(z∣x)]=ELBO(q)\log p(x) = \log\mathbb{E}_q\left[\frac{p(x,z)}{q(z|x)}\right] \ge \mathbb{E}_q\left[\log\frac{p(x,z)}{q(z|x)}\right] = \text{ELBO}(q); expanding Eq[log⁡p(x)]=ELBO+Eq[log⁡qp(z∣x)]\mathbb{E}_q[\log p(x)] = \text{ELBO} + \mathbb{E}_q\left[\log\frac{q}{p(z|x)}\right] yields the exact decomposition, with equality iff q=p(z∣x)q = p(z|x), where the KL gap is 0 and ELBO reaches log⁡p(x)\log p(x).
💡Use Cases
the training objective of VAEs (reconstruction + KL regularization with the reparameterization trick), Bayesian neural networks, LDA topic modeling; "derive the ELBO" and "why does a VAE optimize the ELBO" are canonical interview questions.
⚡Key Problems Solved
the posterior p(z∣x)p(z|x) is usually not analytically integrable and MCMC is infeasible at scale; variational inference turns inference into optimization, compatible with SGD, and yields an approximate posterior with uncertainty. The cost: restricted approximation families (e.g. mean-field independence) tend to underestimate posterior variance.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Variational Inference & ELBO.
Use Cases
In production engineering, what are the primary use cases for Variational Inference & ELBO and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Fully derive log⁡p(x)=ELBO+DKL(q∥p)\log p(x) = \text{ELBO} + D_{KL}(q \Vert p)?
2
How does Jensen's inequality prove that ELBO is a lower bound on log⁡p(x)\log p(x)?
3
Two equivalent ELBO forms (reconstruction + KL penalty)? Why does maximizing ELBO minimize the KL gap?
4
Relation between variational inference and EM? What do the E and M steps do?
5
What is the mean-field assumption? Why does VI tend to underestimate posterior variance?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Variational Inference & ELBO"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardBayesian InferenceNext Card →High-Dim Geometry & Concentration

🔗 More AI Math Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/Math/card/elbo-vi
中文速览与面试要点

变分推断与 ELBO (Variational Inference & ELBO)

定义: 变分推断用可解分布 q(z|x) 逼近难解后验 p(z|x),核心是证据下界 ELBO。对证据对数做精确分解: p(x) = ELBO(q) + D_KL(q(z|x) p(z|x)),其中 ELBO(q) = E_q(z|x) [ p(x,z)q(z|x) ] = E_q[ p(x,z)] + H(q) = E_q[ p(x|z)] - D_KL(q(z|x) p(z))。下界由 Jensen 不等式构造: 凹,所以 p(x) = E_q [ p(x,z)q(z|x) ] E_q [ p(x,z)q(z|x) ] = ELBO(q);由 E_q[ p(x)] = ELBO + E_q [ qp(z|x) ] 展开即得精确分解,等式当且仅当 q = p(z|x),此时 KL 缺口为 0、ELBO 达到 p(x)。 使用场景: VAE 的训练目标(重构项 + KL 正则,配重参数化技巧)、贝叶斯神经网络、LDA 主题模型;面试“推导 ELBO”“VAE 为什么优化 ELBO”是变分类必考题。 解决的问题: 后验 p(z|x) 的积分通常不可解析,MCMC 在大模型上不可行;变分把“推断”转化为“优化”,与 SGD 天然兼容,并给出带不确定性的近似后验。代价是近似族受限(均值场假设各维度独立)导致低估后验方差。

核心要点

  • 完整推导 p(x) = ELBO + D_KL(q p)?
  • 如何用 Jensen 不等式证明 ELBO 是 p(x) 的下界?
  • ELBO 的两种等价形式(重构项 + KL 惩罚)如何互相转换?优化 ELBO 为何等价于最小化与后验的 KL?
  • 变分推断与 EM 算法的关系?E 步与 M 步分别做什么?
  • 均值场近似的假设是什么?为什么 VI 倾向于低估后验方差?