Inspiration
Housing repair inspectors fill in checkboxes such as functioning: yes and then write a short note about what they saw. Too often the two disagree: functioning: yes right next to "no water came out". Those records slip through review, repairs get missed and tenants are left waiting. Checking every record by hand doesn't scale, and the notes often contain residents' names and phone numbers, which shouldn't be sent to a cloud model as they are.
That combination (lots of short records, privacy-sensitive text, inspectors working in basements with no signal) is exactly where hybrid AI makes sense.
What it does
FieldProof is a review queue for inspection records. For each record it returns:
- a verdict: Contradiction, Missing evidence, Ambiguous or Consistent
- a plain-language explanation
- evidence quotes from the note, each checked against the original text (a warning appears if the model invents a quote)
- a question to ask the inspector
The reviewer then accepts, overrides or escalates each flagged record, with an optional note. Everything is stored only in the browser.
How each record is checked:
- On-device first check. Gemini Nano runs in Chrome (
ONLY_ON_DEVICE) for a first verdict that also works offline. - On-device redaction. Phone numbers and emails are removed by pattern, names by the on-device model, and the result is validated. If anything looks wrong, nothing is sent: it fails closed.
- Cloud second opinion.
gemini-3.5-flash-lite(ONLY_IN_CLOUD) sees only the redacted text. If the two models disagree, FieldProof doesn't pick a winner: the record goes to a human.
Location and inspector name never leave the device. Offline, the on-device verdict is kept but clearly marked "On-device only, not verified" and sent to human review. Back online, one click (Verify N in the cloud) verifies them.
How we built it
- Firebase AI Logic hybrid inference (
firebase/ai):getAIwithGoogleAIBackend, andgetGenerativeModelwithInferenceMode.ONLY_ON_DEVICEandONLY_IN_CLOUD. We chose the two modes explicitly instead ofPREFER_ON_DEVICE, because we want both opinions on every record, not a fallback. - Structured output on both paths:
responseConstrainton-device andresponseSchemain the cloud. Every response is validated with Zod. initializeDeviceModel()for a user-started model download with progress, plus a warm-up call at page load to absorb the on-device cold start (up to about 2 minutes).inferenceSourcerecorded for every step and shown in a per-record trace, so it's always clear what ran where.- App Check with reCAPTCHA Enterprise, enforced for AI Logic.
- Firebase Hosting for the live demo. The UI is React, TypeScript, Vite, Tailwind and shadcn/ui.
- A Hybrid lab tab lets you run each inference mode directly.
Challenges we ran into
- On-device can be confidently wrong. On our 8 sample records, Gemini Nano alone was confidently wrong on 3. For example, it called a boiler with a zero-pressure gauge and a cold radiator "consistent". A policy that only escalates uncertain answers never catches those errors, so we verify every record in the cloud when online and send disagreements to a human.
- Redaction is hard on a small model. We saw leaked first names, invented
[PHONE]tokens and a runaway 177-second output. We layered in a pattern scrub, token clean-up, fragment merging, a timeout with one retry, length checks and a missed-name check, and made the whole step fail closed. - Latency. On-device checks take about 25 to 40 seconds each, and the cloud takes about 1 to 5 seconds. We made progress visible, added a warm-up, and let batches stop after the current record.
- Free-tier rate limits. When the cloud returns a rate-limit error, the on-device verdict is kept, marked unverified, and retried later with one click.
Accomplishments that we're proud of
- A complete product, not a demo screen: a queue, filters, stats, decisions with undo, offline handling, and saving between visits.
- Privacy by design: only five fields are ever sent to a model, and nothing is sent if redaction looks wrong.
- Being honest about limits: disagreement between models is treated as a signal for human review, not hidden.
What we learned
- Hybrid works best when the two models check each other, not only as a cloud fallback.
- Prompt design matters a lot on-device. Adding class definitions and two few-shot examples took one tricky record from 0 of 2 correct to 5 of 5.
- Small models are not deterministic, so single on-device runs need a second check.
What's next
- Photo evidence (image input already worked on-device and in the cloud in our tests, but isn't in the UI yet).
- Android with Gemini Nano through the same Firebase AI Logic SDK, for inspectors on phones.
- Firestore sync and Authentication for teams, with Remote Config for prompt and model updates.
- A stronger redaction layer before use with real personal data.
Built during the submission period
Everything in the repository was created during the #BuildHybridAI 2026 submission period, with the help of an AI coding assistant (Claude Code). Sample data is fictional.
Built With
- chrome
- firebase-ai-logic
- firebase-app-check
- firebase-hosting
- gemini
- gemini-nano
- react
- recaptcha-enterprise
- tailwindcss
- typescript
- vite
- zod