Inspiration
Spoilers don't come from people who mean harm. They come from the feed: a trending post, a video title, the top comment under a clip. Mute-word lists don't work, because spoilers rarely contain the words you'd think to mute — "I trusted that man with my whole heart" spoils a twist without naming anyone. Catching that needs a language model, and it needs to run on every post you scroll past. Doing that in the cloud would be slow, expensive, and would send your whole feed and your watch list to a server. That is exactly the shape of problem hybrid inference is for.
What it does
- You add a show and how far you've watched (optionally paste an episode guide or synopsis).
- Once per show, in the cloud, Gemini builds a private spoiler profile: names and aliases to watch for (English and Japanese), names that only appear after your episode, and a numbered list of plot points you haven't seen yet. The UI never shows this list.
- For every post you scroll past, on your device, Gemini Nano judges whether the post states or clearly implies one of those numbered plot points. Spoilers stay blurred, with a deliberately vague label ("reveals something after Episode 3") and a "Show anyway" button.
- If Gemini Nano isn't available, the very same request falls back to Gemini in the cloud automatically.
It ships as:
- a web demo with a fictional show and timeline, so anyone can try it without installing anything, and
- a Chrome extension for X, YouTube and Reddit: posts, comments, video titles and Shorts. On a video about your show, every comment is checked; when a title is a spoiler the whole video card (thumbnail and snippet) is veiled; names introduced after your episode are veiled instantly with no model call.
How we built it — and how it uses Firebase AI Logic
- Firebase AI Logic hybrid inference (
firebase/ai, Web SDK 13.4): the per-post judge is created withInferenceMode.PREFER_ON_DEVICE, so Chrome's Prompt API (Gemini Nano) runs it locally andgemini-3.5-flash-liteis the automatic fallback. Every response carriesinferenceSource, which the UI shows on each post ("on-device · 4.8 s" vs "cloud · 1.6 s"). - The profile builder uses
InferenceMode.ONLY_IN_CLOUDwith a JSON schema (responseJsonSchema). It needs world knowledge or a long episode guide, and it runs once. - One output contract for both sides: the judge answers with a single integer — which numbered plot point the post reveals, or 0. The same JSON schema is passed to Nano as
responseConstraintand to the cloud asresponseJsonSchema. - Warm-up: Gemini Nano is loaded into memory while the cloud builds the profile, so the first post isn't a 30-second wait.
- Free local prefilter: posts that don't mention any name in the profile never reach a model.
- App Check with reCAPTCHA Enterprise protects the hosted demo (debug tokens only for local development); Firebase Hosting serves it.
- The extension runs Firebase AI Logic in an offscreen document; the content script stays tiny and Firebase-free.
- TypeScript, esbuild, Manifest V3.
Challenges we ran into
- Small models need small questions. Asking Gemini Nano an open-ended "is this a spoiler?" made it flag almost everything (3/7 correct in our first test). Rewriting the task as "which of these numbered plot points does this post state? answer with a number, or 0" brought it to 13/13 on the same posts — and as a bonus the output has nothing in it that could leak the spoiler into the UI.
- Labels can spoil too. An early version asked for a short reason, and the reason repeated the twist. Labels are now generic by construction.
- Cold start. The first on-device prompt took ~34 s on a CPU-only mini PC; warming Nano up in parallel with the cloud call removed it.
- Recent story arcs. A fast cloud model doesn't always know the newest arc's names. The optional episode-guide field makes the profile accurate for anything, including brand-new episodes.
Accomplishments that we're proud of
- On a CPU-only mini PC (no GPU), a 20-post demo run: 8 posts veiled, 13 judged on-device, 0 sent to the cloud, ~5 s per post, 12/13 matching ground truth. On a laptop without Gemini Nano the same flow ran entirely through the cloud fallback (~1.6 s per post) with no code path change.
- Works in English and Japanese, including posts that only hint at a twist.
- On real YouTube search results and comments, spoiler cards for later arcs were veiled while unrelated videos stayed visible.
What we learned
Hybrid isn't only "local when possible, cloud otherwise." The interesting design is deciding which job belongs where: the cloud does the one-time, knowledge-heavy work; the device does the repetitive, private, latency-tolerant work; and both share one tiny output contract.
What's next
- Batch several posts per on-device prompt to cut latency.
- Profiles shared between friends (without the hidden list ever being shown).
- More sites, and a Chrome Web Store release.
Links
Built during the submission period (first commit Nov 21, 2026) with an AI coding assistant (Claude Code). Demo narration generated with Gemini TTS through Firebase AI Logic.
Built With
- chrome
- chrome-prompt-api
- esbuild
- firebase-ai-logic
- firebase-app-check
- firebase-hosting
- gemini
- gemini-nano
- recaptcha-enterprise
- typescript