Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoDriver AI

An AI-powered driver coaching system that runs entirely on-device — no cloud, no data sharing.

CoDriver AI uses a fine-tuned DeepSeek-R1 1.5B language model running locally via llama.cpp on Android to analyze your driving behavior in real time and deliver personalized coaching after every trip.


What It Does

  • Real-time trip tracking — GPS route recording with 1-second location updates
  • Hardware sensor analysis — Detects harsh braking, rapid acceleration, sharp turns, and collision events via accelerometer and gyroscope
  • On-device AI coaching — Fine-tuned DeepSeek LLM generates personalized feedback after each trip, no internet required
  • Trip history — Room database stores all trips with route maps and event markers
  • Auto-detection — Automatically starts and stops recording when driving is detected
  • Driving profile — Aggregate analysis across all trips to identify long-term patterns

Architecture

┌─────────────────────────────────────────┐
│              Android App                │
│  ┌──────────────┐   ┌────────────────┐  │
│  │ Trip Tracking│   │  Local LLM     │  │
│  │ Service      │   │  Engine        │  │
│  │ (GPS+Sensors)│   │  (llama.cpp)   │  │
│  └──────┬───────┘   └───────┬────────┘  │
│         │                   │           │
│  ┌──────▼───────────────────▼────────┐  │
│  │           Room Database           │  │
│  │        (Trip History)             │  │
│  └───────────────────────────────────┘  │
└─────────────────────────────────────────┘

Tech Stack

Layer Technology
Mobile Android (Kotlin), API 26+ (Android 8.0), arm64-v8a
AI Inference llama.cpp (JNI), DeepSeek-R1-Distill-Qwen-1.5B
Model Format GGUF Q4_K_M (~600 MB)
Database Room (SQLite)
Maps OSMDroid (OpenStreetMap, no API key needed)
Location Google Play Services FusedLocationProvider
Sensors Android Accelerometer + Gyroscope
Training AWS SageMaker, QLoRA fine-tuning, PyTorch

Project Structure

codriver-ai/
├── android/CoDriverAI/          ← Android app + deployment package (APK + GGUF model)
│   ├── releases/                ← Signed release APK
│   ├── models/                  ← Fine-tuned GGUF model (Git LFS)
│   ├── README.md                ← Install instructions (APK + model push)
│   └── app/src/main/
│       ├── java/com/zeeshankhan/codriverai/
│       │   ├── data/            ← Room database (TripDao, TripEntity, TripRepository)
│       │   ├── llm/             ← LLM engine wrapper (llama.cpp JNI)
│       │   ├── model/           ← Data models (TripSummary, DrivingEvent)
│       │   ├── sensor/          ← Accelerometer & gyroscope processing
│       │   ├── service/         ← Trip tracking & auto-detection services
│       │   └── ui/              ← Activities (Main, History, Map, Profile, Results)
│       └── jniLibs/arm64-v8a/  ← Pre-built llama.cpp native libraries
├── training/                    ← AWS SageMaker training pipeline (13 notebooks)
├── dataset/                     ← 1,330 real driving scenarios (JSON)
├── model-tools/                 ← GGUF conversion scripts
└── docs/LOCAL_LLM_SETUP.md      ← Advanced model setup / conversion guide

Getting Started

Quick Deploy (APK + Model)

The complete deployment package lives in android/CoDriverAI/ and includes both the signed release APK and the GGUF model. See android/CoDriverAI/README.md for step-by-step install instructions.

cd android/CoDriverAI
adb install -r releases/CoDriverAI-v1.0.0-release.apk
adb push models/deepseek-driver-coach-q4_k_m.gguf /data/local/tmp/deepseek-driver-coach-q4_k_m.gguf

Note: The model is tracked with Git LFS (~1.1 GB). After cloning, run git lfs pull.

Build from Source

Prerequisites

  • Android Studio Hedgehog or newer
  • Android device: API 26+, arm64-v8a (Android 8.0+)
  • NDK installed (Android Studio → SDK Manager → SDK Tools → NDK)

Build

# Open in Android Studio
File → Open → android/CoDriverAI

# Sync Gradle, then build
Build → Make Project

See android/CoDriverAI/README.md for release builds and Google Play upload.


Training the Model

The model was fine-tuned on 1,330 real driving scenarios using QLoRA (4-bit) on AWS SageMaker.

# Training pipeline (AWS SageMaker)
training/Main.ipynb          # Full end-to-end pipeline
training/train.py            # Training script (QLoRA, DeepSeek-R1-1.5B)
training/quantize.py         # GGUF quantization
dataset/drive_coaching_1330_trips.json  # Training data

Model specs:

  • Base: DeepSeek-R1-Distill-Qwen-1.5B
  • Fine-tuning: QLoRA, 4-bit, rank 16
  • Training: 3 epochs, lr 2e-4, batch 2
  • Format: GGUF Q4_K_M for on-device inference

Detection Thresholds

Event Sensor Threshold
Harsh Braking Accelerometer > 0.4g deceleration
Rapid Acceleration Accelerometer > 0.35g acceleration
Sharp Turn Gyroscope > 3.0 rad/s rotation
Collision Accelerometer > 4.0g impact

Built by Zeeshan Khan · 2025–2026

About

CoDriver AI — on-device driver coaching with fine-tuned DeepSeek LLM (Android APK + GGUF model)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages