Text-to-simulation
Helping domain experts rapidly build realistic simulation environments
We first demoed a GPT-3 augmented simulator (for agent-based models) six years ago, in mid-2020. Since then, we've been able to develop much more powerful tools for helping domain experts codify their knowledge in simulation form. This post explores what "text-to-simulation" looks like in HASH today.
Creating models of our world can deliver a lot of value, by giving us the opportunity to explore assumptions, risks, and decisions in a safe environment.
A lot of this value remains unrealised – not because the processes are too complex to capture, but because capturing them formally is slow, fiddly work that demands fluency in formalisms that domain experts don't have. The person who understands how orders move through a warehouse, how a disease spreads through a population, or how a claim moves through an adjudication pipeline is rarely the person who knows how to express it in the terms a rigorous simulation requires.
So the knowledge stays informal and unstructured: in a slide, a document, a spreadsheet, or someone's head. And informal descriptions can't be simulated, can't be verified, and can't be reliably reasoned over.
Petrinaut is our free, open visual editor for Petri nets, a mathematical formalism for representing complex processes. Its built-in AI assistant empowers domain experts to bootstrap a working model and experiment with it in minutes rather than days.
Formality without formal training
You don't need to know what a "transition kernel" is, or how to express a stochastic firing rate. You describe the system the way you'd explain it to a colleague, and the assistant handles the formalization.
It doesn't just guess and dump a net on the canvas. The assistant is built to interview first, build second. Before committing to a structure, it asks a short, focused set of questions about the things that actually determine the model's shape: the key states and the events between them, what you'll want to measure once it runs, and the what-if scenarios you'll want to explore.
If you're not sure about anything, the AI can make some educated guesses to get something working, which can be refined over time as assumptions are checked and gaps filled.
From structure to realism
Once it has enough to go on, the assistant lays out the shape of your process: the places that keep track of world state represented by 'tokens', and the transitions that change state by consuming and producing tokens.
Real-world behavior can't be fully captured by boxes and lines. Things take varying amounts of time, outcomes are uncertain, and some things don't jump between states but evolve continuously: the position of a vehicle, the level of a tank, the concentration of a drug in the body. Petrinaut captures all of this: it supports a rich superset of the classical Petri net, layering on stochastic timing, probability distributions, and continuous dynamics, so a single model can interleave discrete events with smoothly-changing state.
The assistant can author everything needed to capture this complexity, and to ask revealing questions of the model:
→
Typed tokens when real-world entities have important attributes: a shipment with a weight and a destination, an agent with a position and velocity.→
Transition firing rules represent additional conditions for when things happen, or the rate at which they occur.→
Probability distributions for outcomes that aren't fixed, such as the chance of something succeeding.→
Continuous dynamics for quantities that evolve smoothly between discrete events.→
Parameters and scenarios, so you can tune key assumptions and compare interventions — baseline vs. surge, policy A vs. policy B — without editing the net by hand.
The AI can also author custom live visualizations for the model: small graphics that render a place's contents as the simulation runs: a queue as a stacked bar, satellites as orbiting dots, an infected population as a heat-dot grid. These turn an abstract net into something you can watch in whatever presentation is most familiar and useful, which is often what makes a model legible to the people who need to trust it.
It checks its own work
The rules and visualizations above are all backed by real code, and code has bugs. The thing that makes the assistant reliable rather than merely fast is that it can see its own errors and fix them.
After writing any code, the assistant reads back the editor's live diagnostics, spots anything that doesn't compile, and corrects itself before it ever hands the model back to you.
You can also collaborate on writing behaviors directly, by giving the AI a starting point in code and asking it to review and improve it.
From knowledge to insight
The payoff is a formal object you can immediately put to work. Press play and the model that was only an idea in a conversation started minutes ago becomes a fully-fledged simulation, showing your chosen metrics and live visualizations frame by frame.
You can sweep parameters and run many simulations at once to see the distribution of outcomes — best case, worst case, and everything in between — or hand it back to a human as a diagram they can audit, edit, and approve.
The path runs all the way from natural language to a verifiable, simulatable model, with the assistant doing the formalization in between.
Why Petri nets?
What's really going on here is a small, practical instance of a much bigger idea: autoformalization — translating informal descriptions (natural language, sketches, semi-structured documents) into formal, mathematical objects.
This is hard in general because most formal targets are unforgiving and most informal inputs are vague. The interesting move is choosing a target formalism that is both expressive enough to capture real processes and structured enough to give an AI fast, checkable feedback while it works.
Petri nets are an unusually good target on both counts. They are:
→
Precise — there's no ambiguity about what a net means, so "did we capture the process correctly?" is a question with a real answer.→
Executable — you can simulate a net to estimate throughputs, bottlenecks, and time-to-completion distributions.→
Verifiable — you can formally check properties of the model before anything runs.
That combination is what lets the assistant be self-correcting rather than just plausible: because the formalism is executable and checkable, the model gets a tight write-check-fix feedback loop instead of producing an opaque output nobody can trust. We've written before about why Petri nets are such a good fit for orchestrating agentic systems, and about our broader work on learning predictive process state.
It's also an area of active research at HASH through our work with the UK's Advanced Research and Innovation Agency, where the goal is AI that produces formally-checkable artifacts rather than opaque outputs.
Try it
You can build a model from a plain-language description right now, for free, in your browser at demo.petrinaut.org. To go deeper on everything the editor can do, see the Petrinaut user guide.
If you have a modelling use case you'd like help with, we'd love to hear from you.
Create a free account
Sign up to try HASH out for yourself, and see what all the fuss is about
By signing up you agree to our terms and conditions and privacy policy
