Rare-Event AV Safety Estimation with Importance Sampling
Statistics & ExperimentsModel answerLast updated
Design a biased-sampling simulation study that estimates a ~1-in-10,000-mile collision rate within a 50k-run budget, reports calibrated uncertainty, and validates the extrapolation.
You are building a simulation harness to judge how often an autonomous-vehicle planning-and-perception stack would collide at one specific urban intersection. Exposure units are miles; the true collision rate is on the order of one per 10,000 miles, so a collision is a rare event. You may spend 50,000 simulated runs, and you must return a collision-rate estimate with an honest confidence interval rather than a point number.
A plain Monte Carlo run at this budget would produce only a handful of collisions — often zero — so the estimate would be nearly useless. Your job is to design the study:
- Scene parameterization. Identify the scene variables most likely to control collision risk (e.g., the gap between a pedestrian entering the crosswalk and ego arrival, occlusion geometry, ego speed, road friction, weather/lighting, sensor noise), and describe how their joint real-world distribution would be estimated.
- Sampling design. Propose how to draw scenarios so that conflicts are over-represented, while still recovering an unbiased estimate of the real-world rate. Explain how you would deal with the dimensionality of the parameter space.
- Metrics. Define safety metrics that carry more information than a binary crash flag (TTC, PET, deceleration-to-avoid, envelope violations, impact severity), and explain how they are used.
- Validation. Explain how you would check that conclusions drawn in the tilted simulator actually predict on-road behavior.
Address the bias-variance trade-off of the proposal distribution, the conditions under which the estimator is unbiased, and how you would diagnose that the proposal is failing. Assume the naturalistic scene distribution has a tractable density you can evaluate, and that the simulator's dynamics are fixed and not modified by your sampling scheme.
Hints
Hint 1
Start with the arithmetic: with p ≈ 1e-4 and 50k runs, what relative standard error does plain Monte Carlo give, and how much variance reduction do you need for a ±10% interval?
Hint 2
Sketch the importance-sampling estimator and state the support condition — a proposal that assigns zero density to a real failure mode silently destroys unbiasedness.
Hint 3
Weight degeneracy grows with the number of tilted dimensions: use a pilot sensitivity analysis to find the few dimensions that matter and leave the rest at their natural distribution.
Hint 4
Separate the exploratory phase that adapts the proposal from the estimation phase that keeps it fixed, and report effective sample size alongside the point estimate.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
1. Frame the arithmetic before proposing anything
Take one simulated intersection crossing as a fixed exposure and suppose the per-run collision probability is p ≈ 1e-4 (matching ~1 per 10,000 miles if a run is roughly a mile of approach).
- Plain Monte Carlo at N = 50,000 expects Np = 5 collisions. The relative standard error of a binomial estimate is √((1−p)/(Np)) ≈ 0.45, so a 95% interval is roughly ±90% of the estimate. The probability of seeing zero collisions is e⁻⁵ ≈ 0.7%.
- A ±10% relative interval at 95% confidence needs N ≈ (1.96)²/((0.1)²·p) ≈ 3.8M runs.
- So the target is roughly 75–100× variance reduction, and 5 observed collisions is far too few to trust any interval without a variance-reduction scheme.
That framing tells the interviewer you understand why the problem is hard, not just what technique to name.
2. Parameterization of the scene
Each run draws a scene vector x from a naturalistic density p(x) fit to fleet logs — never hand-tuned. Group the parameters by the mechanism through which they create risk:
| Group | Example parameters |
|---|---|
| Conflict timing/geometry | pedestrian emergence time relative to ego arrival, crossing speed and angle, ego approach speed |
| Occlusion | occluder size, distance from crosswalk, fraction of pedestrian path hidden, time-to-visible |
| Actor behavior | red-light-running propensity, yielding style, jaywalking, sudden braking |
| Perception degradation | rain rate, fog density, glare angle, low light, sensor dropout and noise |
| Dynamics | surface friction, brake actuation latency |
Dependence matters: rain co-occurs with low friction and lower pedestrian counts. Model this with a copula or a conditional factorization so p(x) remains a proper joint density whose value is computable per sample — prerequisite for importance weights.
Curse of dimensionality. Importance weights degenerate exponentially in the number of tilted coordinates. Handle it in three steps: (1) run a 2–5k pilot and compute global sensitivity (Sobol indices, or a surrogate model of min-TTC) to find the 3–6 dominant parameters — typically emergence gap, occlusion, ego speed, friction; (2) tilt only those, leaving the rest sampled from p(x) so their weights are exactly 1; (3) use stratified or low-discrepancy sampling within the biased dimensions.
3. Sampling design and the estimator
Draw xᵢ ~ q(x) and let F be the collision event. Estimate
p̂ = (1/N) Σᵢ 1[F(xᵢ)] · w(xᵢ), where w(x) = p(x)/q(x).
This is unbiased because E_q[1_F · p/q] = ∫ 1_F p dx = P(F), provided q(x) > 0 anywhere p(x)·1_F(x) > 0 — the support condition. The weight is the Radon–Nikodym derivative dP/dQ. Only initial conditions and actor behavior are reweighted; simulator dynamics stay untouched, so the physics of each rollout is credible. The idealized proposal q*(x) = p(x)1_F(x)/P(F) has zero variance but is unknown; everything below approximates it.
Cross-entropy fitting. Start from q₀ = p (or p with inflated variance on the key dimensions). Each iteration: run a batch, score runs by continuous min-TTC, take the worst 10%, and refit q (a Gaussian mixture or a shifted/scaled parametric family) by weighted maximum likelihood on the elite set, tightening the threshold until collisions are ~10–30% of samples. Budget ~10k runs for adaptation.
Defensive mixture. Use q = α·p + (1−α)·q_CE with α ≈ 0.1. This caps every weight at 1/α, so an unanticipated failure mode (e.g. a red-light runner the tilted proposal under-samples) cannot produce an infinite weight and an aberrant estimate. Mixtures also cover multiple failure modes — an occluded pedestrian and a signal violator are distinct clusters.
Estimation phase. Freeze q and spend the remaining ~40k runs with it. Report p̂ with a CI from the sample variance of 1_F·w, the effective sample size ESS = (Σw)²/Σw², and a histogram of weights. Heavy-tailed weights or ESS ≪ N are the diagnostic signal that the proposal missed a mode — this is the key follow-up interviewers probe.
Alternative: subset simulation. Factor P(F) = Π P(F_k | F_{k−1}) over nested min-TTC thresholds (2.0s → 1.0s → 0.5s → 0), each level with conditional probability ~0.1, sampled by MCMC seeded from the previous level. It needs no explicit q and is robust in moderate dimension, at the cost of a mild bias and harder CIs. Mention both and pick based on whether p(x) is tractable.
4. Metrics beyond the binary indicator
- Min TTC (gap over closing speed under constant-velocity extrapolation): continuous, the natural score for CE/subset simulation.
- PET: time between one agent leaving the conflict zone and the other entering — natural for crossing conflicts.
- DRAC: deceleration needed to avoid impact, compared to the friction limit.
- Envelope violations: RSS-style safe-distance breaches.
- Collision severity: impact speed/Δv mapped to injury risk — a 5 km/h tap ≠ a 40 km/h strike.
- Fault attribution: at-fault vs. unavoidable collisions, rule violations, hard-brake and jerk counts.
These give gradient signal for optimization and enable extreme-value theory: fitting a generalized Pareto distribution to the tail of −min-TTC extrapolates P(TTC ≤ 0) as an independent cross-check on the IS estimate.
5. Generalization: does the simulator predict the road?
Importance sampling corrects sampling bias, not model bias. Validate three layers:
- Scene density p(x). Hold out fleet logs; compare marginals and dependence with KS/Anderson–Darling and copula goodness-of-fit. Focus on the tails, where weights concentrate.
- Sim fidelity via log replay. Replay real drives with real or re-simulated sensors; compare detection recall vs. range/occlusion, state-estimation error, and planner trajectories to what actually happened.
- Outcome calibration via shadow mode. Run the stack passively on the fleet, logging would-be decisions and surrogate metrics. Near-misses (TTC < 1.5s) occur ~100–1000× more often than collisions, so they are testable on real data: compare the IS-weighted simulated near-miss rate per mile to the observed rate with a Poisson test, and calibrate the full min-TTC distribution. Report the collision estimate with a separate model-uncertainty band, never as a single confident number.
Common mistakes to avoid: presenting a point estimate without an interval; adapting q and estimating from the same runs (biases the estimate); tilting every parameter equally (weight collapse); choosing a proposal with bounded support that clips a real failure mode (silent bias); sampling the 50k runs with no pilot sensitivity analysis; and claiming the IS correction handles simulator error. The strong candidate separates sampling error, proposal-miss risk, and model error, and quantifies each.