This website is best viewed in portrait mode.

Author: Dr. Jihas Khan, Ananthu M, Lakshmi G Pillai

Behavioral Modelling in Automotive using Generative AI

Behavioral Modelling in Automotive using Generative AI


Generative Artificial Intelligence (GenAI) is a rapidly evolving field of Artificial Intelligence (AI) focused on creating models that can generate new content based on patterns, structures, and features learned from a large number of datasets. The relevance of GenAI is substantial, as it offers numerous benefits and applications across various domains like research and development, content creation, conversational AI and many more.

The automotive industry is embarking on a new journey with GenAI, utilizing it as a powerful tool to overcome complex challenges and enhance customer satisfaction. GenAI can help design safer and more efficient vehicles, improve traffic safety, and reduce environmental impact. As AI continues to evolve, it will further revolutionize the automotive industry by enabling autonomous driving and creating new opportunities for customized driving experiences.

This blog explains the work done by TATA ELXSI in using GenAI for one of the automotive applications, which is: ‘human behavior modeling’. We modeled the behavior of humans, and how humans interact with vehicle electronic systems using GenAI. This enables one to capture more realistic test scenarios, which are independent of the hardware or software in vehicles. Pretraining is not required for such Large Language Models (LLMs) [1], as human behavioral aspects are already captured in essence, in LLMs.


The architecture of the proposed GenAI framework for human behavioral modeling and test case generation is shown in Figure 1.

Figure 1. Proposed GenAI framework for behavior modeling

The initial step is to provide fine-tuned prompts as input to the LLMs. The prompts are aimed at asking interactive questions with the LLM to generate behavioral test cases for automotive testing. LangChain [2] is used to interact with the LLM. The generated test cases from the LLM model are then stored in a database. A Streamlit [3] based User Interface (UI) has been created which can interact with the previously created database as it enables the user to visualize the scenarios in an intuitive and interactive fashion. Subsequent section describes the detailed explanation of the modules described in Figure 1 in detail.

1. Prompt Engineering

Prompt engineering [4] is the process of crafting the input queries that are passed to the LLMs to get the desired output. Generation of desired outputs can be achieved by fine-tuning the prompts. Fine-tuning allows users to control and shape the LLM model response, making it more efficient to do tasks. Better test results were achieved by modifying the structure, wording, and context of the prompt, which would enhance the model’s understanding.

Figure 2. Prompt engineering.

Figure 2 shows a sample prompt that is passed to the LangChain framework. Prompt becomes more meaningful when it has ‘context’ and ‘task’ in it. ‘Task’ specifies the desired action to be performed and context provides relevant information or background knowledge to assist the model in completing the task. Here the task is “to generate test steps for the given scenario” while the context is “the behavior of the car’s voice command system when the driver asks about the current traffic conditions”.

2. LangChain

LangChain is an open-source framework that allows AI developers to interact with LLMs. LLMs are deep learning models that are trained on large amounts of data that can generate responses based on the prompts passed by the user. In the proposed work, LangChain is used utilizing GPT-3.5-Turbo [5] which is one of the most capable LLMs available. GPT-3.5-Turbo is developed by OpenAI, and it’s 3.5 times faster than the base model GPT. It helps developers build applications that require large understanding and that can solve more complex tasks. Using GPT-3.5-Turbo as the foundation model, LangChain enables engineers to design unique and complex AI applications.

Figure 3 shows how LangChain gives the response when the user passes the query to the LangChain framework.

Figure 3. LangChain Framework Overview Diagram

One can observe from the sample output shown in Figure 3 that, even without formal training, the existing LLMs are intelligent enough to generate valid and realistic test scenarios for automotive applications. All such possible scenarios one could encounter in an automobile are thus generated using GenAI by suitable prompt engineering.

3. Storage

All the test scenarios generated based on the prompts given are stored in a database with a structured format. In the proposed work, MySQL [6] is used as the database for storing the generated test scenario.

Figure 4 shows the MySQL database created for storing the scenarios generated from the GenAI model. One can see that there are five columns namely: prompt, scenario, test case, category, and subcategory. The prompt which was given as an input to the LLM to generate the scenario is saved in the ‘prompt’ column and the corresponding test scenario which was generated by the GenAI model is stored in the ‘testcase’ column. Manually we add ‘category’, ‘subcategory’, and the ‘scenario’ in the MySQL database for each test scenario, so that subsequent filtering and visualization are meaningful.

Figure 4. Database created for storing the test scenarios

Here is an example that illustrates Figure 4 in detail. An example of a prompt below:

“Write the test steps to verify the behavior of the car’s wiper when the driver activates a single wipe to clear sudden debris or splashes on the windshield”.

hen this prompt is given, the generated test steps are as follows.

  • “Start with a clean and dry windshield to ensure accurate observation of the wiper behavior.
  • Position yourself in the driver's seat and ensure clear visibility of the windshield.
  • Turn on the car's ignition and activate the wiper system.
  • Locate the control or switch for the wiper system, usually located on the steering column or dashboard.
  • Identify the specific control or setting for activating a single wipe. This may be a separate button or a specific position on the wiper control switch.
  • Press or activate the control for a single wipe to simulate clearing sudden debris or splashes on the windshield.
  • Observe the behavior of the wiper system.
  • Check if the wiper moves across the windshield in a single swift motion.
  • Note the speed and intensity of the wiper movement.
  • Ensure that the wiper clears the debris or splashes effectively without leaving streaks or residue on the windshield.
  • Repeat the single wipe activation multiple times to ensure consistent behavior.
  • Test the wiper system under different conditions, such as varying speeds or intensities of debris or splashes, to assess its responsiveness and effectiveness.
  • Document any observations or issues encountered during the test.”

For this specific example test scenario, the main category is “Wiper”, the sub-category is “Wiper functionality” and the scenario is “Single Wipe Activation”.

4. User Interface

Streamlit is used for developing the UI in the proposed work. Figure 5 demonstrates the sample view of the developed UI, where users can choose a category and subcategory from the left side and a scenario from the main drop-down menu in the middle of the screen. The database is accessed in accordance with the user's selection, and the created test steps are displayed here.

Figure 5. Streamlit user interface

Future Outlook

As we look to the future, GenAI's role in automotive behavior modeling promises transformative outcomes. From predictive maintenance to personalized in-car experiences, the potential applications are vast. Future test cases in autonomous driving and real-time decision-making along with hyper personalization showcase how we are going to witness a significant transformation in the automotive domain. The integration of GenAI not only optimizes performance but also redefines human-vehicle interaction, marking a pivotal shift towards smarter, safer, and more intuitive automotive solutions.