# 方差缩减

**方差缩减**是蒙特卡罗模拟中的一类方法，它能在不改变估计量期望值的前提下降低其统计误差，从而以更少的随机样本达到给定精度。朴素蒙特卡罗平均的误差正比于 \( \sigma/\sqrt{n} \)，其中 \( \sigma \) 是被平均量的标准差，\( n \) 是样本数；靠蛮力把误差减半，意味着样本数要翻两番。方差缩减技术则直接缩小 \( \sigma \) 本身，而不动均值。<sup>[1](https://www.hramian.com/assets/code/mcmc/)</sup>

| 要点 | 细节 |
|---|---|
| 目标 | 与朴素蒙特卡罗相同的期望值，在相同抽样次数下方差更小<sup>[2](https://riskhub.org/maths-for-quants/course-content/numerical-analysis-primer/making-random-numbers-work-simulation-and-its-error/spending-randomness-better-the-variance-reduction-family-3796)</sup> |
| 主要技术 | 控制变量法、对偶变量法、分层抽样、重要性抽样、条件蒙特卡罗、拉丁超立方抽样<sup>[3](https://onlinelibrary.wiley.com/doi/10.1002/9780470230381.ch5)</sup> |
| 控制变量法 | 最优系数 \( \alpha^{*} = \mathrm{Cov}(V,W)/\sigma_W^2 \) 给出方差 \( \sigma_V^2(1-\rho^2) \)<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup> |
| 对偶变量法 | 仅当 \( \mathrm{Cov}[f(W), f(-W)] < 0 \) 时才有净收益；对称收益是最坏情形<sup>[5](https://people.maths.ox.ac.uk/~gilesm/mc/mc/lec3.pdf)</sup> |
| 分层抽样 | 比例分配完全消除层间方差，剩下 \( \sum_k p_k \sigma_k^2/N \)<sup>[6](https://mynameisjanus.github.io/appendix/part-09-monte-carlo-methods/06-variance-reduction/)</sup> |
| 重要性抽样 | 从改变后的分布 \( h \) 抽样并按 \( p/h \) 重新加权；是稀有事件模拟的核心<sup>[7](https://illinois-dap.github.io/DataAnalysisForPhysicists/_sources/lectures/MonteCarloSamplingMethods.html)</sup> |
| 粒子输运应用 | Geant4 实现了几何分裂，配合俄罗斯轮盘赌与权重窗技术，用于屏蔽与探测器模拟<sup>[8](https://www.geant4.org/collaboration/working_groups/geometryTransport/docs/biasing/Sampling.html)</sup> |

## 为什么方差缩减重要

从 \( L \) 个独立样本对 \( A = E[V(X)] \) 作蒙特卡罗估计，其误差量级为 \( \sigma_V/\sqrt{L} \)，因此达到给定精度所需的样本数与运行时间正比于方差。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup><sup> • </sup><sup>[16](https://www.itl.nist.gov/div898/handbook/ppc/section3/ppc333.htm)</sup> 在某些应用中，例如稀有事件模拟和量子化学，方差缩减使原本不可能的事情变得可行，而大多数高级蒙特卡罗工作本质上都是某种方差缩减。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup>

正确应用的技术不是近似：它给出与朴素蒙特卡罗相同的答案，而在相同抽样次数下误差棒更小。<sup>[2](https://riskhub.org/maths-for-quants/course-content/numerical-analysis-primer/making-random-numbers-work-simulation-and-its-error/spending-randomness-better-the-variance-reduction-family-3796)</sup> 这些方法有时被称为蒙特卡罗“骗术”（swindles），因为它们在不增加样本数的前提下提高了精度和收敛速度。<sup>[7](https://illinois-dap.github.io/DataAnalysisForPhysicists/_sources/lectures/MonteCarloSamplingMethods.html)</sup>

## 控制变量法

控制变量法利用关于“已知其值的量的估计误差”的知识，来降低“未知其值的量”的估计误差；它也被列为提升蒙特卡罗效率最有力、用途最广的方法之一。<sup>[9](https://ai.stanford.edu/~bangpeng/download/book/Monte_Carlo_Methods_in_Financial_Engineering__--_by_Paul_Glasserman.pdf)</sup> 若 \( W(X) \) 是一个易于计算的随机变量，其均值 \( B = E[W(X)] \) 已知，且与 \( V(X) \) 相关，则估计量

\[ Z = V(X) - \alpha\,(W(X) - B) \]

仍然无偏；选择 \( \alpha \) 使其方差最小，得 \( \alpha^{*} = \mathrm{Cov}(V,W)/\sigma_W^2 \)，方差降为 \( \sigma_V^2(1 - \rho_{VW}^2) \)，其中 \( \rho_{VW} \) 是 \( V \) 与 \( W \) 的相关系数。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup> 因此该技术的效果完全取决于相关性；实践中 \( \alpha^{*} \) 由蒙特卡罗数据本身估计，而性能对该估计并不敏感，因为方差在最小值附近是平坦的。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup> 多个控制变量可以组合使用，最优系数通过求解协方差方程组的线性系统得到。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup>

在量化金融中，一个可显式求解的粗糙版本问题往往能提供控制变量；对欧式看涨期权而言，贴现股价 \( e^{-rt}S(t) \) 是期望已知的鞅，可作为 \( g \)。<sup>[5](https://people.maths.ox.ac.uk/~gilesm/mc/mc/lec3.pdf)</sup> 在一个算例中，加入该控制变量后，在相同样本量下期权价格估计的标准误从 0.0599 降到 0.0151。<sup>[5](https://people.maths.ox.ac.uk/~gilesm/mc/mc/lec3.pdf)</sup>

## 对偶变量法

对偶变量法在成对样本之间引入负相关。对于对称分布，每次抽样 \( W \) 与 \( -W \) 配对，估计量取 \( \tfrac{1}{2}(f(W) + f(-W)) \) 的平均，仍然无偏。<sup>[5](https://people.maths.ox.ac.uk/~gilesm/mc/mc/lec3.pdf)</sup> 只要 \( f(W) \) 与 \( f(-W) \) 之间的协方差为负，配对估计量的方差就比独立样本小，但代价几乎翻倍，因此只有当 \( \mathrm{Cov}[f(W), f(-W)] < 0 \) 时才有净收益。<sup>[5](https://people.maths.ox.ac.uk/~gilesm/mc/mc/lec3.pdf)</sup>

两个极端情形很有启发性。线性收益 \( f = a + bW \) 可被精确积分，协方差为 \( -V[f] \)；对称收益 \( f(W) = f(-W) \) 是最坏情形，协方差为 \( +V[f] \)。一般的评价是：对偶变量法通常帮助不大，但当收益近似线性时可能效果不错。<sup>[5](https://people.maths.ox.ac.uk/~gilesm/mc/mc/lec3.pdf)</sup> 用错了地方，它们会让方差翻倍。<sup>[10](https://treese41528.github.io/ComputationalDataScience/Notebooks/PartI_Foundations/chapter2_monte_carlo.html)</sup>

## 分层抽样及相关系统化方法

分层抽样把样本空间划分为互不相交的区域（称为层），并固定每层落入的样本数，从而消除分配上的随机性。采用比例分配 \( n_k = p_k N \) 时，层间方差被完全消除，估计量方差变为 \( \sum_k p_k \sigma_k^2/N \)，而朴素估计量的方差为 \( (\sum_k p_k \sigma_k^2 + \sum_k p_k(\mu_k - \theta)^2)/N \)。<sup>[6](https://mynameisjanus.github.io/appendix/part-09-monte-carlo-methods/06-variance-reduction/)</sup> 其方差保证等于或小于不分层时的方差。<sup>[11](https://www.dgp.toronto.edu/~lessig/ais/mc.pdf)</sup>

系统化抽样方法构成一个谱系，从对偶变量法、分层抽样，一直到拟蒙特卡罗积分——后者用低差异序列取代随机点，其积分误差的衰减快于随机抽样的 \( N^{-1/2} \)。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup> 拉丁超立方抽样把分层推广到多个独立变量，使每个变量的每一层中恰好有一个样本。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup> 部分积分（又称拉奥-布莱克韦尔化）通过用条件平均替代对某些变量的积分来降低方差。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup>

## 重要性抽样

重要性抽样通过改变抽样所用的分布来降低方差。<sup>[12](https://mitocw.ups.edu.ec/courses/aeronautics-and-astronautics/16-90-computational-methods-in-aerospace-engineering-spring-2014/probabilistic-methods-and-optimization/variance-reduction-techniques-for-the-monte-carlo-method/1690r-importance-sampling/)</sup> 把密度 \( p \) 下的目标期望写成另一密度 \( h \) 下的期望，估计量变为

\[ \bar{f}_n = \frac{1}{N} \sum_{i=1}^{N} \frac{p(x_i)}{h(x_i)}\, f(x_i), \qquad x_i \sim h, \]

于是在被积函数贡献更大的地方抽取更多样本，而似然比 \( p/h \) 修正偏差。<sup>[7](https://illinois-dap.github.io/DataAnalysisForPhysicists/_sources/lectures/MonteCarloSamplingMethods.html)</sup> 理想的选择会使 \( f(x)\,p(x)/h(x) \) 为常数，方差为零；实践中则让比值在 \( f \) 大的地方小，把样本集中到重要区域。<sup>[5](https://people.maths.ox.ac.uk/~gilesm/mc/mc/lec3.pdf)</sup>

该技术对稀有事件模拟尤为重要，因为那里收益几乎处处为零。在高斯尾部问题中，朴素估计量的相对误差按指数增长，约为 \( e^{r^2/4} \)，而重要性抽样估计量的相对误差只按 \( \sqrt{r} \) 增长。<sup>[4](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)</sup> 在一次演示中，重要性抽样用 10,000 次抽样估计尾部概率，方差缩减接近 7,000 倍，而朴素蒙特卡罗只捕捉到一次超越，毫无用处。<sup>[10](https://treese41528.github.io/ComputationalDataScience/Notebooks/PartI_Foundations/chapter2_monte_carlo.html)</sup>

## 粒子输运中的方差缩减

蒙特卡罗粒子输运程序以几何形式应用同样的思想。在 Geant4 中，几何重要性抽样（又称几何分裂与俄罗斯轮盘赌）让进入重要区域的粒子历史被更频繁地抽样，进入次要区域的则更少；那里方差缩减的目的是节省计算时间。<sup>[8](https://www.geant4.org/collaboration/working_groups/geometryTransport/docs/biasing/Sampling.html)</sup> 默认算法实现期望值分裂：当粒子从重要性为 \( I_m \) 的单元进入重要性为 \( I_n \) 的单元时，计算 \( r = I_n/I_m \)；若 \( r > 1 \)，该历史被分裂为 \( r \) 条径迹；若 \( r < 1 \)，则进行俄罗斯轮盘赌，杀死概率为 \( p_k = 1 - r \)；分裂后新权重为 \( w_{\mathrm{new}} = w \cdot (1/r) \)，从而保持期望贡献不变。<sup>[8](https://www.geant4.org/collaboration/working_groups/geometryTransport/docs/biasing/Sampling.html)</sup>

权重窗技术是一种基于权重的替代方案，用户为每个空间-能量单元指定权重下界 \( W_L \)，以及上界与存活界 \( W_U = C_U W_L \) 和 \( W_S = C_S W_L \)。与重要性抽样不同，它不是“权重盲”的，因此便于与截面偏倚、隐式俘获等其他技术结合；权重轮盘赌（权重截断）会移除权重已低到贡献甚微的粒子。<sup>[8](https://www.geant4.org/collaboration/working_groups/geometryTransport/docs/biasing/Sampling.html)</sup> 近期一系列工作针对稀有事件屏蔽搜索，用整数个等宽重要性层来优化重要性分裂。<sup>[13](https://arxiv.org/abs/2609.03822)</sup>

## 技术组合与实践限制

这些技术可以组合使用。2023 年一种名为 CoVVVR 的方法在 Vegas 积分程序中同时应用重要性抽样与控制变量法，兼得两者之利，并随基准结果一同发布了 Python 封装。<sup>[14](https://arxiv.org/abs/2309.12369)</sup> 控制变量也已用机器学习来训练：神经控制变量可以在马尔可夫链的相关构型上训练，重新利用中间样本，即便独立样本数固定也能取得更有效的缩减。<sup>[15](https://doi.org/10.1103/kpc8-cj7p)</sup>

文献中反复出现两点告诫。其一，效率的最大提升来自利用问题的具体特征，而非通用方法的通用套用。<sup>[9](https://ai.stanford.edu/~bangpeng/download/book/Monte_Carlo_Methods_in_Financial_Engineering__--_by_Paul_Glasserman.pdf)</sup> 其二，降低模拟误差往往与方便地估计该误差相冲突：引入重复间依赖的方法（如对偶配对）可能需要牺牲部分潜在的方差缩减，才能得到有效的置信区间。<sup>[9](https://ai.stanford.edu/~bangpeng/download/book/Monte_Carlo_Methods_in_Financial_Engineering__--_by_Paul_Glasserman.pdf)</sup>

## References

1. [Monte Carlo simulation with variance reduction, Hormoz Ramian](https://www.hramian.com/assets/code/mcmc/)
2. [Spending Randomness Better: the Variance-Reduction Family, Risk Hub](https://riskhub.org/maths-for-quants/course-content/numerical-analysis-primer/making-random-numbers-work-simulation-and-its-error/spending-randomness-better-the-variance-reduction-family-3796)
3. [Rubinstein, R.Y. and Kroese, D.P. (2007). Controlling the Variance. In Simulation and the Monte Carlo Method, Wiley](https://onlinelibrary.wiley.com/doi/10.1002/9780470230381.ch5)
4. [Goodman, J. Lecture Notes on Monte Carlo Methods, Chapter 3: Variance Reduction, Courant Institute, NYU](https://math.nyu.edu/faculty/goodman/teaching/MonteCarlo07/notes/VarianceReduction.pdf)
5. [Giles, M. Numerical Methods II, MC Lecture 3: Variance Reduction, Oxford University Mathematical Institute](https://people.maths.ox.ac.uk/~gilesm/mc/mc/lec3.pdf)
6. [Variance Reduction, Building Quantitative Trading Systems](https://mynameisjanus.github.io/appendix/part-09-monte-carlo-methods/06-variance-reduction/)
7. [Monte Carlo and Sampling Methods, PHYS 398 DAP, University of Illinois](https://illinois-dap.github.io/DataAnalysisForPhysicists/_sources/lectures/MonteCarloSamplingMethods.html)
8. [Scoring, geometrical importance sampling and weight roulette, Geant4](https://www.geant4.org/collaboration/working_groups/geometryTransport/docs/biasing/Sampling.html)
9. [Glasserman, P. Monte Carlo Methods in Financial Engineering, Chapter 4: Variance Reduction Techniques, Stanford](https://ai.stanford.edu/~bangpeng/download/book/Monte_Carlo_Methods_in_Financial_Engineering__--_by_Paul_Glasserman.pdf)
10. [Variance Reduction Methods, STAT 418 notebook](https://treese41528.github.io/ComputationalDataScience/Notebooks/PartI_Foundations/chapter2_monte_carlo.html)
11. [Monte Carlo Techniques, University of Toronto](https://www.dgp.toronto.edu/~lessig/ais/mc.pdf)
12. [Variance Reduction Techniques for the Monte Carlo Method, MIT OpenCourseWare 16.90](https://mitocw.ups.edu.ec/courses/aeronautics-and-astronautics/16-90-computational-methods-in-aerospace-engineering-spring-2014/probabilistic-methods-and-optimization/variance-reduction-techniques-for-the-monte-carlo-method/1690r-importance-sampling/)
13. [Optimisation of importance sampling implementation in rare-event shielding simulations using Geant4, arXiv](https://arxiv.org/abs/2609.03822)
14. [Shyamsundar, P. et al. (2023). Variance Reduction via Simultaneous Importance Sampling and Control Variates Techniques Using Vegas, arXiv:2309.12369](https://arxiv.org/abs/2309.12369)
15. [Training neural control variates using correlated configurations, Physical Review D](https://doi.org/10.1103/kpc8-cj7p)
16. [3.3.3.3. Selecting Sample Sizes](https://www.itl.nist.gov/div898/handbook/ppc/section3/ppc333.htm)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 物理学 › 物理学方法、实践与学术共同体 › Applied and interdisciplinary physics › Computational and simulation physics › Monte Carlo methods in physics › Variance reduction and error analysis

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/variance-reduction

English original: https://www.edgepedia.org/variance-reduction
