← Back to AI Math Mind Map
📐 AI MathID: mcmc

MCMC & Detailed Balance

MCMC 与细致平衡
🎯Core Definition
Markov Chain Monte Carlo (MCMC) builds a Markov chain whose stationary distribution is the target π\pi and samples along the chain. Metropolis-Hastings draws a candidate jj from a proposal q(j∣i)q(j \mid i) each step and accepts it with rate
📌Overview
α=min⁡(1,π(j) q(i∣j)π(i) q(j∣i)),\alpha = \min\Bigl(1, \frac{\pi(j)\, q(i \mid j)}{\pi(i)\, q(j \mid i)}\Bigr),
📌Overview
otherwise staying at ii. Writing r=π(j)q(i∣j)/(π(i)q(j∣i))r = \pi(j) q(i \mid j) / (\pi(i) q(j \mid i)): when r≥1r \ge 1, α(i,j)=1\alpha(i,j) = 1 and the reverse acceptance is 1/r1/r, so pointwise substitution yields the detailed balance of the MH chain, π(i)q(j∣i)α(i,j)=π(j)q(i∣j)α(j,i)\pi(i) q(j \mid i) \alpha(i,j) = \pi(j) q(i \mid j) \alpha(j,i), hence π\pi is stationary; moreover π\pi only needs to be known up to a constant (it cancels in the ratio). Gibbs sampling is a special case: each step updates one coordinate xkx_k by drawing from the conditional π(xk∣x∖k)\pi(x_k \mid x_{\setminus k}), whose definition forces the acceptance rate to be 1 — no rejection needed.
💡Use Cases
Bayesian posterior inference, latent-variable models (LDA, Gaussian mixtures), sampling high-dimensional joint distributions; interviews often ask to derive the MH acceptance rate and relate Gibbs to MH.
⚡Key Problems Solved
rejection sampling collapses as 1/M1/M and importance weights explode in high dimension, while MCMC trades correlated samples for a positive acceptance rate — the only general-purpose high-dimensional sampler; the cost is autocorrelation: burn-in must discard the non-stationary head of the chain, and convergence is diagnosed via acceptance rate (rule of thumb 0.2–0.5) and the Gelman-Rubin R^\hat R statistic.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of MCMC & Detailed Balance.
Use Cases
In production engineering, what are the primary use cases for MCMC & Detailed Balance and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Derive the MH acceptance rate α=min⁡(1,π(j)q(i∣j)/(π(i)q(j∣i)))\alpha = \min(1, \pi(j) q(i \mid j)/(\pi(i) q(j \mid i))) and verify the chain satisfies detailed balance (stationary at π\pi)?
2
Relationship between Gibbs and MH: why is the Gibbs acceptance rate always 1? Prove it?
3
What is burn-in and why is it needed? How do you diagnose convergence (Gelman-Rubin R^\hat R, trace plots, acceptance rate)?
4
What does the acceptance rate reduce to under a symmetric proposal q(j∣i)=q(i∣j)q(j \mid i) = q(i \mid j) (the Metropolis algorithm)?
5
Can MCMC handle unnormalized π\pi? Why does the acceptance rate only need π\pi up to a constant?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "MCMC & Detailed Balance"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardMarkov Chain & Detailed BalanceNext Card →Bootstrap

🔗 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/mcmc
中文速览与面试要点

MCMC 与细致平衡 (MCMC & Detailed Balance)

定义: 马尔可夫链蒙特卡洛 (MCMC) 构造以目标分布 为平稳分布的马尔可夫链并沿链取样本。Metropolis-Hastings 每步从提议分布 q(j i) 采样候选 j,以接受率 = (1, (j)\, q(i j) (i)\, q(j i) ) 决定接受,被拒则留在 i。设 r = (j) q(i j) / ( (i) q(j i)),当 r 1 时 (i,j) = 1、反向接受率取 1/r,逐对代入可得 MH 链满足细致平衡 (i) q(j i) (i,j) = (j) q(i j) (j,i),故 平稳;且 只需差常数倍(归一化常数在比值中约掉)。Gibbs 采样是特例:每次仅更新一个坐标 x_k,从条件分布 (x_k x_ k) 采样,由条件分布定义知接受率恒为 1、无需拒绝。 使用场景: 贝叶斯后验推断、潜变量模型(LDA、混合高斯)、高维联合分布采样;面试常考 MH 接受率推导、Gibbs 与 MH 的关系。 解决的问题: 高维下拒绝采样接受率按 1/M 崩塌、重要性采样权重方差爆炸,MCMC 用自相关样本换取正接受率,是目前唯一通用的高维采样框架;代价是样本自相关 — 需要 burn-in 丢弃链前段非平稳样本,并以接受率(经验值 0.2–0.5)与 Gelman-Rubin R 等诊断收敛。

核心要点

  • 推导 MH 接受率 = (1, (j) q(i j)/( (i) q(j i))),并验证该链满足细致平衡(即平稳分布为 )?
  • Gibbs 采样与 MH 的关系:为什么 Gibbs 每步接受率恒为 1?证明之?
  • 什么是 burn-in?为什么需要?如何诊断收敛(Gelman-Rubin R、迹图、接受率)?
  • 对称提议 q(j i) = q(i j) 时接受率退化成什么(Metropolis 算法)?
  • 未归一化的 能用 MCMC 吗?接受率中的 为什么只需差常数倍?