Generating Safety-Critical Driving Scenarios from Role-Typed Signal Temporal Logic Specifications Drafted by Large Language Models
Organizations: RAMS Lab, Huawei Heisenberg Research Center, 80992 Munich, Germany · Department of Computer Engineering, Technical University of Munich, 85748 Garching, Germany · RAMS Lab, Huawei Technologies Co., Ltd., 518129 Shenzhen, China
Abstract
Safety-critical scenarios are rare in recorded driving and must be generated to test and train motion planners of automated vehicles. In guided diffusion models, each scenario type needs its own weighted objective, separate from the validity check. Optimized together with the attacker, the vehicle under test can cancel the attack or draw it toward itself. We state each scenario as a signal temporal logic specification with clauses typed by role. Every clause names the agent it may change and the agents it may read, and the vehicle under test reads the attacker only from the attack onset. A large language model drafts the specification from a description, and a type checker accepts it. A compiler derives the optimization: it edits a diffusion model's samples by the smallest change that satisfies the specification, each clause moves only its owner, the attacker is solved against the unreacted vehicle under test before its response, and the monitor of the same specification decides acceptance. On nuScenes and CommonRoad, judged independently of the specification, one parameter set produced valid scenarios at a rate 0.14 above a weighted objective tuned per scenario type, and descriptions yielded at least one valid scenario for 11 of the 16 pre-crash types expressible in the public data. Learned planners fail more often on the generated scenarios than on their seeds. Fine-tuning on them lowers a planner's failure rate on critical scenarios, and the time headway one clause of the label requires, not the generator, sets the size of the gain.
Figures & tables
| Method | Ego trajectory | Terms move | Attack against | Accepted by |
|---|---|---|---|---|
| CTG, CTG++ [ 5 , 12 ] | generated | all guided agents | reacting ego | none |
| STRIVE [ 17 ] | planner, then generated | all agents | planner rollout | solution found |
| A2CoST [ 18 ] | planner, then generated | adversaries | planner | remedy found |
| Orchestration [ 31 ] | planner | one actor | planner | constraints satisfied |
| AnchorDrive [ 30 ] | LLM driver, then generated | all agents | reacting ego | LLM assessor |
| OMEGA [ 19 ] | generated | ego, attacker in turn | reacting ego | none |
| Predicate | Value | Unit |
|---|---|---|
| arc length along from ’s front to ’s rear | m | |
| lateral offset of from the center line of | m | |
| lateral separation of the footprints across | m | |
| lateral displacement of from its initial offset | m | |
| , | speed, longitudinal acceleration | m/s, |
| m/s 2 |
| Clause | Owner | Reads | Kind | Meaning | Formula |
| brake | attack | hard braking into the unreacted ego vehicle | -3.5\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2} | ||
| quiet | check | no braking before the hold time; verified, not optimized | -2\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2}$$ | ||
| att_lane | require | attacker stays in the ego’s lane | 0.8\text{,}\mathrm{m}$$ | ||
| att_road | require | attacker stays on the road | |||
| no_third_party_hit | require | attacker clear of the context agents | 0.3\text{,}\mathrm{m}$$ | ||
| observe | observe | onset : braking the ego vehicle can observe | -2\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2} , sustained for $\sigma=$0.4\text{\,}\mathrm{s} |
| Method | CR cut-in | CR EB | nuSc. cut-in | nuSc. EB | Pooled | Ours method, pooled |
| B0 (seed) | 0.01 | 0.00 | 0.00 | 0.00 | 0.00 | [ , ] |
| HW | 0.38 | 0.62 | 0.63 | 0.67 | 0.57 | [ , ] |
| HW, gate multipliers | 0.31 | 0.54 | 0.68 | 0.74 | 0.57 | [ , ] |
| HW+pin | 0.23 | 0.33 | 0.52 | 0.33 | 0.35 | [ , ] |
| HW+pin, retuned | 0.27 | 0.41 | 0.54 | 0.71 | 0.48 | [ , ] |
| B1 | 0.08 | 0.05 | 0.13 | 0.03 | 0.07 | [ , ] |
| nuScenes | CommonRoad | |||||||||
| Edit | Attacker | Ego | Edit | Attacker | Ego | |||||
| Method | [m] | acc. | jerk | acc. | jerk | [m] | acc. | jerk | acc. | jerk |
| Logs, half against half a | 0.15 | 0.43 | 0.15 | 0.43 | 0.10 | 0.13 | 0.10 | 0.13 | ||
| Seed (B0) b | 0.0 | 0.47 | 1.51 | 0.50 | 1.60 | 0.0 | 0.04 | 0.33 | 0.35 | 1.06 |
| HW | 8.6 | 0.86 | 1.50 | 0.90 | 1.86 | 8.4 | 1.14 | 0.66 | 1.19 | 1.14 |
| HW+pin, retuned | 10.7 | 0.99 | 1.38 | 0.80 | 1.33 | 10.3 | 1.31 | 1.02 | 1.40 | 0.72 |
| Valid and | Required deceleration [m/s 2 ] | Attacker | |||
|---|---|---|---|---|---|
| Constant | Valid | accepted | median [Q1, Q3] | edit [m] | |
| None (Table IV ) | 73 | 46 | 0.50 [0.25, 0.75] | 1/73 | 12.1 |
| 2 | 72 | 46 | 1.50 [0.75, 2.00] | 24/72 | 19.1 |
| 3 | 68 | 38 | 1.75 [1.00, 2.31] | 32/68 | 19.1 |
| 4 | 64 | 33 | 2.00 [1.25, 2.75] | 33/64 | 19.1 |
| LLM | STL | Code | STL code |
|---|---|---|---|
| Claude Opus 5.5 | 9/34 | 5/34 | [ , ] |
| GPT-6.1 Sol | 14/42 | 8/42 | [ , ] |
| DeepSeek V4-Pro | 32/168 | 16/168 | [ , ] |
| Claude Sonnet 5.5 | 10/34 | 6/34 | [ , ] |
| GPT-6 Luna | 64/252 | 39/252 | [ , ] |
| DeepSeek V4.1-Flash | 23/168 | 26/168 | [ , ] |
| Runs | Valid | Distinct | Edit [m] | Win./h | Ours HW+pin, ret. | |
| 1 | 1.0 | 0.71 (0.63–0.78) | 0.51 (0.43–0.59) | 14.7 | 998 | [ , ] |
| 5 | 3.9 | 0.78 (0.69–0.85) | 1.51 (1.26–1.78) | 12.7 | 612 | [ , ] |
| 10 | 7.4 | 0.80 (0.73–0.87) | 2.35 (1.94–2.75) | 11.9 | 467 | [ , ] |
| 20 | 14.3 | 0.81 (0.73–0.88) | 3.38 (2.82–3.94) | 10.5 | 310 | [ , ] |
| , windows per batch 1 / 128: 74 / 654 windows per accelerator hour | ||||||
| Platform | Planner | Ours [%] | Seed B0 [%] | Ours B0 [pp] | HW+pin, retuned [%] | Ours HW+pin, retuned [pp] |
|---|---|---|---|---|---|---|
| nuScenes | Diffusion Planner | 6 (2–10) | 0 (0–1) | [ , ] | 11 (6–16), | [ , ], |
| nuScenes | Flow Planner | 17 (11–24) | 2 (0–5) | [ , ] | 46 (36–57), | [ , ], |
| CommonRoad | Diffusion Planner | 13 (8–20) | 3 (0–7) | [ , ] | – | – |
| CommonRoad | Flow Planner | 18 (8–28) | 4 (1–8) | [ , ] | – | – |
| CommonRoad | Reactive (reference) | 8 (3–14) | 1 (0–4) | [ , ] | – | – |
| Critical [%] | Benign twins | ||||||
| Added data | Scenes | Headway | ours | HW+pin | Fail. | Progress | Hard br. |
| None (replay) | – | – | 36.8 | 55.3 | 5.4 | – | 0.8 |
| Unedited seeds | 1,121 | – | 40.5 | 57.7 | 4.9 | 0.5 | |
| Ours | 1,121 | 0.84 | 34.0 | 53.4 | 3.3 | 0.6 | |
| Ours, no pinning | 1,121 | – | 32.4 | 52.1 | 2.8 | 0.6 | |
| B1 | 101 | – | 45.0 | 61.6 | 5.9 | 0.9 | |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Clause | Owner | Reads | Kind | Formula |
| cut | attack | 0.5\text{,}\mathrm{m}15\text{,}\mathrm{m}1\text{,}\mathrm{m}-0.5\text{,}\mathrm{m}8\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2} | ||
| avoidable | require | 1.9\text{,}\mathrm{m}1.9\text{,}\mathrm{m}4.5\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2} | ||
| no_hit | require | 0.05\text{,}\mathrm{m}$$ | ||
| att_stays | require | 0.5\text{,}\mathrm{m}$$ | ||
| att_road | require | |||
| observe | observe | 0.5\text{,}\mathrm{m} , sustained for $\sigma=$0.4\text{\,}\mathrm{s} |
| Clause | Owner | Reads | Kind | Formula |
| quiet | check | -2\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2}$$ | ||
| brake | attack | -3.5\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2}-0.5\text{,}\mathrm{m}-0.5\text{,}\mathrm{m} | ||
| att_lane | require | 0.8\text{,}\mathrm{m}$$ | ||
| att_road | require | |||
| observe | observe | -2\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2} , sustained for $\sigma=$0.4\text{\,}\mathrm{s} | ||
| ego_clear | require | 0.5\text{,}\mathrm{m}0.05\text{,}\mathrm{m} |
| Clause | Owner | Reads | Kind | Formula |
| cross | attack | 0.5\text{,}\mathrm{m}-0.5\text{,}\mathrm{m}-0.5\text{,}\mathrm{m} | ||
| avoidable | require | 1.2\text{,}\mathrm{m}1.2\text{,}\mathrm{m}4.5\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2} | ||
| no_early_hit | require | 0.05\text{,}\mathrm{m}$$ | ||
| walking_speed | require | 3\text{,}\mathrm{m}\mathrm{/}\mathrm{s}$$ | ||
| observe | observe | , sustained for 0.4\text{,}\mathrm{s}$$ | ||
| ego_clear | require | 0.5\text{,}\mathrm{m}0.05\text{,}\mathrm{m} |
| Clause | Owner | Reads | Kind | Formula |
| turn_hit | attack | |||
| follow_turn | require | 0.8\text{,}\mathrm{m}$$ | ||
| att_road | require | |||
| avoidable | require | 1.9\text{,}\mathrm{m}1.9\text{,}\mathrm{m}4.5\text{,}\mathrm{m}\mathrm{/}\mathrm{s}^{2} | ||
| no_early_hit | require | 0.05\text{,}\mathrm{m}$$ | ||
| observe | observe | 0.5\text{,}\mathrm{m} , sustained for $\sigma=$0.4\text{\,}\mathrm{s} |
| Type | Name | Freq. [%] | Valid | nuSc. | CR | Win. |
|---|---|---|---|---|---|---|
| N01 | Lead Vehicle Stopped | 16.4 | 4/16 | 0/8 | 4/8 | 1 |
| N03 | Vehicle(s) Turning at Non-Signalized Junctions | 7.3 | 4/24 | 4/16 | 0/8 | 2 |
| N04 | Lead Vehicle Decelerating | 7.2 | 1/16 | 1/8 | 0/8 | 1 |
| N06 | Vehicle(s) Changing Lanes – Same Direction | 5.7 | 9/16 | 5/8 | 4/8 | 2 |
| N08 | Straight Crossing Paths at Non-Signalized Junctions | 4.4 | 0/24 | 0/16 | 0/8 | 0 |
| N11 | LTAP/OD at Signalized Junctions | 3.7 | 0/16 | 0/8 | 0/8 | 0 |
| Catalogue | Scenario | NHTSA type | Status | Evidence, or what is missing |
| ISO 34502 Annex B, general vehicle (Fig. B.6; the ego keeps its lane unless stated) | ||||
| No. 1 | cut-in on the main roadway | N06 | generated | cut-in family (Table IV ), 9/16 in Table XV ; Fig. 3 (c) |
| No. 9, 17 | cut-in in the merge and departure zones | N06 | expressible | the same specification; no ramp windows in the case sets (NGSIM US-101 has them) |
| No. 2, 10, 18 | cut-out: the lead vehicle leaves the lane and reveals a slower vehicle | N01, N04 (the revealed lead vehicle) | expressible | specification cutout ; needs windows with a slower vehicle ahead of the lead vehicle |
| No. 3, 11, 19 | a following vehicle accelerates into the ego | none | expressible | specification rear_approach (the ego moves clear); the judges excuse the ego from a rear impact, so this threat needs its own judge item |
| No. 4, 12, 20 | the lead vehicle decelerates or stops | N01, N04, N12 | generated | lead-vehicle braking family (Table IV ); 4/16, 1/16, 1/16 in Table XV |
Autonomous Driving Scenario Generation
Autonomous driving scenario generation creates realistic, controllable traffic situations for training and testing vehicles, especially in rare and safety-critical cases.
See all 126 papers