Chip Foundry Services Request Assessment

Monte Carlo Simulation

Monte Carlo simulation estimates a quantity by repeated random sampling. Instead of solving for the output distribution of a complicated system analytically, you draw the inputs at random from their assumed distributions, compute the output for each draw, and summarise the results. It is the standard way to propagate tolerances, variability and uncertainty through a calculation that has no tidy closed form.

The loop:

Describe the inputs as distributions
each layer thickness varies within its tolerance
Simulate N virtual buildsfixed random seed for reproducibility
Draw every input at random
from its distribution
Compute the output
stack height, yield, delay
Record pass or fail
against the specification
Average the results
estimate plus a standard error of about 1 / sqrt(N)

The estimator. To estimate an expectation $E[g(X)]$, such as a failure probability, draw $X_1,\dots,X_N$ independently and average. The error of the average falls with the square root of the number of runs, regardless of how many inputs the system has:

$$\hat{\mu}_N=\frac{1}{N}\sum_{i=1}^{N}g(X_i),\qquad \mathrm{SE}(\hat{\mu}_N)=\frac{\sigma_g}{\sqrt{N}},\qquad \hat{p}\pm1.96\sqrt{\frac{\hat{p}(1-\hat{p})}{N}}$$

The last form is the usual interval when the output is a pass or fail indicator and $\hat{p}$ is the observed proportion of failures.

Worked example. Four layers are stacked, each with a thickness uniformly distributed between $9.5$ and $10.5$ mm, and the stack must not exceed $41$ mm. A worst-case view adds the maxima to $42$ mm, which always fails the spec and says nothing about how often. A root-sum-square view gives a spread of $\sqrt{4/12}=0.577$ mm around a $40$ mm mean. Simulation answers the actual question: how often does the total exceed $41$ mm? For this textbook case the exact answer is known, $1/4!=1/24=4.17\%$, which lets us watch the simulation converge. With a fixed seed of $42$:

Monte Carlo error shrinks like 1 over the square root of N estimated chance that a four-layer stack exceeds 41 mm; the exact answer is 1/24 = 4.17% 0% 2% 4% 6% 8% exact 4.17% 4.00% 100 4.00% 1,000 4.25% 10,000 4.08% 100,000 4.16% 1,000,000 number of simulated stacks N (log scale) each 100-fold increase in N makes the 95% band about 10 times narrower rare events are costly: at 0.0067% only about 7 hits per 100,000 runs, an error near 39%

With $N=100$ runs the estimate is $4.00\%$, but its $95\%$ band, $0.2\%$ to $7.8\%$, is as wide as the answer itself. At $10{,}000$ runs the estimate is $4.25\%$ with a standard error of $0.20$ points, and at $1{,}000{,}000$ it is $4.16\%$ with $0.02$ points. Repeating the $10{,}000$-run experiment $300$ times gives estimates that scatter with a standard deviation of $0.197$ points against a theoretical $0.200$. The simulated stack also has a mean of $40.00$ and standard deviation of $0.578$, matching the $0.577$ calculated above.

How many runs do you need? Solving the interval half-width $E$ for $N$ gives the planning formula:

$$N\approx\frac{z^2\,p(1-p)}{E^2}$$

To pin the failure rate down to $\pm0.1$ percentage points at $95\%$ confidence, $E=0.001$, so $N\approx1.96^2(0.0417)(0.9583)/0.001^2\approx153{,}000$ runs. Halving the error needs four times as many runs, which is the price of a method that works for any system.

Where plain simulation struggles.

  • Rare events: the chance that the stack exceeds $41.8$ mm is $0.2^4/4!\approx0.0067\%$. In $100{,}000$ runs you expect only about $7$ hits, so the estimate carries roughly $39\%$ relative error. For events this rare, use importance sampling or splitting rather than brute force.
  • Wrong inputs, wrong answer: the simulation faithfully reproduces whatever distributions you feed it. Correlated inputs, truncated tails or an invented distribution give a precise but wrong result. Check the inputs against measured data.
  • Seeds and reproducibility: record the random seed and software version, or the result cannot be reproduced exactly.
  • Variance reduction: antithetic variates, control variates and stratified or quasi-random sampling (such as Sobol sequences) can cut the number of runs needed by large factors.
  • Report the uncertainty: quote the estimate with its standard error or interval. A single Monte Carlo number with no error bar looks more exact than it is.
  • Versus the bootstrap: both resample, but Monte Carlo draws from a model you specify, while the bootstrap draws from the data you collected.

Read Monte Carlo simulation as running the experiment on a computer instead of in the fab: describe the randomness, play it out many times, and count; the answer sharpens with the square root of the effort.