Inspiration

Students now do every exercise with an AI open next to them. Studies show what happens when that AI gives answers: in a PNAS 2025 study of about 1,000 high school students, those who practised with a ChatGPT-like helper scored 17% lower once it was taken away. In an MIT Media Lab study, 83% of ChatGPT users could not quote the essay they had just written with it. Teachers are left with two bad options: ban AI, or let it do the homework. We wanted a third one: an AI tutor that makes students stronger, not weaker. During a power cut at our school, we also saw how much students depend on a connection. So the tutor had to work offline too.

What it does

Kalima is an AI tutor teachers can trust in class. Hints, not answers. Written step by step.

  • Teachers upload a chapter. Gemini in the cloud turns it into a tutor pack: hints, common mistakes, worked steps, but never the answer key. The teacher sets the rules (Strict: on device only, or Allow cloud), runs Test my tutor (Kalima tries to break its own tutor before class), and gets an anonymous class report after class.
  • Students write on a real notebook-style board, by pen, keyboard or dictation. When they check their work, Kalima circles the mistake and asks a question. It never drops a full solution: it writes one line at a time, and the student presses Next line when ready. It draws figures (a right triangle for Pythagoras), works in any subject (algebra, geometry, physics, chemistry, algorithms, proofs), and the course document opens next to the board.
  • Hybrid by design: Gemini Nano runs inside Chrome on the student's computer, so the tutor keeps working with the Wi-Fi off and nothing leaves the laptop. On devices without a local model, Firebase AI Logic falls back to Gemini in the cloud, with the same tutor and the same rules.

How we built it

  • Firebase AI Logic hybrid inference (web SDK): the teacher's rule maps to the inference mode, Strict = ONLY_ON_DEVICE, Allow cloud = PREFER_ON_DEVICE. Each reply shows where it ran ("On device" or "Cloud") from inferenceSource.
  • Cloud for heavy work, device for live tutoring: Gemini prepares packs, judges Test my tutor runs and writes class reports. Gemini Nano answers students in class with short per-action JSON schemas (responseConstraint) and a compact prompt so it stays fast (about 5 seconds).
  • Safety layers: deterministic leak rules run first and on every reply, so a final answer is blocked even if a model tries to give it.
  • Firebase App Check with reCAPTCHA Enterprise, anonymous Firebase Auth, Firestore for classes and packs, Firebase Hosting.
  • Offline-first PWA: React, TypeScript and Vite, IndexedDB (Dexie) for packs, chats and notebook pages, a service worker, and an installable app.
  • The board is our own vector ink engine: pen, highlighter, eraser, lasso with Tidy, shapes that straighten themselves, notebook tabs and PDF export.

Challenges we ran into

  • Making Gemini Nano fast and reliable. Our first on-device path took 24 to 78 seconds and fell back to the cloud. We cut the prompt to about 1,100 tokens, used a smaller schema per action, numbered the course excerpts, and warmed the model up when a session opens.
  • Never giving the answer while staying helpful. Models leak steps, so we added rule-based checks that run before and after every model call.
  • Quotas and App Check on the free tier: we hit the daily Gemini limit during testing, and automated browsers fail App Check, so we tested the real path by hand.
  • Designing a board that feels like a notebook, not a chat window, in two days.

Accomplishments that we're proud of

  • A tutor that works with the Wi-Fi off, on a normal laptop, for free.
  • Test my tutor: teachers can see the tutor hold against "just give me the answer" before students use it.
  • A full product, not a demo: teacher and student sides, dark mode, phone layout, an installable app, and 159 unit tests.

What we learned

  • On-device AI changes what a school can do: no data leaves the classroom, and it costs nothing per student.
  • Small models need small, precise tasks. The cloud and the device are best at different jobs, and Firebase AI Logic lets one app use both.
  • Learning science matters as much as the model: one line at a time beats a full answer.

What's next for Kalima

  • Kalima Notebook: every course becomes a notebook. Students import the teacher's worksheet and write on it, with the tutor in the margin.
  • Android and iOS apps with Firebase AI Logic (Gemini Nano on Android, Apple Foundation Models on iOS), so the same tutor runs on phones on device.
  • More languages for the tutor (French first), and pilots in schools in Senegal.

Built With

  • chrome-built-in-ai
  • dexie
  • firebase
  • firebase-ai-logic
  • firebase-app-check
  • firebase-auth
  • firebase-hosting
  • firestore
  • gemini
  • gemini-nano
  • indexeddb
  • pdf.js
  • playwright
  • pwa
  • react
  • recaptcha-enterprise
  • service-worker
  • typescript
  • vite
  • vitest
  • web-speech-api
  • zod
Share this project:

Updates

Submission history