Monte Carlo Estimation
Monte Carlo estimation approximates expectations with samples. It appears in evaluation, simulation, generative modeling, reinforcement learning, uncertainty estimation, and approximate inference.
For a random variable and function , the target expectation is:
With samples , the Monte Carlo estimator is:
The estimator variance decreases with sample count:
Key Ideas
- Monte Carlo replaces an integral or expectation with an empirical average.
- More samples reduce variance but increase compute cost.
- Biased sampling requires correction if the goal is an expectation under another distribution.
- Seed, sample count, and sampling distribution are part of the experimental protocol.
- Many reported metrics are Monte Carlo estimates over data examples, seeds, generated samples, or rollouts.
Estimation Contract
| Field | Question |
|---|---|
| Target expectation | What quantity is being estimated? |
| Sampling distribution | Where do samples come from? |
| Sample count | How many examples, seeds, rollouts, or generated samples? |
| Independence | Are samples independent, paired, batched, or correlated? |
| Filtering | Were failed or invalid samples removed? |
| Uncertainty | Is a confidence interval or standard error reported? |
The standard error for independent samples is:
where:
Importance Sampling
If samples come from but the target expectation is under :
The estimator is:
Large or unstable weights can make the estimate high variance.
AI and Computational Biology Uses
| Use | Samples | Common Trap |
|---|---|---|
| generative model evaluation | generated samples | filtering invalid samples changes the denominator |
| diffusion or flow sampling | random seeds and solver paths | sample quality depends on step budget |
| uncertainty estimation | model samples or posterior samples | correlated samples overstate certainty |
| RL or agent evaluation | rollouts | few tasks or seeds give noisy estimates |
| virtual screening | candidate library draws or top-K subsets | active prevalence changes enrichment |
| molecular simulation | trajectory frames | autocorrelation reduces effective sample size |
For correlated samples, the effective sample size can be much smaller than the raw sample count.
Practical Checks
- What distribution are samples drawn from?
- How many samples are used, and is the estimate stable?
- Are samples independent or correlated?
- Is the estimator biased by filtering, truncation, rejection, or selection?
- Is uncertainty reported with confidence intervals or repeated runs?
- Are random seeds and sampling budgets fixed across methods?
- Are failed generations, failed simulations, or invalid outputs part of the reported denominator?