Skip to content

AadilSandeep/CarAssistantLLM

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš— Car Diagnostic Assistant LLM

Python PyTorch Transformers PEFT Gradio License

An AI-powered automotive diagnostic assistant built using Microsoft Phi-2, LoRA (Low-Rank Adaptation) fine-tuning, and Gradio. The system assists users by analyzing vehicle symptoms and OBD-II fault codes to generate structured diagnostic recommendations.


๐Ÿ“– Overview

Car owners often struggle to interpret vehicle symptoms and OBD-II trouble codes without consulting a mechanic. This project aims to bridge that gap by providing an intelligent diagnostic assistant capable of:

  • Understanding vehicle symptoms described in natural language.
  • Interpreting OBD-II fault codes.
  • Suggesting likely causes.
  • Assessing risk levels.
  • Recommending safe checks and next actions.

The assistant combines a fine-tuned Large Language Model with curated automotive diagnostic knowledge to provide practical and easy-to-understand diagnostic guidance.


โœจ Features

๐Ÿ” Symptom-Based Diagnosis

Analyze user-reported vehicle issues such as:

  • Rough idling
  • Engine vibration
  • Hard starting
  • Overheating
  • Brake issues
  • Electrical problems
  • Transmission concerns

๐Ÿ›  OBD-II Code Interpretation

Supports automotive fault code analysis including:

  • P0300 โ€“ Random Misfire
  • P0301 โ€“ Cylinder 1 Misfire
  • P0302 โ€“ Cylinder 2 Misfire
  • P0303 โ€“ Cylinder 3 Misfire
  • P0304 โ€“ Cylinder 4 Misfire

and other diagnostic codes available through the integrated OBD database.

๐Ÿ“Š Structured Diagnostic Reports

Generates outputs in a mechanic-friendly format:

  • Symptom Summary
  • OBD-II Interpretation
  • Likely Causes
  • Risk Level
  • Safe Checks
  • Do Not Do
  • Next Action

๐Ÿค– Fine-Tuned LLM

Built using:

  • Microsoft Phi-2
  • PEFT LoRA fine-tuning
  • Hugging Face Transformers
  • PyTorch

๐Ÿ’ป User-Friendly Interface

Interactive web application powered by Gradio.


๐Ÿ— System Architecture

User Symptoms
       +
   OBD Codes
       โ”‚
       โ–ผ
 OBD Interpreter
       โ”‚
       โ–ผ
 Prompt Builder
       โ”‚
       โ–ผ
 Microsoft Phi-2
       +
  LoRA Adapter
       โ”‚
       โ–ผ
 Output Validation
       โ”‚
       โ–ผ
 Diagnostic Report

๐Ÿง  Model Information

Component Details
Base Model Microsoft Phi-2
Fine-Tuning Method LoRA (PEFT)
Framework Hugging Face Transformers
Training Dataset Custom Automotive Diagnostic Dataset
Inference Engine PyTorch
Interface Gradio
Platform macOS Apple Silicon / Local Deployment

๐Ÿ“‚ Project Structure

CAR_ASSISTANT/

โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ icons/
โ”‚   โ””โ”€โ”€ screenshots/
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ train.jsonl
โ”‚   โ””โ”€โ”€ obd-trouble-codes.csv
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ car-assistant-qlora/
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ””โ”€โ”€ finetuning.ipynb
โ”‚
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ test_load.py
โ”‚   โ””โ”€โ”€ colab_parity_test.py
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ config.py
โ”‚   โ”œโ”€โ”€ model_loader.py
โ”‚   โ”œโ”€โ”€ obd_utils.py
โ”‚   โ”œโ”€โ”€ diagnosis.py
โ”‚   โ””โ”€โ”€ ui.py
โ”‚
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ LICENSE

โš™๏ธ Installation

Clone Repository

git clone https://github.com/YOUR_USERNAME/Car_Assistant_LLM.git

cd Car_Assistant_LLM

Create Virtual Environment

python -m venv venv

source venv/bin/activate

Windows:

venv\Scripts\activate

Install Dependencies

pip install -r requirements.txt

๐Ÿš€ Running the Application

Launch the Gradio application:

python app.py

The application will be available locally at:

http://127.0.0.1:7860

๐Ÿงช Model Verification

To verify that:

  • Phi-2 loads correctly
  • LoRA adapter loads correctly
  • Tokenizer is configured correctly
  • Inference works successfully

run:

python scripts/test_load.py

๐Ÿ“ธ Screenshots

Home Interface

Home Screen

warnings Example

Warnings


๐Ÿ“ˆ Example Output

Symptom Summary:
- Strong fuel smell and engine vibration

OBD-II Interpretation:
- P0302: Cylinder 2 Misfire Detected

Likely Causes:
1. Faulty spark plug
2. Ignition coil issue
3. Fuel injector problem

Risk Level:
High

Safe Checks:
- Inspect spark plugs
- Check ignition connections

Do Not Do:
- Avoid prolonged driving

Next Action:
- Schedule engine diagnostic service

โš ๏ธ Limitations

This project is intended for educational and research purposes.

  • Not a substitute for professional vehicle diagnostics.
  • Diagnostic recommendations are AI-generated and may not always be accurate.
  • Supports a limited set of training scenarios and OBD fault patterns.
  • Performance depends on the quality and completeness of user-provided information.

๐Ÿ”ฎ Future Improvements

  • Expanded OBD-II code coverage
  • Larger automotive training dataset
  • Retrieval-Augmented Generation (RAG)
  • Multi-turn conversational diagnostics
  • Vehicle-specific recommendations
  • Enhanced confidence scoring

๐Ÿ‘จโ€๐Ÿ’ป Project Team

Team Members

  • Pranav M Nair
  • Aadil Sandeep
  • Advaith S Vinod
  • Thejas Baiju

๐ŸŽ“ Academic Context

This project was developed as an academic and research-oriented exploration of:

  • Automotive Artificial Intelligence
  • Large Language Models
  • Parameter-Efficient Fine-Tuning (PEFT)
  • OBD-II Diagnostic Systems
  • Intelligent Vehicle Assistance Systems

๐Ÿ“œ License

This project is licensed under the MIT License.

See the LICENSE file for details.


๐Ÿ™ Acknowledgements

  • Microsoft Research for the Phi-2 model
  • Hugging Face Transformers
  • PEFT (Parameter-Efficient Fine-Tuning)
  • PyTorch
  • Gradio

Built with AI, Machine Learning, and Automotive Diagnostics in mind.

About

An LLM-based car problem diagnosis system that uses fine-tuned language models to analyze natural language vehicle complaints and generate structured troubleshooting guidance with safety-aware recommendations.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 56.7%
  • Jupyter Notebook 43.3%