Skip to content

Formal Process Models as Prompting Scaffolds (Petri Net of Thoughts)

Derive reasoning structure from process evidence — Petri net places define states, transitions define decisions, and token replay drives each prompt step with accumulated context.

The technique

Standard structured prompting (CoT, ToT, GoT) relies on the developer to decompose reasoning steps by hand. Petri Net of Thoughts (PNoT) inverts this. The structure comes from a formally discovered or expert-defined process model, not hand-built intuition.

A Petri net is a bipartite graph of places (states) and transitions (decisions). Tokens flow by firing rules. A transition fires when all its input places hold tokens, consuming them and producing tokens in output places. This gives three properties that looser prompting topologies lack:

  1. Formally defined paths: places and transitions encode sequence, concurrency, and choice explicitly.
  2. State-aware prompts: each transition receives a system prompt that reflects the current marking (token distribution), not just the prior step's output.
  3. Traceable reasoning: when output diverges, trace backward through transitions to the point of failure.

Gavric, Bork, and Proper (2025) introduced PNoT at EMISA 2025, applying process discovery techniques to derive the net structure from event logs or domain expertise, then using token replay to guide the LLM through each transition sequentially.

graph TD
    P1[Place: Requirements gathered] --> T1[Transition: Classify change type]
    T1 --> P2[Place: Bug fix identified]
    T1 --> P3[Place: Feature request identified]
    P2 --> T2[Transition: Locate failing test]
    P3 --> T3[Transition: Draft implementation plan]
    T2 --> P4[Place: Root cause isolated]
    T3 --> P4
    P4 --> T4[Transition: Generate patch]
    T4 --> P5[Place: Patch ready for review]

How token replay drives prompting

Token replay is a process mining algorithm that simulates execution by moving tokens through the net. In PNoT, each transition firing is an LLM call:

  1. Initialize: place tokens at the start place. The initial system prompt encodes the task definition and net structure.
  2. Fire: when a transition is enabled (all input places have tokens), call the LLM with a system prompt that reflects the current state and the decision the transition represents.
  3. Advance: consume input tokens, produce output tokens in the next places, and append the LLM's response to the accumulated context.
  4. Repeat: continue until tokens reach the final place.

Each LLM call sees both the accumulated reasoning history and the specific decision it must make. The Petri net constrains what the model considers at each step.

When this adds value

PNoT pays off when the reasoning process has known structure: a defined sequence of decisions, branching conditions, and convergence points.

  • CI/CD pipelines: classify the failure type, select a remediation strategy, verify the fix.
  • Code review workflows: check style, check logic, check security, then aggregate the findings.
  • Regulatory or compliance checks: sequential gates with defined pass or fail criteria.

MedVerse (2026) independently applied Petri net theory to medical diagnosis, reframing differential diagnosis as a DAG-structured parallel execution framework. It reported up to 8.9% accuracy gain over general-purpose LLM baselines, plus a 1.3x inference-latency reduction and 1.7x throughput gain relative to specialized medical LLMs.

When simpler approaches suffice

Defining a Petri net costs effort: you specify places, transitions, and firing rules. That cost is not justified for every task.

  • Open-ended exploration: the reasoning path is unknown upfront, so a Plan Mode prompt or Tree of Thoughts fits better.
  • Single-step tasks: one decision, one action, where structured reasoning adds no benefit.
  • Advanced reasoning models: models with extended thinking (Claude with ultrathink, o1) internalize multi-step reasoning, so external scaffolding adds overhead where the model's native reasoning already covers the decision structure.

Besta et al. (IEEE TPAMI 2025) provides the formal taxonomy of CoT (chain), ToT (tree), and GoT (graph) reasoning topologies — each suited to different task structures. The PNoT paper itself (Gavric, Bork, and Proper 2025) situates Petri nets as an additional topology that is strongest when the structure is derivable from evidence rather than designed by intuition.

Key Takeaways

  • PNoT derives reasoning structure from process models rather than hand-crafted decomposition — the net comes from evidence or domain expertise
  • Token replay maps each transition to an LLM call with a state-aware system prompt, constraining what the model considers at each step
  • Traceability is built in: trace backward through transitions to find where reasoning diverged
  • Best suited for process-aware tasks with known decision sequences — CI pipelines, review workflows, compliance checks
  • For open-ended reasoning or single-step tasks, simpler topologies (CoT, ToT, Plan Mode) have lower overhead
Feedback