Home

Awesome

LeGEND

This is the repository for our paper "LeGEND: A Top-Down Approach to Scenario Generation of Autonomous Driving Systems Assisted by Large Language Models".

Approach Overview

approach overview

The workflow of our approach is depicted in the above figure, which consists of three phases. The first two phases are in charge of the transformation from natural language that documents functional scenarios to logical scenarios in formal DSL:

In Phase 3, LeGEND employs a search-based technique to search for critical concrete scenarios, which is similar to existing search-based ADS testing techniques.

Dependencies

Usage

To reproduce the experimental results, users should follow the steps below:

Preparation

Run the Transformation

The core technique of LeGEND involves transforming accident reports into logical scenarios in DSL format, utilizing two large language models. In our paper, we selected 20 accident reports from the NHTSA database as initial seeds, covering a variety of road types and vehicle counts. <br /> To evaluate this transformation process, you can execute the script found in the /scripts directory: <br />

Run the Complete Framework

Results Verification If LeGEND runs successfully, the ADS simulation environment should function correctly. The terminal will display the evolution process of the generated critical scenarios, and all system logs will be recorded in the data/logs folder. After each run for a given accident report, the results including the number of identified critical scenarios and the critical scenarios in DSL format will be saved in the data/results folder as JSON files. There are two methods to verify the experimental results: <br>

Project Structure

.
├── configs                           
│   ├── config.yaml                   # Necessary settings and hyperparameters for the approach
│   ├── curve_road                    # Road data and default settings for parameters
│   └── straight_road                 # Road data and default settings for parameters
├── data
│   └── accident_reports              # Selected accident reports from NHTSA
├── legend
│   ├── core                          # The source code of our approach
│   │   ├── algorithm.py              
│   │   ├── chromosome.py
│   │   ├── converter.py
│   │   ├── extractor.py              
│   │   ├── scenario_model.py
│   │   ├── simulation.py
│   │   ├── statement.py
│   │   └── testcase.py
│   └── utils                         # Tools for API calls and simulations
│       ├── fnds.py
│       ├── llm_util.py
│       ├── replay.py
│       └── sim_util.py
├── lgsvl                             # Code for simulator
├── main.py                           # Entrance for this project
├── README.md
└── requirements.txt