Inspiration
Support agents, HR teams, recruiters and accountants paste customer emails, tickets and contracts into AI chatbots every day to summarize them or draft a reply. Each paste can send a real person's name, card number, phone number or home address to a server that person never agreed to. Companies respond by banning AI tools, and people use them anyway. We wanted a third option: keep the power of cloud models without handing them anyone's private data.
What it does
VeilPass is a 4-step web app that runs in Chrome:
- Paste any sensitive text.
- Veil on-device. Gemini Nano runs locally through Firebase AI Logic and finds names, addresses and organizations. Local rules catch emails, phones, payment cards, IBANs and national IDs. Each value becomes a placeholder such as
[PERSON_1]or[CARD_1]. You can review the result, edit it, and veil anything that was missed with one click. - Ask the AI to summarize, draft a reply, extract action items, translate, or follow a custom instruction. Only the veiled text is sent.
- Unveil locally. The answer comes back with placeholders, and VeilPass restores the real values in the browser and highlights them, so you can see exactly what the AI never saw.
Every run shows a badge saying whether it ran on-device or in the cloud, read from the SDK's inferenceSource. A privacy ledger counts identifiers veiled, runs on-device, runs in the cloud, and real identifiers sent to the cloud. That last number stays at 0.
How we built it
Most hybrid apps use the on-device model as a cheaper copy of the cloud model. VeilPass gives the two sides of the Firebase AI Logic hybrid SDK different jobs:
- Privacy guard:
getGenerativeModel(ai, { mode: InferenceMode.ONLY_ON_DEVICE }). Raw text must never leave the device, so this step has no cloud fallback, by design. If Nano isn't available, VeilPass falls back to deterministic local rules, never to the cloud, and asks the user to review. - Task model: hybrid.
PREFER_ON_DEVICEfor short text (fast, free, private) andPREFER_IN_CLOUDwithgemini-3.5-flash-litefor long documents. The user can pick Auto, Prefer on-device or Prefer cloud, and a live hint shows where the request will go. - Re-identification: a token→value vault that lives only in the tab's memory.
- Firebase App Check protects the AI Logic backend (enforced; debug token for judging). The app is deployed on Firebase Hosting.
- Stack: vanilla JavaScript + Vite, Firebase JS SDK 13.4 (
firebase/ai,firebase/app-check), Chrome's built-in Prompt API (Gemini Nano).
Challenges we ran into
- Small models rewrite text. When we asked Nano to return redacted text, it sometimes paraphrased the email. So the guard only detects entities as JSON, and replacement happens in deterministic code. The original wording is never touched by a model.
- Nano can be slow on modest laptops. The first veiling took tens of seconds. We shortened the guard prompt to only what regex can't catch (names, addresses, organizations), declared the expected language, and added a timeout that falls back to local rules instead of the cloud.
- Messy model output. Nano sometimes returned placeholders as if they were PII, flagged month names as dates of birth, or missed a first name used alone ("Thanks, Linh"). We filter placeholders and stopwords, and propagate name parts of a detected full name.
- Fake on-device runtimes. Some embedded browsers expose a
LanguageModelstub that just echoes the prompt. VeilPass detects that and routes to the cloud with veiled text only. - Making the fallback safe. The usual hybrid pattern ("fall back to cloud") would defeat the purpose of redaction, so the app is split into a strictly-local stage and a hybrid stage.
Accomplishments that we're proud of
- A real, end-to-end privacy boundary: in our demo the cloud model wrote a correct summary about "[PERSON_2]" and "[CARD_1]", and the user still got a finished answer with real names. 0 real identifiers sent to the cloud.
- A non-obvious use of hybrid inference: on-device is a gatekeeper, not just a backup.
- A complete product, not a proof of concept: guided 4-step flow, human-in-the-loop editing, leak check before sending, transparent raw output, and a live deployment anyone can try.
What we learned
Hybrid inference is more than a cost or latency optimization. It can enforce a privacy boundary: some steps must stay on the device, and one SDK lets the same codebase decide this per step. We also learned to design around small on-device models: give them narrow detection tasks, keep the critical logic deterministic, and always have a safe local fallback.
What's next for VeilPass
- A Chrome extension that veils text automatically before it's pasted into any chatbot or web form
- Team policies (custom entity types such as patient IDs, case numbers or employee IDs) stored in Firestore and delivered with Remote Config
- PDF/DOCX input, streaming responses, and multilingual veiling (Vietnamese and more)
VeilPass is a new project built entirely during the #BuildHybridAI 2026 submission period. Third-party code: Firebase JS SDK and Vite. AI coding assistance: Claude Code.
Built With
- chrome-built-in-ai
- css3
- firebase-ai-logic
- firebase-app-check
- firebase-hosting
- gemini
- gemini-nano
- html5
- javascript
- vite