Inspiration
Every AI study tool we tried sends everything to the cloud — every summary costs money, needs a connection, and ships private material (unpublished research, internal meeting notes, sensitive study texts) to a server. But on-device-only AI fails the other way: not every laptop has a local model, and small models choke on long documents and structured output. We wanted a study assistant that treats where inference runs as a user-facing feature: private and instant by default, powerful when it counts — and always honest about which engine answered.
What it does
StudySprint turns any pasted text — lecture notes, an article, a chapter, meeting notes — into:
- a summary (TL;DR + key points + the one takeaway),
- an 8-card flashcard deck (tap to flip),
- a 5-question interactive quiz with explanations,
- an ELI5 explanation with an everyday analogy,
- a translation (Indonesian, Spanish, French, German, Japanese, English), and
- an action-item checklist extracted from meeting notes.
A built-in hybrid router sends short, everyday tasks to Gemini Nano on-device and escalates long documents (> 6,000 characters) and heavy structured generation (flashcards, quizzes) to cloud Gemini. Users can also force On-device only (nothing ever leaves the laptop) or Cloud only. Every answer shows an engine badge (On-device · Gemini Nano / Cloud · Gemini), the reason it was routed there, and its latency — and a live routing log records every decision. Sessions persist in localStorage only.
How we built it
- Firebase AI Logic (Web SDK, hybrid inference) is the single AI entry point. We create
GenerativeModels with explicitInferenceModes —PREFER_ON_DEVICEfor light tasks,PREFER_IN_CLOUDfor heavy ones,ONLY_ON_DEVICE/ONLY_IN_CLOUDfor the forced modes — with the cloud side on the Gemini Developer API backend (gemini-2.5-flash). WithPREFER_ON_DEVICE, the SDK itself runs Gemini Nano through Chrome's Prompt API when available and falls back to the cloud when it isn't. - We call
model.initializeDeviceModel()after a user interaction (as required) and surface Gemini Nano's model-download progress in the UI. - The UI reads the serving engine from the SDK response when annotated; otherwise it derives it from the routing mode plus a live
LanguageModel.availability()probe — and labels which method was used, because honest routing is the point of the app. - Firebase App Check is wired in (debug provider for local development; debug tokens are accepted for this hackathon).
- The front end is deliberately dependency-light: vanilla HTML/CSS/JS ES modules, no build step, so judges can run it with any static server.
- Graceful demo mode: with no Firebase config present, on-device tasks call Chrome's Prompt API directly (the same engine Firebase AI Logic uses on the web) and cloud-bound tasks degrade to a clearly-labelled local extractive fallback. The app never presents a non-AI answer as an AI answer.
Challenges we ran into
- On-device inference is single-turn and context-limited, so the router — not the user — has to know which tasks are "heavy". We landed on a task-type + input-length heuristic and made it visible so users learn the model with us.
- Structured output (flashcard/quiz JSON) is where small on-device models are least reliable; that's precisely why those tasks escalate to the cloud in Auto mode, with a tolerant JSON extractor on the client as a safety net.
- The on-device model isn't present until Chrome downloads it, and
initializeDeviceModel()requires a user gesture — the UX has to make "first run downloads the model" feel like a feature (progress in the routing log), not a hang. - App Check enforcement means a naive "paste config and go" breaks locally; the debug-token flow has to be part of the setup story.
Accomplishments that we're proud of
- A hybrid router whose decisions are explainable in the UI — engine badge, reason, latency, and a full routing log — instead of invisible plumbing.
- A complete, coherent product (samples, interactive flashcards/quizzes, session library, offline-capable on-device path) rather than a prompt-box proof of concept.
- An honesty-by-design fallback chain: Firebase AI Logic → direct Prompt API → labelled extractive fallback.
What we learned
- Hybrid inference changes product design, not just infrastructure: latency, privacy, cost, and output reliability all become routing inputs, and users understand (and trust) the system more when the routing is visible.
- Gemini Nano is remarkably capable for short, well-scoped tasks; the cloud earns its keep on long context and strict structured output.
What's next for StudySprint
- Streaming responses (
generateContentStream) for summaries and translations. - Multimodal input: summarize a photo of handwritten notes or a whiteboard (text+image is supported on-device).
- Firestore-backed sync of decks across devices (with on-device-only mode keeping private decks local), and spaced-repetition scheduling for flashcards.
- A Chrome extension build: right-click any article → "Study this page".