-
-
How it works: on-device classifier, Gemini Nano and cloud Gemini through Firebase AI Logic hybrid inference.
-
Measured on 257 real photos: 30% → 55% correct, 34% fewer cloud calls after learning.
-
Easy photos are settled on the phone by Gemini Nano; hard ones go to cloud Gemini, which also flags pet safety.
-
The cloud teaches, the phone learns: the second photo of the same plant is answered from memory in 0.2 s.
Inspiration
"Is this plant safe for my cat?" People ask it on walks, on trails and in garden centers, often with a weak signal. In 2025 ASPCA Animal Poison Control handled more than 376,000 pet exposures, and plants and fungi were 7.5% of them (ASPCA). A plant app that needs the cloud for every photo is slow and costly, and one that runs only on the phone is often wrong. We wanted both: answer on the phone when it can, ask the cloud when it must, and let the phone get smarter from what the cloud says.
What it does
NatureAsk names a plant from a photo and says whether it is safe around pets and children.
- Easy photo → settled on the phone. An on-device classifier ranks candidates; Gemini Nano looks at the photo and confirms one. No network needed.
- Hard photo → cloud Gemini. When the phone is unsure or Nano disagrees, cloud Gemini takes a closer look and returns the name, visible features, look-alikes and a safety note.
- The cloud teaches, the phone learns. Every answer the cloud confirms is stored on the phone. The next photo of the same plant is answered in 0.2 s with no AI call at all.
- Ask follow-up questions. "Is it safe for pets?" is answered by Gemini Nano on the phone, using what the cloud already explained about that plant.
- Every result shows its route as chips (Phone → Gemini Nano → Cloud, with times), and a "hybrid receipt" shows how many identifications the phone settled alone and how many cloud calls it saved.
How we built it
- Firebase AI Logic hybrid inference on Android:
PREFER_ON_DEVICEfor Gemini Nano 4 (via AICore) on easy cases,PREFER_IN_CLOUDfor hard ones, with structured JSON output (responseSchema) from cloud Gemini and streaming answers for questions. - On-device classifier: BioCLIP 2.5 Mobile on ONNX Runtime with region packs (14,207 US species, 7,943 Korean species), chosen from the phone's country without a location permission.
- Routing rules (
hybrid/Routing.java, unit-tested) decide per photo whether the phone, Nano or the cloud answers, and fall back to Nano when the cloud is unreachable or over quota. - Learning loop: confirmed answers are stored as image embeddings (never the photo) plus the cloud's "how to tell it apart" note, which is injected into Nano's prompt. The small model borrows the cloud's knowledge through the prompt alone, without retraining.
- Firebase App Check protects the Gemini API; Firebase Remote Config holds model names and routing switches so they change without an app update.
Challenges we ran into
- Gemini Nano always picked one of the candidates, even when all were wrong. Adding an explicit "none of these" option and shuffling candidate order fixed the forced wrong picks.
- Nano could not separate look-alike species (its non-top picks were right only 6% of the time), so hard cases now skip Nano and go straight to the cloud, saving about 10 s each.
- Two AIs can be wrong together (both called a Monterey cypress a juniper), so the phone learns automatically only when the classifier, Nano and the cloud all agree; otherwise only when the user picks the answer.
- Back-to-back Nano calls returned BUSY; a short retry cut errors from 121 to 4.
Accomplishments that we're proud of
Measured on real iNaturalist photos on a test phone with Gemini Nano 4:
- Correct answers: phone alone 30% → hybrid 55% (257 photos, 18 species).
- After learning: 34% fewer cloud calls (111 → 73 on 121 plants photographed twice).
- When the phone settled a plant alone after learning: 97.9% correct (48 of 121).
- Same plant, second photo: 7.1 s → 0.2 s.
All benchmark data and scripts are in the repository.
What we learned
The best use of a small on-device model is not to replace the cloud but to sit next to it: give it a narrow job (confirm one of a few candidates), give it a way out ("none of these"), and feed it the cloud's knowledge through the prompt. The routing rules matter as much as the models.
What's next
An opt-in sync of the learned records (already in a versioned, photo-free format) to Cloud Firestore, checked across users and folded into the next region pack, so every phone starts out knowing what other phones were taught. Then a web version with the same hybrid flow.
Built during the submission period
NatureAsk started on Nov 9, 2026, two days before the contest opened, as an on-device plant classifier: BioCLIP 2.5 Mobile on ONNX Runtime with a Korean plant pack. Everything else was built during the submission period: the Firebase AI Logic hybrid flow (Gemini Nano + cloud Gemini) and its routing rules, the learning loop and hybrid receipt, Ask with streaming answers, App Check and Remote Config, the 14,207-species US plant pack, the benchmarks, sample photos and demo mode, and the current UI. AI coding assistants were used during development.