Language-Guided Traffic Simulation via Scene-Level Diffusion

Ziyuan Zhong, Davis Rempe, Yuxiao Chen, Boris Ivanovic, Yulong Cao, Danfei Xu, Marco Pavone, Baishakhi Ray

Abstract

Realistic and controllable traffic simulation is a core capability that is necessary to accelerate autonomous vehicle (AV) development. However, current approaches for controlling learning-based traffic models require significant domain expertise and are difficult for practitioners to use. To remedy this, we present CTG++, a scene-level conditional diffusion model that can be guided by language instructions. Developing this requires tackling two challenges: the need for a realistic and controllable traffic model backbone, and an effective method to interface with a traffic model using language. To address these challenges, we first propose a scene-level diffusion model equipped with a spatio-temporal transformer backbone, which generates realistic and controllable traffic. We then harness a large language model (LLM) to convert a user's query into a loss function, guiding the diffusion model towards query-compliant generation. Through comprehensive evaluation, we demonstrate the effectiveness of our proposed method in generating realistic, query-compliant traffic simulations.

Introduction

Developing Autonomous Vehicles (AVs) requires massive amounts of testing in simulation. However, developers face a "trilemma" in traffic modeling: balancing realism, controllability, and usability. Rule-based models (like IDM) often feel "robotic" and fail to capture human nuances. Conversely, data-driven models can mimic real driving but are difficult to steer toward specific edge cases. Furthermore, existing controllable models often require expert knowledge to write complex mathematical constraints like Signal Temporal Logic.

Previous state-of-the-art models like CTG modeled agents independently, which often led to unrealistic "ghosting" or collisions because the agents were not aware of each other during the generation process. CTG++ addresses these challenges by treating the entire traffic scene as a single entity and providing a natural language interface for control.

The CTG++ Framework

Overview of the CTG++ framework

CTG++ consists of two primary components: a scene-level diffusion model and an LLM-guided control mechanism. The system takes a natural language query and a scene context as input and generates realistic trajectories that satisfy the user's requirements.

Scene-Level Diffusion Model

Unlike previous models that generate trajectories for one car at a time, CTG++ treats the entire traffic scene as a single entity. It utilizes a Spatio-Temporal Transformer backbone to capture complex multi-agent interactions.

Spatio-Temporal Transformer architecture

As shown in the architecture diagram, the model alternates between three types of attention mechanisms:

  1. Temporal Attention: Models how a single agent moves over time.
  2. Spatial Attention: Captures how agents interact with their neighbors per timestep.
  3. Map Attention: Relates agent movements to lanes and boundaries.

To ensure generalization across different environments, the model employs agent-centric coordinates relative to each vehicle rather than a fixed global map.

LLM-Guided Control

To make the model user-friendly, CTG++ leverages GPT-4 to bridge the gap between human language and mathematical constraints. Instead of direct text-to-trajectory mapping, GPT-4 converts a text query (e.g., "Vehicle 1 should follow Vehicle 2 at a safe distance") into a differentiable Python loss function.

During the diffusion denoising process, the model calculates the gradient of this loss to "nudge" the generated trajectories toward the user's goal. This allows for precise control at inference time without requiring model retraining.

Evaluation and Results

The model was trained and evaluated on the nuScenes dataset, focusing on moving vehicles in complex urban environments. CTG++ was compared against strong baselines like BITS and the original CTG:

  • Superior Realism: CTG++ achieved the lowest scene-level realism scores, indicating that its multi-car interactions most closely resemble real human driving data.
  • High Compliance: In tests involving collision and distance-keeping queries, CTG++ achieved a 0.000 violation rate, successfully satisfying user prompts in every instance.
  • Reduced Failures: The scene-level approach significantly reduced unintended collisions and off-road driving compared to independent agent models, especially in dense traffic.

Discussion and Future Work

A key insight of this work is that modeling agents jointly is essential for realism; a scene-level transformer allows agents to "negotiate" space effectively. Furthermore, using LLMs as intermediate translators into code leverages their existing proficiency in programming to handle the physics of driving (distance, velocity, collision) clearly.

However, limitations remain. The current interface struggles with complex global map topology (e.g., "turn right at the third intersection"). Additionally, the iterative nature of diffusion models makes generation relatively slow, taking about one minute per scenario. Future work may explore model distillation for speed and iterative "detect and repair" loops to handle potential LLM hallucinations in loss function generation.

Summary updated

BibTeX
@inproceedings{zhong2023language,
  author = {Ziyuan Zhong and Davis Rempe and Yuxiao Chen and Boris Ivanovic and Yulong Cao and Danfei Xu and Marco Pavone and Baishakhi Ray},
  title = {{Language-Guided Traffic Simulation via Scene-Level Diffusion}},
  booktitle = {Conference on Robot Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=nKWQnYkkwX},
}
Figure