Abstract
Text-to-scene generation typically limits environmental diversity by generating key scenarios along predetermined paths. To address these constraints, we propose a novel text-to-traffic scene framework that leverages a large language model (LLM) to autonomously generate diverse traffic scenarios for the CARLA simulator based on natural language descriptions. Our pipeline comprises several key stages: (1) Prompt Analysis, where natural language inputs are decomposed; (2) Road Retrieval, selecting optimal roads from a database; (3) Agent Planning, detailing agent types and behaviors; (4) Road Ranking, scoring roads to match scenario requirements; and (5) Scene Generation, rendering the planned scenarios in the simulator. This framework supports both routine and critical traffic scenarios, enhancing its applicability. We demonstrate that our approach not only diversifies agent planning and road selection but also significantly reduces the average collision rate from 8% to 3.5% in SafeBench. Additionally, our framework improves narration and reasoning for driving captioning tasks. Our contributions and resources are publicly available at https://basiclab.github.io/TTSG.
Introduction
Testing autonomous vehicles (AVs) in real-world environments is fraught with safety risks and high costs, particularly when attempting to simulate high-risk "edge cases"—such as aggressive lane changes or pedestrians suddenly entering the roadway. While simulators like CARLA provide a safe alternative, traditional scenario generation methods often fall short. Random sampling frequently produces irrelevant or nonsensical scenes, while log replay is constrained by existing real-world data, limiting the ability to test hypothetical "what-if" scenarios.
To overcome these limitations, we introduce TTSG (Text-to-Traffic Scene Generation), a training-free framework that utilizes the reasoning capabilities of Large Language Models (LLMs) to transform free-form natural language descriptions into complex, realistic driving simulations. TTSG allows developers to specify scenarios using intuitive language and automatically handles the underlying simulation logic.
Methodology
The TTSG framework employs a modular, five-stage pipeline designed to leverage LLMs (e.g., GPT-4o, Claude 3.5) without requiring task-specific fine-tuning.
- Prompt Analysis: The LLM parses unstructured natural language into a structured schema, identifying key elements such as required signals, agent types, and environmental conditions.
- Road Candidate Retrieval: The system queries a pre-built road graph—derived from CARLA OpenDRIVE data—to find segments matching the identified features (e.g., presence of a traffic light).
- Agent Planning: The LLM acts as a scenario director, assigning specific roles, initial positions, and behavioral trajectories to all agents in the scene.
- Road Ranking: This critical stage scores candidate roads based on their ability to accommodate the specific agent plan. This "plan-aware" ranking ensures semantic coherence between the environment and agent actions.
- Scene Generation: The finalized plan is rendered within the CARLA simulator. The system supports sequential composition, allowing for multi-stage events that maintain temporal consistency.
Key Insights
A primary contribution of this work is the Plan-Aware Ranking algorithm. Our experiments demonstrate that simply matching road "tags" is insufficient; ranking roads based on the feasibility of planned maneuvers is essential for generating coherent scenes. Furthermore, we find that high-end LLMs exhibit remarkable zero-shot spatial reasoning for traffic when provided with a structured world model like our road graph.
TTSG also excels in Sequential Composition. Unlike prior methods that generate static snapshots, TTSG can chain events over time—for example, a car completing a turn and subsequently encountering an obstruction—ensuring a continuous and logical narrative.
Experimental Results
We evaluated TTSG using the CARLA simulator and SafeBench, a benchmark for AV safety in critical scenarios.
Safety Training Performance
Agents trained on critical scenarios generated by TTSG achieved a significant reduction in collision rates. On SafeBench, the average collision rate dropped to 3.5%, outperforming the previous state-of-the-art method, ChatScene, which recorded an 8.0% collision rate.
Planning and Efficiency
Ablation studies highlight the importance of the "analysis-based" strategy. Using top-tier models like GPT-4o, the framework achieves near-perfect accuracy in road and agent planning. Moreover, this modular approach is highly efficient, achieving performance comparable to "Chain-of-Thought" prompting while utilizing significantly fewer tokens.
Driving Captioning
Training driving captioning models on TTSG-generated synthetic data led to a substantial improvement in performance, with a jump of over 30 CIDEr points. This suggests that high-quality synthetic edge cases are vital for improving the reasoning capabilities of AV systems.
Conclusion and Future Work
TTSG provides a robust, scalable solution for generating diverse and safety-critical traffic scenes from natural language. While currently limited by the static assets within CARLA and the lack of iterative editing capabilities, future work will focus on adding a "reflective reasoning" module for partial edits and expanding the system to control more complex traffic objects and interactions.
Summary updated