Abstract
High-fidelity traffic simulation is essential for the safe development of autonomous vehicles (AVs), yet current generative models struggle with the "long-tail" of rare, critical events and lack fine-grained controllability. RealGen addresses these challenges by introducing a Retrieval-Augmented Generation (RAG) framework for traffic scenarios. By treating real-world trajectories as a retrieval database rather than a distribution to be memorized, RealGen enables "in-context learning" for motion, allowing for the generation of complex, realistic, and controllable multi-agent interactions.
Introduction
Testing AVs in the real world is inherently risky and costly. While data-driven simulators offer a safer alternative, they face two primary hurdles: the long-tail problem and a lack of controllability. Standard models tend to memorize the average behavior in a dataset, often ignoring rare but critical events like near-misses. Furthermore, directing these models to generate specific maneuvers (e.g., a U-turn during an overtake) remains difficult.
RealGen shifts the paradigm from simple data memorization to a retrieval-based approach. Similar to how Large Language Models (LLMs) use RAG to access external facts, RealGen looks up relevant real-world behaviors to ground its generations in physical reality.
Methods
RealGen utilizes a two-stage pipeline consisting of a Retriever and a Generator.
1. Scenario Autoencoder and Retriever
To enable efficient searching, the system must represent driving behaviors numerically. The authors developed a hierarchical spatial-temporal transformer to encode agent trajectories into latent embeddings. A key innovation here is the use of a contrastive loss based on Wasserstein distance ($W_2$). This metric is permutation-invariant, ensuring the model recognizes scenario similarity regardless of agent ordering or scene orientation.
2. The Combiner and Generator
Once the retriever identifies $K$ relevant "template" scenarios from a database, the Combiner module fuses these behaviors with the target map and initial agent poses. This process uses Multi-Head Attention (MHA) and is gradient-free at inference time, effectively performing "in-context learning" by adapting retrieved behaviors to new environmental constraints.
Experimental Results
The framework was evaluated using the nuScenes dataset, with a subset of 1,349 scenarios manually annotated with behavioral tags (e.g., Yielding, Overtaking). RealGen demonstrated significant improvements over state-of-the-art models like LCTGen:
- Fidelity: RealGen achieved a mean Average Displacement Error (mADE) of 1.54, vastly outperforming LCTGen's 4.76.
- Human Preference: In A/B testing, human evaluators preferred RealGen-generated scenarios 81% to 100% of the time across various maneuver categories.
- Downstream Utility: Training a trajectory prediction model on RealGen-augmented data reduced its error (mADE) from 3.54 to 2.31, confirming the realism of the generated scenarios.
Discussion and Future Work
RealGen demonstrates that treating physical trajectories as a retrieval database allows models to "find" rather than "imagine" complex behaviors. This approach even enables zero-shot safety-critical generation by applying crash templates to safe real-world maps.
A current limitation is that the behavior encoder primarily focuses on trajectories, sometimes overlooking intricate interactions with specific lane geometry. Future research will focus on deeper integration of road constraints—such as curbs and signage—into the initial encoding phase to enable even more nuanced scenario generation.
Summary updated