Inspiration

Doctors, lawyers, auditors, and board secretaries all use AI to write faster, but they can't paste a patient note, an NDA, or M&A minutes into a public cloud API. Every keystroke sent off-device is a HIPAA/GDPR risk, adds latency, and adds a recurring inference bill.

I asked a simple question: what if the AI went to the document, instead of the document going to the AI?

Google's Hybrid AI approach made that practical. Chrome's built-in Gemini Nano can handle the sensitive work locally, and the cloud is only needed for the hard cases.

What it does

OmniScribe Hybrid AI is a privacy-first document and knowledge studio. It can:

  • Redact PII/PHI (names, MRNs, dates of birth) entirely on-device
  • Auto-summarize into an executive TL;DR, key findings, and recommendations
  • Extract action items with owners and dates from confidential board minutes
  • Analyze multimodal documents (invoices, receipts, diagrams) via cloud boost
  • Sync documents across sessions with Firebase Authentication and Cloud Firestore, with an offline-first local cache

The user picks one of three inference modes:

Mode SDK config Guarantee
Auto Hybrid prefer_on_device Local Gemini Nano first; falls back to Gemini 2.5 Flash only if the payload is too large, the model isn't ready, or an image is attached
Strict Local only_on_device Zero data egress. If local can't handle it, the app refuses and explains why instead of silently going to the cloud
Cloud Boost only_in_cloud Explicit cloud route to Gemini 2.5 Flash, protected by Firebase App Check

The UI always shows where your data is going: checking compatibility, downloading model, local model ready, processing locally, cloud fallback, offline, unsupported browser, AI service unavailable.

How I built it

OmniScribe is a single-page app (Bootstrap 5.3 + ES Modules) built on the Firebase AI Logic Hybrid SDK.

  • Firebase AI Logic (firebase/ai, GoogleAIBackend): one SDK call surface for both on-device Gemini Nano (via Chrome's Prompt API) and cloud Gemini 2.5 Flash
  • Firebase App Check: reCAPTCHA Enterprise in production, debug provider for evaluators
  • Firebase Remote Config: controls the fallback model, token thresholds, and PII policy without redeploying
  • Cloud Firestore: stores documents under users/{userId}/documents/{docId}
  • Firebase Authentication: one-click anonymous guest login so judges can try it with zero signup, plus optional Google Sign-In
  • Vercel: static deploy with security headers

The routing decision is simple. For a payload of $n$ tokens and a Remote Config threshold $T$ (default $1500$), Auto Hybrid runs locally when

$$ \text{local_ready} \;\wedge\; (n \le T) \;\wedge\; \neg\,\text{has_image} $$

and escalates to the cloud otherwise. Strict Local never escalates.

const model = getGenerativeModel(ai, {
  mode: InferenceMode.PREFER_ON_DEVICE, // or ONLY_ON_DEVICE / ONLY_IN_CLOUD
});

Challenges I ran into

  • Honest fallback. Silent cloud fallback defeats a privacy product. I built Strict Local to fail loudly with a clear privacy notice instead of quietly escalating.
  • Model lifecycle states. Gemini Nano may be unavailable, downloading, or ready. I designed UI states for each so users never face an unexplained spinner.
  • Small context window. On-device models have limited context, so I added token-threshold routing and tuned it through Remote Config.
  • Evaluator-friendly security. App Check needs to protect the cloud route without blocking judges, so I added a debug-provider path and anonymous guest auth.
  • Offline-first sync. Documents had to survive refreshes and network drops, so Firestore writes fall back to a local cache.

What I learned

  • Hybrid AI is a product-design pattern, not just a technical one: users need to see and control where their data goes.
  • Remote Config is a great way to tune AI behavior (models, thresholds, policies) without shipping new code.
  • On-device models are good enough for redaction, summaries, and checklists, which are exactly the sensitive, repetitive tasks that benefit most from privacy.

What's next

  • Custom redaction policies per industry (HIPAA, GDPR, SOC 2 presets)
  • Local-only audit log of what was redacted
  • Batch processing for folders of documents
  • Optional end-to-end encrypted Firestore sync

Built With

  • bootstrap
  • chrome
  • chrome-built-in-ai
  • cloud-firestore
  • css3
  • es-modules
  • firebase
  • firebase-ai-logic
  • firebase-app-check
  • firebase-authentication
  • firebase-remote-config
  • gemini-2.5-flash
  • gemini-nano
  • html5
  • javascript
  • prompt-api
  • recaptcha-enterprise
  • vercel
Share this project:

Updates

Submission history