Aarohan AI is an advanced, offline-capable AI educational assistant specifically tailored for Class 11 and 12 Science students in India. Built to bridge the educational resource gap, it provides instant, textbook-accurate answers, multimodal problem solving (camera & voice), and interactive quizzes—all running locally on the student's mobile device.
By leveraging Google's latest Gemma 4 E2B-it model, Aarohan AI eliminates the need for an active internet connection or expensive cloud subscriptions to democratize education.
This project explores the cutting edge of On-Device Local AI. We utilized the Gemma 4 E2B-it (1.5GB) model to achieve the following:
- True Offline Execution: Compiling the model via LiteRT (TensorFlow Lite) using the
flutter_gemmapackage allowed us to run billion-parameter LLM inference directly on average consumer Android hardware. - Multimodal Capabilities: The multimodal nature of Gemma 4 enables students to take pictures of their textbook problems or hand-written equations. The app passes both the captured image and the prompt context directly to the Gemma 4 engine for comprehensive visual analysis.
- Low Latency Inference: The context window is optimized to 1,024 tokens to strictly protect the device's RAM and prevent OOM (Out-of-Memory) crashes on budget smartphones, producing fast generative text speeds.
We implemented a highly optimized Retrieval-Augmented Generation (RAG) pipeline to make the app incredibly fast and completely hallucination-free for textbook questions.
Because running local LLMs can be computationally expensive (taking 5-15 seconds per response), we implemented a clever fallback mechanism:
- We parsed and extracted 3,575 pages of official NCERT textbooks into a local JSON bundle.
- Upon first launch, Aarohan AI injects this data into a native SQLite database using Full-Text Search indexing.
- Execution: When a student asks a textbook question (e.g., "What is Newton's Third Law?"), the App queries the local DB.
- If a highly confident NCERT match is found (90% of textbook questions), the app instantly streams the exact, formatted textbook text to the student in < 1 second without ever making the Gemma model calculate!
- If it is a novel question, or an image upload, the app defaults back to the Gemma 4 LLM to creatively solve the problem.
- Frontend UI: Flutter & Dart (Cross-platform, highly responsive dynamic UI)
- Local AI Inference:
flutter_gemma(LiteRT-LM) - Vector/Relational Data: SQLite (
sqfliteplugin) - Voice/Speech-to-Text: Native Android speech-to-intent APIs
- Fine-Tuning Engine (Optional): Unsloth via Kaggle Notebooks (PyTorch, HuggingFace TRL)
- 100% On-Device AI: Total privacy; no user data or images ever leave the smartphone.
- Multimodal Chat: Ask doubts via Voice, Text, or Camera captures.
- Instant RAG Retrieval: Millisecond-level retrieval of official NCERT text.
- Automated Model Lifecycle: The app automatically checks, downloads, and initializes the 1.5GB
.litertlmfile on device setup. - Backend Fail-safes: For development, the app cascades its backend:
LiteRT(Primary Phone Native) →Ollama(PC Localhost) →Simulated(Demo mode). - Subject Specific Quizzes: Interactive MCQs designed for competitive exams (JEE/NEET).
- Flutter SDK (v3.19+)
- Android Studio / ADB debug tools
- A physical Android device with Android 10+ and > 4GB of RAM (Required for local inference)
- Clone the repository:
git clone https://github.com/your-username/aarohan-ai.git cd "aarohan-ai"
- Install dependencies:
flutter pub get
- Connect your Android phone via USB Debugging.
- Run the app:
flutter run
On the first launch, the app will download the E2B Gemma model and index the local SQLite database. Please ensure you have wifi for the initial 1.5GB download!
Want to train Gemma 4 to answer questions in a specific teaching tone? We included our exact fine-tuning pipeline!
- Run the auto-uploader script provided in the repository:
python Data/push_to_kaggle.py
- When prompted, enter your Kaggle username. (Requires Kaggle API Key PAT).
- The script will securely upload your QA datasets (
train_dataset.json). - Import
Data/Kaggle_Finetuning.ipynbinto a new Kaggle kernel, attach the T4 x2 GPUs, and hit Run All!