Inspiration

We kept coming back to the same observation: motorsport already runs incredibly sophisticated simulations, but a human still has to pick which scenario to simulate and usually the one they already suspect is dangerous. Real-world crash data can tell you a corner is risky, but it can't tell you which specific combination of driver behavior, weather, and traffic actually produced that risk, because nobody logs incidents at that level of granularity. That gap we identified was the space between "we can simulate anything" and "we don't know what to search for" .

What it does

Provenance runs 22 AI driver agents, each with a fixed behavioral personality (aggressive, defensive, late-braker, high-consistency, and more), through the same circuit thousands of times, varying weather, traffic density, and human-error rates on every run. Every near-miss is measured with Time-to-Collision (TTC) and Post-Encroachment Time (PET) , the same surrogate safety metrics highway engineers use to study real intersections, not an invented danger score.

The system then mines those thousands of runs for recurring patterns: not "Turn 7 is dangerous," but this exact combination like wet track, heavy traffic, an aggressive driver overtaking a defensive one produces a critical conflict in 3.5% of runs. Any incident can be replayed step by step with a causal explanation, and proposed fixes can be tested on the identical random seed to confirm whether they actually reduced conflicts, rather than just producing a different random outcome.

Challenges we ran into

  • A reaction-time model that broke overtaking. We modeled driver reaction time as a genuine perception delay — each agent acts on the world as it looked one reaction-time ago. Applied uniformly, though, lateral separation between cars already side-by-side started oscillating past the physical clearance between them, and a third of all committed passes ended in contact. We fixed it by judging immediate lateral separation on true position, and reserving the delay for developments still at distance.
  • A determinism bug that only appeared sometimes. Re-running the same seed occasionally produced different trajectories. It turned out a set of error kinds was being iterated while drawing random numbers, so the RNG stream silently depended on Python's hash seed. The fix was a one-line change to an ordered tuple — finding it took much longer.
  • Pattern keys that never recurred. Our first version of the discovery engine keyed patterns on every variable we had, including archetype pair and dominant error. The key space blew past three million combinations and nothing ever repeated. We coarsened the key to zone × weather × traffic band × conflict type, and reported archetype pair and dominant error as the composition within each pattern instead — which turned out to be both more useful and more honest.
  • Staying honest under pressure to overclaim. It was tempting, especially late at night with a demo deadline looming, to describe results as "this corner has an X% crash chance." We held the line throughout the build: every output is explicitly a property of the simulation under stated assumptions, never a real-world safety claim.

What we learned

That the interesting problem wasn't building a race simulator plenty of those exist but it was building the search and discovery layer on top of one. Also: reaction-time modeling, RNG determinism across processes, and staying scientifically honest under time pressure are each harder than they look, and the last one required us to write it into the codebase, not just say it out loud.

What's next for Provenance

Guided/adversarial scenario search to more efficiently hunt the dangerous regions of parameter space, a natural-language "ask the simulator" interface backed by fixed, auditable queries rather than free-form text-to-SQL, and extending beyond our single fictional circuit to validate whether these patterns generalize across track layouts.

Built With

  • fastapi
  • montecarlo
  • numpy
  • pydantic
Share this project:

Updates

Submission history