Inspiration

Millions of students in India study on slow or patchy mobile data. AI study apps stop working exactly when the signal drops: on a bus, in a village, in a hostel basement. I wanted a study companion that keeps teaching on any signal.

What it does

Universal AI is a hybrid AI study companion for the web (Chrome). It picks where the AI runs for every request: Gemini in the cloud when the signal is good, Gemini Nano on the device when it is weak or gone. Every answer shows where it ran, which model answered, how long it took, and why.

  • Ask a doubt: step-by-step answers in simple English, explained again more simply when the student is stuck.
  • Exam practice: timed multiple-choice tests from a topic or the student's own PDF, Word or PowerPoint notes, with results by topic. Works offline with Gemini Nano.
  • Personal tutor: tracks mastery per topic from real answers, finds weak topics, keeps a streak and plans revision.
  • Document AI: PDF, Word, Excel and PowerPoint files are read on the device; ask for a summary, key points, a quiz or a translation.
  • Exact answers offline: sums, conversions, areas and common facts (capitals, elements, SI units, formulas) are worked out exactly on the device and labelled "Calculator" or "Checked fact list". Everything else goes to Gemini Nano with those checked facts attached.
  • Explore Map (Chennai): search, walking and driving routes (fastest or shortest, with alternatives) and simple navigation. Offline, it uses Chennai's road network saved on the device (130,588 road sections, 13,286 places from OpenStreetMap) and works out routes right there. No traffic data is invented.
  • Photo cleaner: cleans up scans, removes blur and enlarges photos of notes on the device.
  • Hybrid AI page: live status of Gemini Nano, the cloud and the network, a log of every routing decision with real timings, and a local-only privacy mode.

How I built it

  • Firebase AI Logic Web SDK: getAI + getGenerativeModel with one model per inference mode: PREFER_ON_DEVICE, ONLY_ON_DEVICE, PREFER_IN_CLOUD, ONLY_IN_CLOUD.
  • On device: Gemini Nano in Chrome through onDeviceParams, with a short system prompt tuned for the small model; initializeDeviceModel shows download progress.
  • In the cloud: gemini-3.5-flash-lite through inCloudParams.
  • Hybrid router: reads the connection type and speed, whether Nano is ready, and the input size, then picks the mode. With no signal it goes straight to the device; if the device can't answer and there is signal, it falls back to the cloud. response.inferenceSource labels every answer truthfully.
  • Firebase App Check with reCAPTCHA Enterprise protects the cloud calls; the app is on Firebase Hosting.
  • Offline-first: a service worker saves the app; the map uses Leaflet with OpenStreetMap data and an A* router that runs on the device. All of the app's AI runs through Firebase AI Logic.

Challenges I ran into

  • Gemini Nano is small, so long chats and documents needed short prompts, a compact conversation format and chunked summaries.
  • A small on-device model can slip on exact numbers. I added an exact calculator and a checked fact list, and built a 5,000-question offline test: the first run found 130 misses, which I fixed. It now passes 5,000 / 5,000, and 15,000 / 15,000 on three fresh question sets.
  • Offline routes need real road data. The free OpenStreetMap servers were too busy for a quick download, so I built Chennai's road network once and ship it with the app: it saves in about a second, and routes take 2–75 ms on the device.
  • A model that is still downloading can make requests wait forever, so the router only uses the device when the model is ready, with timeouts and a cloud fallback.

Accomplishments I'm proud of

The same chat keeps working when the Wi-Fi is switched off mid-conversation, and every answer says honestly where it came from.

What I learned

How to design for the worst connection first, how far a small on-device model can go when it is given checked facts, and why showing the user where an answer came from builds trust.

What's next

More cities for offline maps, Hindi and Tamil voice, and an Android build.

Built With

Share this project:

Updates

Submission history