Skip to content

About

This repository contains the code and analysis for the research paper "Cross or Nah? LLMs Get in the Mindset of a Pedestrian in front of Automated Car with an eHMI" presented at the 17th International Conference on Automotive User Interfaces and Interactive Vehicular Applications (AutomotiveUI’25).

Topics

Resources

Stars

3 stars

Watchers

3 watching

Forks

Repository files navigation

Analysing reports of events involving automated vehicles with LLM model

Overview

LLM Personas A Ghibli-style persona illustration of the Large Language Models.😁

This study evaluates the effectiveness of large language model-based personas for assessing external Human-Machine Interfaces (eHMIs) in automated vehicles. 13 different models namely BakLLaVA, ChatGPT-4o, DeepSeek-VL2-Tiny, Gemma3:12B, Gemma3:27B, Granite Vision 3.2, LLaMA 3.2 Vision, LLaVA-13B, LLaVA-34B, LLaVA-LLaMA-3, LLaVA-Phi3, MiniCPM-V and Moondream were tasked with simulating pedestrian decision making for 227 vehicle images equipped with eHMI. Confidence scores (0-100) were collected under two conditions: no memory (images independently assessed) and memory-enabled (conversation history preserved), each in 15 independent trials. The model outputs were compared with the ratings of 1,438 human participants. Gemma3:27B achieved the highest correlation with humans without memory (r = 0.85), while ChatGPT-4o performed best with memory (r = 0.81). DeepSeek-VL2-Tiny and BakLLaVA showed little sensitivity to context, and LLaVA-LLaMA-3, LLaVA-Phi3, LLaVA-13B and Moondream consistently produced limited-range output.

Citation

If you use the gans-traffic for academic work please cite the following paper:

Alam, M. S., & Bazilinskyy, P. (2025). Cross or Nah? LLMs Get in the Mindset of a Pedestrian in front of Automated Car with an eHMI. 17th International Conference on Automotive User Interfaces and Interactive Vehicular Applications. Brisbane, QLD, Australia. https://doi.org/10.1145/3744335.3758477

Usage of the code

Getting started

Python Version Package Manager: uv

Tested with Python 3.9.21 and the uv package manager.
Follow these steps to set up the project.

Step 1: Install uv. uv is a fast Python package and environment manager. Install it using one of the following methods:

macOS / Linux (bash/zsh):

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows (PowerShell):

irm https://astral.sh/uv/install.ps1 | iex

Alternative (if you already have Python and pip):

pip install uv

Step 2: Fix permissions (if needed):

Sometimes uv needs to create a folder under ~/.local/share/uv/python (macOS/Linux) or %LOCALAPPDATA%\uv\python (Windows).
If this folder was created by another tool (e.g. sudo), you may see an error like:

error: failed to create directory ... Permission denied (os error 13)

To fix it, ensure you own the directory:

macOS / Linux

mkdir -p ~/.local/share/uv
chown -R "$(id -un)":"$(id -gn)" ~/.local/share/uv
chmod -R u+rwX ~/.local/share/uv

Windows

# Create directory if it doesn't exist
New-Item -ItemType Directory -Force "$env:LOCALAPPDATA\uv"

# Ensure you (the current user) own it
# (usually not needed, but if permissions are broken)
icacls "$env:LOCALAPPDATA\uv" /grant "$($env:UserName):(OI)(CI)F"

Step 3: After installing, verify:

uv --version

Step 4: Clone the repository:

git clone https://github.com/Shaadalam9/llms-av-crowdsourced
cd llms-av-crowdsourced

Step 5: Ensure correct Python version. If you don’t already have Python 3.9.19 installed, let uv fetch it:

uv python install 3.9.21

The repo should contain a .python-version file so uv will automatically use this version.

Step 6: Create and sync the virtual environment. This will create .venv in the project folder and install dependencies exactly as locked in uv.lock:

uv sync --frozen

Step 7: Activate the virtual environment:

macOS / Linux (bash/zsh):

source .venv/bin/activate

Windows (PowerShell):

.\.venv\Scripts\Activate.ps1

Windows (cmd.exe):

.\.venv\Scripts\activate.bat

Step 8:

Download Ollama locally in your system and run it. https://ollama.com/

Step 9: Run the code:

python3 analysis.py

Configuration of project

Configuration of the project needs to be defined in llms-av-crowdsourced/config. Please use the default.config file for the required structure. If no custom config file is provided, default.config is used. The config file has the following parameters:

  • data [String]: Specifies the directory where your image files are stored.
  • output [String]: Directory path where model outputs will be saved.
  • crowdsourced_data [String]: Specifies the directory path where crowdsourcing results are present.
  • figures [String]: Directory path to save final figures.
  • font_family [String]: Lists the font families to be used in visualisation outputs (e.g., "Open Sans, verdana, arial, sans-serif").
  • font_size [Integer]: Sets the base font size for graphs and other visual elements (e.g., 12).
  • random_seed [List of Integers]: A list of seed values for reproducible runs (e.g., [42]).
  • process_csv_files [Boolean]: Determines whether raw model output CSVs should be processed and aggregated before analysis. When true, the system runs CSV parsing and cleaning steps prior to generating figures or statistics.
  • use_history [Boolean]: Determines whether conversation history is maintained and utilised during processing. When true, previous interactions are stored and influence current model responses.
  • delete_history_files [Boolean]: Determines whether previously saved conversation history files should be automatically removed after processing.
  • max_memory_messages [Integer]: Specifies the maximum number of previous conversation messages to retain in memory for context (e.g., 6).
  • temperature [Float]: Adjusts the randomness of the model's response generation. Lower values produce more deterministic outputs, while higher values introduce variability (e.g., 0.8).
  • plotly_template [String]: Determines the styling template used for graphs and visualisations (e.g., "plotly_white").
  • logger_level [String]: Sets the logging level (e.g., "info" or "debug") to control the verbosity of runtime messages.
  • model_names [List of Strings]: A list of model identifiers that the system will sequentially use to process images (e.g., ["gemma"]).
  • base_prompt [String]: Provides the initial context for the model, setting the stage for how it should interpret its task (e.g., describing the user's perspective as a pedestrian).
  • history_intro [String]: Contains introductory text that precedes the conversation history, informing the model how previous responses may influence its current decision-making.
  • current_image_instruction [String]: Offers specific instructions for interpreting the current image, guiding the model on how to generate its response.
  • prompt [String]: The main directive provided to the model for evaluating the image. This prompt instructs the model to first interpret the meaning of any digital display, then provide a confidence rating in this format: "Confidence: [numeric value]. Meaning: [briefly explain]".

Results

Model-by-model comparison (Without vs with past history)


BakLLaVA

Without past history With past history
BakLLaVA without memory
Without memory context
BakLLaVA with memory
With memory context

Gemma3 12B

Without past history With past history
Gemma3 12B without memory Gemma3 12B with memory

Gemma3 27B

Without past history With past history
Gemma3 27B without memory Gemma3 27B with memory

Granite3.2 Vision

Without past history With past history
Granite3.2 Vision without memory Granite3.2 Vision with memory

LLaMA3.2 Vision

Without past history With past history
LLaMA3.2 Vision without memory LLaMA3.2 Vision with memory

LLaVA-LLaMA3

Without past history With past history
LLaVA-LLaMA3 without memory LLaVA-LLaMA3 with memory

LLaVA-Phi3

Without past history With past history
LLaVA-Phi3 without memory LLaVA-Phi3 with memory

LLaVA 13B

Without past history With past history
LLaVA 13B without memory LLaVA 13B with memory

LLaVA 34B

Without past history With past history
LLaVA 34B without memory LLaVA 34B with memory

MiniCPM-V

Without past history With past history
MiniCPM-V without memory MiniCPM-V with memory

MoonDream

Without past history With past history
MoonDream without memory MoonDream with memory

DeepSeek VL2

Without past history With past history
DeepSeek VL2 without memory DeepSeek VL2 with memory

All models (merged)

Without past history With past history
All models without memory All models with memory

Correlation matrix

Without past history
Correlation matrix without memory

With past history
Correlation matrix with memory

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This repository contains the code and analysis for the research paper "Cross or Nah? LLMs Get in the Mindset of a Pedestrian in front of Automated Car with an eHMI" presented at the 17th International Conference on Automotive User Interfaces and Interactive Vehicular Applications (AutomotiveUI’25).

Topics

Resources

Stars

3 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages