Background: scenarios generated by Loop2Scenic in CARLA

Multimodal scenario generation · CARLA · Scenic

Loop2Scenic

A Self-Refining Agentic Framework with Closed-Loop Visual Feedback for Multimodal Safety-Critical Driving Scenario Generation

Yuan Gao1,*Chen Li1,*Lim Yung Loon1Finn Rasmus Schäfer1Felix Jahncke1Mattia Piccinini1Qunying Song2Sebastian Schmidt3Johannes Betz1
1Professorship of Autonomous Vehicle Systems, Technical University of Munich   2University College London, University of London   3Data Analytics and Machine Learning Group, Technical University of Munich   *Equal contribution
Technical University of MunichAutonomous Vehicle Systems Lab, TUMUniversity College London
100%compilation success rate (CSR)
80.2%framework accuracy (FA), five rounds
250benchmark queries, five input modalities
6driving policies tested in closed loop: 3 VLA stacks, 3 RL policies
Motivation

Scenario-based testing of automated driving systems must cover safety-critical corner cases, which are difficult to collect on real roads and laborious to script in simulation.

Language models can write programs in Scenic, a human- and machine-readable domain-specific language for driving scenarios. However, generating diverse, executable scenarios that faithfully reflect the user's query remains challenging. Existing frameworks face two recurring limitations.

Limitation 1

Limited query-alignment feedback

Open-loop methods generate or assemble Scenic programs for execution in CARLA without using rendered scenarios to guide refinement. Code-feedback loops use compiler or runtime errors to improve executability, but these checks do not establish whether the rendered scenario matches the query.

Limitation 2

Limited multimodal retrieval

Methods such as Talk2Traffic use a VLM to convert visual inputs into text and retrieve code snippets indexed by text alone, which ignores how a stored scenario unfolds in simulation.

Three pipelines: open-loop and semi-loop Scenic generation (top), and Loop2Scenic with multimodal retrieval and a VLM critic that sends repair and regeneration feedback from the rendered video (bottom).
Scenic scenario generation with open-loop (top), semi-loop (middle), and Loop2Scenic's multimodal retrieval and VLM-based visual feedback for repair and regeneration (bottom).
Contributions

What Loop2Scenic contributes

1

Self-refining, closed-loop pipeline

A self-refining, closed-loop pipeline for safety-critical driving scenario generation, combining multimodal retrieval and VLM feedback to refine Scenic programs.

2

Multimodal benchmark

A multimodal benchmark of 250 safety-critical queries across five input modalities from simulator-generated and real-world sources, on which Loop2Scenic and four state-of-the-art methods are evaluated.

3

Closed-loop testing

Evaluation against four state-of-the-art methods on executability, query alignment, and scenario criticality, and closed-loop testing of three state-input RL policies and three VLA driving stacks under non-reactive and reactive traffic.

Comparison of Scenic scenario generation methods

Loop2Scenic is the only compared method combining multimodal input and RAG with iterative generation and reactive traffic.

MethodUIInputRAGGLoopBench.
TIVTCSV
Assemble
ChatScene✕✓✕✕✕✓✕✕C
Ext-Scenic✕✓✓✕✕✕✕✕C
TrafficAlign✕✓✕✕✕✕✕✕C
Generation
ScenicNL✕✓✕✕✕✓✕✕F
Dashcam2Sim✕✕✕✓✕✕✕✕F
Talk2Traffic✓✓✓✕✕✓✕✕C
Rubavicius et al.✓✓✕✕✕✓✕✕F
NL2Scenic✕✓✕✕✕✓✕✕F
ScenGE✕✓✕✕✓✕✕✕F
ARISE✕✓✕✕✕✓✕✕C
Chat2Scenic✓✓✕✕✓✓✕✕I
D-V2S✕✕✕✓✕✕✕✕F
Loop2Scenic (ours)✓✓✓✓✓✓✓✓I

UI: user interaction. Input: T text, I image/sketch, V video. RAG: T text, C code examples, S seed program, V video. G: F full DSL, C separate scenario components, I iterative generation. Loop: open, code checks/human, indirect visual feedback, direct VLM feedback. Bench.: none, modular ADS, plus end-to-end (E2E) models, plus reactive traffic.

Read the abstract

Scenario-based testing of automated driving systems must cover safety-critical corner cases, which are difficult to collect on real roads and laborious to script in simulation. Existing methods use language models to generate programs in Scenic, a human- and machine-readable domain-specific language for representing driving scenarios. However, generating diverse, executable scenarios that faithfully reflect the user's query remains challenging. We present Loop2Scenic, a self-refining agentic framework for multimodal driving scenario generation with closed-loop visual feedback, uniquely combining text, image, and video inputs with retrieval-augmented generation. Given a text, image, or video query, it retrieves a Scenic program as a seed and executes it in CARLA. A vision-language model (VLM) critic evaluates rendered views and actor trajectories against query-derived criteria, guiding program acceptance, targeted repair, or regeneration. Further, we introduce a multimodal benchmark of 250 queries across five input modalities with human-written criteria for evaluating whether generated scenarios match their queries. On this benchmark, five-round Loop2Scenic achieves a compilation success rate (CSR) of 100% and framework accuracy (FA) of 80.2%, outperforming four state-of-the-art methods using the same underlying model. The strongest baseline achieves 65.2% CSR and 54.5% FA. Mean scenario quality rises from 70.5% at zero rounds to 79.0% at three and 80.2% at five. Further, Loop2Scenic achieves observed mean SafeBench scores 2.7–14.1% lower than the four baselines on matched queries, averaged over three reinforcement learning (RL) policies, indicating more critical scenarios. We further evaluate driving systems on the generated scenarios, extending Scenic-based closed-loop testing from modular systems to vision-language-action (VLA) driving stacks and from non-reactive to reactive traffic.

Method

Retrieve, execute, critique, refine

Loop2Scenic combines multimodal retrieval with VLMs serving as Scenic generator and visual critic. Unlike compiler or runtime checks, the critic evaluates query alignment on rendered views and actor trajectories, and its feedback drives the refinement loop.

Framework: interactive module with the VLM interpreter, RAG module with scenario and code retrievers, generation module with header generator, component generator and error resolver, evaluation module with CARLA execution and the VLM critic, and downstream tests.
Loop2Scenic overview. The Interactive Module interprets multimodal queries, and RAG Module retrieves seed Scenic programs and code snippets. After CARLA execution, the Evaluation module's VLM critic assesses query alignment and either accepts the program or guides the Generation Module to repair its components or regenerate it. Final programs support closed-loop ADS testing.
1 · Query and retrieval

A text, image, or video query is interpreted, and a Scenic program is retrieved from the scenario database as a seed using joint multimodal embeddings.

2 · Execution in CARLA

The program is executed in CARLA and rendered as bird's-eye and first-person views, together with actor trajectories.

3 · VLM critic

The critic checks the rendered scenario against query-derived criteria on road layout, traffic infrastructure, static objects, dynamic actors, and environment.

4 · Decision

Its feedback guides iterative refinement with three options, repeated for up to five rounds.

AcceptRepairRegenerate
5 · Downstream tests

The final programs support SafeBench criticality tuning and closed-loop testing of RL policies and VLA driving stacks under non-reactive and reactive traffic.

Retrieved seeds versus refined scenarios: a construction zone is added, the ego direction is corrected to a right turn, and a crossing motorcycle is added; scenario quality rises from 66.7, 50.0 and 58.3 percent to 100 percent.
Examples of visual refinement. Retrieved seeds (top) and refined scenarios (bottom). SQ denotes Scenario Quality.
Benchmark

250 safety-critical queries, five modalities

The compared state-of-the-art methods lack a unified multimodal benchmark for scenario executability and query alignment. Each query comes with human-written criteria for judging whether a generated scenario matches it.

250queries, 50 per modality
TextImageText + imageVideoText + video
14public sources
Simulator rendersScenario catalogsRegulations & testing protocolsReal-world crash videos
5scored scenario layers
Road layoutInfrastructureTemporary modificationsDynamic objectsEnvironment
Benchmark composition by input modality and source, and scenario-type distribution.
The 250-query Loop2Scenic benchmark. Inputs and sources (top), coverage (bottom). VRU denotes vulnerable road user.
Simulation

From query to CARLA scenario

Up to three generated scenarios per input modality, each with 100% scenario quality: the benchmark query and the five-round Loop2Scenic scenario executed in CARLA, in first-person and bird's-eye views.

Bird's-eye legend: green = ego vehicle, yellow = adversarial actors, orange = props, dots = traffic lights. The clips are re-runs of each final five-round program in CARLA, cut once the scenario has played out; scores are the VLM judge's scenario quality for that program. Both views play at 1.5× speed.

Results

Executable, aligned, and more critical

All methods use the same underlying model. FA weights scenario quality by executable coverage: FA = CSR × SQ / 100.

Compilation success rate

100%vs. 65.2% for the strongest baseline

Every one of the 250 queries yields an executable scenario.

Framework accuracy

80.2%vs. 54.5% for the strongest baseline

Five-round Loop2Scenic on all 250 benchmark queries.

Framework accuracy by method

FA (%) on the 250-query benchmark; higher is better.

ChatScene22.4
ScenicNL23.1
NL2Scenic23.9
Chat2Scenic54.5
Loop2Scenic80.2

Scenic generation comparison and ablations

The paper's Table 2: success rates, cost, scenario alignment per layer, and framework accuracy on all 250 queries.

MethodGSR (%)CSR (%)RT (s)TokensScenario alignment (%)FA (%)
RDTITMDOENSQ
ChatSceneretrieval-assemble, components87.629.283924,87190.275.087.558.686.776.622.4
ScenicNLgeneration, full DSL100.029.685133,93683.161.191.766.391.478.123.1
NL2Scenicgeneration, full DSL97.226.489930,57596.575.083.383.793.190.623.9
Chat2Scenicgeneration, iterative components100.065.2127474,89391.180.071.971.296.483.654.5
Loop2Scenic
without retrieval and loop100.060.826097,91791.973.153.668.399.483.050.5
without loop, 0 rounds100.0100.053373,11986.079.140.044.796.370.570.5
1 round100.0100.0619121,79987.270.962.555.198.375.775.7
3 rounds100.0100.0862204,41788.073.365.062.298.379.079.0
5 rounds100.0100.01085279,51688.875.680.063.698.880.280.2

250 queries, Qwen3.8-Max. GSR/CSR: Generation/Compilation Success Rate. FA: Framework Accuracy. RT: Response Time. SQ: Scenario Quality. RD: Road Layout. TI: Traffic Infrastructure. TM: Temporary Modifications. DO: Dynamic Objects. EN: Environment. Rounds: refinement updates (default: five). Costs cover model calls per program. SQ is computed on each method's executed outputs.

Refinement rounds

Mean scenario quality (%) after 0, 1, 3, and 5 critic-guided rounds.

70747882 0135 rounds 70.575.779.080.2
Show as table
RoundsSQ (%)FA (%)Tokens
070.570.573,119
175.775.7121,799
379.079.0204,417
580.280.2279,516

Scenario criticality (SafeBench)

Observed mean overall score (OS), averaged over SAC, PPO and TD3, on each baseline's matched queries; lower OS means more safety-critical scenarios. With five refinement rounds, Loop2Scenic achieves the lowest observed OS across three RL policies on matched queries, with policy-averaged scores 2.7–14.1% lower than the four baselines.

BaselineLoop2Scenic (5 rounds)

Safety-criticality evaluation with SafeBench

The paper's Table 3. Left: each method on its own available scenarios (N). Right: baseline / five-round Loop2Scenic OS on the same queries, per RL policy.

MethodNSafetyFunctionalityEtiquetteOS ↓vs. Loop2Scenic (same queries, 5 rounds)*
CR ↑RR ↑SS ↑OR ↑RF ↓Comp ↓TS ↑ACC ↑YV ↑LI ↑SAC ↓PPO ↓TD3 ↓OS ↓
ChatScene730.2900.0620.0620.0200.8940.6190.0790.2970.1940.0530.8040.7670.6460.8320.6840.8120.7560.8040.695
ScenicNL730.3290.1670.0140.0220.8300.4960.0640.3230.1960.0820.7690.7110.6310.7990.7050.7960.7920.7690.709
NL2Scenic640.2470.1480.0490.0210.8570.6880.1210.2970.2810.0900.8140.7550.6240.8500.6810.8370.7930.8140.699
Chat2Scenic1620.3250.2990.0690.0120.8190.5590.0870.3070.2200.0800.7540.7100.6810.7690.7390.7840.7820.7540.734
Loop2Scenic (3 rounds)2500.3570.3170.0630.0150.8140.5660.0870.3220.2030.1090.7370.6790.7330.7990.737
Loop2Scenic (5 rounds)2500.3730.3310.0660.0170.8140.5360.0850.3260.1980.1040.7250.6670.7110.7980.725

N: available scenarios. CR: Collision Rate. RR: Red-Light-Running. SS: Stop-Sign-Running. OR: Out-of-Road Distance. RF: Route-Following Stability. Comp: Route Completion. TS: Time. ACC: Acceleration. YV: Yaw Velocity. LI: Lane Invasion. OS: Overall Score. Mean over SAC, PPO, and TD3 after tuning against SAC. Arrows indicate greater scenario criticality. *Baseline rows report baseline OS (top) and Loop2Scenic OS (bold) on the baseline's N queries. Loop2Scenic rows report OS on all 250 queries.

Results in depth

Where the gains come from

Further analyses from the appendix: per-modality results, coverage at fixed quality, ablations of seed retrieval and the critic, alternative backbones, retrieval, criticality across scene sets, execution failures, and the validation of the VLM judge.

Framework accuracy by input modality

FA (%) of each method on the 50 queries of each modality; Loop2Scenic at five rounds achieves the highest FA in every modality.

Executable coverage at fixed scenario quality

Percentage of all 250 queries whose output executes and reaches judge SQ ≥ the threshold. At five rounds, 60.4% of queries reach SQ ≥ 0.8, against 15.2–45.2% for the baselines.

Seed retrieval and the visual loop

FA (%) on all 250 queries as components are added. Labels give the paired gain with its 95% confidence interval.

With a fixed random subset of 50 seeds instead of 200, three rounds still return executable programs for all queries (78.4 vs. 79.0 FA, Δ = −0.6, 95% CI [−2.5, 1.3]).

Critic controls

On 125 queries, critic-guided refinement against controls that remove or replace the critic.

FA (%), higher is better
Flagged layers that regress (%), lower is better

Alternative model backbones

FA (%) on all 250 queries with the same framework and five rounds; every backbone reaches 100% CSR.

Qwen3.8-Flash FA is available-case, using 249 judged outputs.

Retrieval encoders by query modality

HIT@1 (%) for retrieving the matching scenario from the database. Native multimodal encoders index text and video jointly; text-only encoders see video through a caption bridge.

0100deployed setting

Criticality across scene sets

ΔOS = Loop2Scenic − baseline on the same queries, averaged over the shared policies, with its 95% paired query-bootstrap interval. Negative values indicate more safety-critical Loop2Scenic scenarios. Set 1 uses the Table 3 scenes. Sets 2–3 sample fresh scenes from the same tuned ranges.

BaselineSet 1Set 2Set 3Mean 2–3
ChatScene−.113[−.178, −.045]−.075[−.134, −.016]−.076[−.133, −.020]−.075[−.132, −.020]
ScenicNL−.059[−.120, .004]−.066[−.120, −.013]−.058[−.110, −.006]−.061[−.113, −.010]
NL2Scenic−.115[−.173, −.057]−.086[−.147, −.027]−.083[−.143, −.024]−.085[−.144, −.027]
Chat2Scenic−.020[−.061, .022]−.030[−.067, .006]−.028[−.066, .009]−.029[−.065, .007]
−0.12+0.1295% interval excludes zero

In all three scene sets and their mean, Loop2Scenic has lower observed OS than every baseline on matched queries: all 16 ΔOS point estimates are negative. Matched-query gaps are supported against ChatScene and NL2Scenic in all three sets and against ScenicNL in sets 2 and 3 and their mean.

Why baseline programs fail to execute

Of 250 queries per method: programs generated, programs that execute (route and videos), and the causes of the remaining failures. Executed / 250 is each method's CSR in Table 2.

OutcomeChatSceneScenicNLNL2ScenicChat2ScenicLoop2Scenic
Program generated219250243250250
Executed (route + videos)737466163250
Not executed146176177870
No valid scene955146220
Invalid Scenic usage / type error–3940330
Random value in control flow–1934100
Non-existent API21142380
Empty sampling domain20111570
Syntax / parse error3331530
Undefined variable61410
Ego never moved–6030
Simulator hang or crash12000

For each program, the first failing execution stage is recorded. Missing programs are model-API timeouts, and dashes mark categories not recorded for ChatScene.

Validation of the VLM judge

Agreement between the VLM judge and human scores (Krippendorff's α; α ≥ 0.8 indicates reliable agreement).

Scatter plot of VLM judge versus human scenario quality on 254 scored outputs; Krippendorff's alpha 0.815, Spearman rho 0.789, MAE 0.047.
VLM judge versus human SQ on 254 scored outputs.
Mean SQ, human vs. judge
Closed-loop testing

Stress-testing VLA stacks and RL policies

After SafeBench adversarial tuning, the 250 generated scenarios are used for closed-loop testing under non-reactive and reactive traffic. Increasing refinement from three to five rounds lowers the driving score (DS) by 1.9–5.1 points and the success rate (SR) by 0.2–6.0 percentage points across all driving stacks.

SimLingo, ORION and OpenDriveVLA driving in a scenario generated from an image-only query, under non-reactive (top) and reactive traffic (bottom).
VLA evaluation in a scenario generated from an image-only query: non-reactive (top) and reactive traffic (bottom).

Driving performance at three and five rounds

Lower values on five-round scenarios indicate a stronger stress test.

Non-reactive traffic
PolicyDS ↑SR (%) ↑Eff. ↑Comf. ↑
VLA driving stacks
SimLingo43.6 / 39.626.6 / 23.6236.8 / 231.937.8 / 41.6
ORION50.1 / 48.220.6 / 19.6134.0 / 132.210.1 / 9.9
OpenDriveVLA32.0 / 28.89.4 / 7.6230.1 / 227.33.9 / 4.7
State-input RL policies
SAC39.3 / 37.416.8 / 14.4236.5 / 237.641.8 / 42.8
PPO52.4 / 47.323.8 / 17.8193.1 / 193.527.4 / 27.4
TD346.2 / 43.315.8 / 13.8163.0 / 149.938.2 / 39.0
Reactive traffic
PolicyDS ↑SR (%) ↑Eff. ↑Comf. ↑
VLA driving stacks
SimLingo43.6 / 39.927.8 / 24.6252.7 / 250.939.2 / 42.6
ORION51.3 / 49.221.0 / 20.8138.9 / 138.011.1 / 10.7
OpenDriveVLA30.8 / 28.29.0 / 7.2241.7 / 239.94.5 / 5.1
State-input RL policies
SAC42.3 / 40.419.2 / 17.0254.9 / 253.442.0 / 42.7
PPO53.6 / 49.125.0 / 20.0205.9 / 203.427.6 / 27.5
TD349.3 / 45.619.6 / 16.6174.8 / 161.336.9 / 37.0

3 rounds / 5 rounds. DS: Driving Score. SR: Success Rate. Eff.: Efficiency. Comf.: Comfort. Higher is better for the policy. The RL policies take state input.

Closed-loop episodes

The three VLA driving stacks in the same generated scenario, under non-reactive and reactive traffic (front-camera views, 2× speed). The three scenarios come from text queries among the 250 five-round scenarios of the driving evaluation; the figure above shows a different scenario, from an image-only query. Collision times count from the start of each episode.

Scenario

Matched driving-score differences against the baselines

Loop2Scenic minus baseline driving score (DS) on the same queries, for each policy. Negative values mean more safety-critical Loop2Scenic scenarios. Loop2Scenic has lower observed DS in 19/24 non-reactive and 20/24 reactive comparisons; eight 95% intervals per traffic mode lie entirely below zero, and none lies entirely above zero.

−30+3095% interval excludes zero
Citation

BibTeX

The arXiv identifier will be added here once the preprint is released.

@misc{gao2026loop2scenic,
  title  = {{Loop2Scenic}: A Self-Refining Agentic Framework with Closed-Loop
            Visual Feedback for Multimodal Safety-Critical Driving Scenario Generation},
  author = {Gao, Yuan and Li, Chen and Lim, Yung Loon and Sch{\"a}fer, Finn Rasmus and
            Jahncke, Felix and Piccinini, Mattia and Song, Qunying and
            Schmidt, Sebastian and Betz, Johannes},
  year   = {2026}
}