
Inspiration
Online shopping in 2026 is an exercise in information warfare. Industry research consistently shows that 30 to 40 percent of online product reviews are incentivized, bot-generated, or merchant-curated. Product specification sheets are riddled with marketing exaggerations and strategic omissions. Consumers routinely drown in 20+ open browser tabs cross-referencing Reddit threads, YouTube teardowns, price trackers, and retailer listings before they can confidently click "Buy."
We asked ourselves: what if a single AI-powered interface could do all of that for you -- instantly, transparently, and privately?
That question became Verdict.
The Firebase Hybrid AI Hackathon's focus on combining on-device and cloud inference was the ideal catalyst. We realized that shopping verification is a textbook hybrid AI use case:
- Privacy-sensitive tasks (parsing your budget, your personal requirements, your wish-lists) should never leave your device.
- World-knowledge tasks (live prices from Amazon, Flipkart, Best Buy; real-time stock checks; Reddit community sentiment) must go to the cloud.
- The real power is not choosing one or the other -- it is chaining both together into a single, seamless pipeline where cloud discovery feeds into on-device private verification.
Personal frustration was the original spark. One of us bought a pair of wireless earbuds that had thousands of 5-star reviews and arrived to discover they were entirely incentivized. Another spent an entire weekend cross-referencing Reddit threads, spec sheets, and price trackers just to buy a keyboard. We wanted a tool that would do that research honestly, transparently, and in seconds -- while keeping personal shopping preferences completely private.
What it does
Verdict is an authoritative, privacy-first AI shopping verification platform for the web. Users describe what they want to buy in natural language, paste a product URL, or upload a photo -- and Verdict runs a multi-stage hybrid AI pipeline to deliver a comprehensive, verifiable verdict.
Core Workflow
A user types a query like "I need wireless earbuds under Rs 5000 with ANC and 30+ hour battery." Verdict then:
- Parses intent on-device : Gemini Nano privately extracts product category, budget constraints, and must-have features without any data leaving the browser.
- Discovers real products in the cloud : Gemini Flash with Google Search Grounding searches live retail inventory across 20+ verified retailers (Amazon, Flipkart, Myntra, Best Buy, Sephora, Nike, Ikea, Keychron, and more), returning real in-stock products with verified prices and deep links.
- Audits specifications on-device : Gemini Nano performs claim-by-claim verification of every product spec against the user's parsed requirements, flagging exaggerations and omissions.
- Analyzes review sentiment on-device : Summarizes authentic community feedback from Reddit discussions (fetched via Cloud Functions) and product review excerpts.
- Computes a Trust Score on-device : A deterministic 4-pillar scoring engine (0 to 100) evaluates duplicate phrasing, burst timing, incentivized keywords, and rating skew.
- Delivers a final verdict on-device : Synthesizes all prior stages into a decisive Buy, Maybe, or Skip recommendation with structured reasoning.
The pipeline
| Stage | Engine | Inference Mode | Purpose |
|---|---|---|---|
| Intent Parsing | Gemini Nano (on-device) | PREFER_ON_DEVICE |
Extract product category, budget, constraints -- 100% private, zero latency |
| Product Discovery | Gemini Flash + Google Search Grounding (cloud) | ONLY_IN_CLOUD |
Live web search across 20+ retailers for real, in-stock products with verified prices |
| Specification Audit | Gemini Nano (on-device) | PREFER_ON_DEVICE |
Claim-by-claim verification against user requirements |
| Review Sentiment | Gemini Nano (on-device) | PREFER_ON_DEVICE |
Summarize authentic community feedback from Reddit and review excerpts |
| Trust Score | Gemini Nano + Deterministic Heuristics | PREFER_ON_DEVICE |
4-pillar review authenticity scoring (0-100) |
| Final Verdict | Gemini Nano (on-device) | PREFER_ON_DEVICE |
Decisive Buy / Maybe / Skip with structured reasoning |
Key Features
- Real-Time Inference Telemetry : Every AI response displays a live badge showing where it was computed: "Gemini Nano (on-device)" or "Gemini Flash + Search Grounding (cloud)", sourced directly from
response.inferenceSource. - Live Multi-Store Grounding : Searches 20+ verified retailers in real time with live pricing in INR and USD, returning deep links to actual product pages.
- 4-Pillar Trust Score (0-100) : Deterministic review authenticity analysis evaluating duplicate phrasing (0-20), burst timing (0-20), incentivized keywords (0-20), rating skew (0-20), plus AI semantic judgment (0-20).
- Buy / Maybe / Skip Verdicts : Unambiguous, actionable recommendations with structured reasoning.
- 4-Way Product Comparison : Side-by-side spec validation, pricing, seller verification, and claim audit status for up to 4 products.
- Multimodal Visual Recognition : Upload a photo of any product; Gemini extracts visual attributes and finds matching listings across stores.
- Shopping Boards with On-Device Q&A : Save verdicts to custom boards and ask comparative questions (e.g., "Which monitor has the best color accuracy?") -- processed 100% on-device for boards with 10 or fewer items.
- Offline-First with Optimistic Sync : Full guest functionality via local storage with flicker-free Firestore reconciliation upon Google sign-in.
- Trending Showcase : Cloud Functions curate and verify trending products on a schedule, served from a public Firestore collection.
- GDPR/CCPA Compliant Data Deletion : A dedicated Cloud Function recursively purges all user data on request.
How we built it
Verdict is a React 19 + TypeScript monorepo built with Vite and Tailwind CSS v4, powered end-to-end by seven Firebase products.

Firebase AI Logic : The Hybrid AI Engine
The Firebase AI Logic SDK (firebase/ai) is the core reasoning engine. It is initialized in packages/core/src/ai/client.ts:
import { getAI, GoogleAIBackend, InferenceMode } from "firebase/ai";
const ai = getAI(getFirebaseApp(), {
backend: new GoogleAIBackend(),
useLimitedUseAppCheckTokens: Boolean(appCheck),
});
Models are created with explicit InferenceMode per task via createModel(), which accepts PREFER_ON_DEVICE, ONLY_ON_DEVICE, PREFER_IN_CLOUD, or ONLY_IN_CLOUD. The routing decision is made by resolveInferenceMode() in routing.ts, which evaluates:
- User preference (auto / on-device / cloud toggle from Settings page)
- Task type (e.g.,
discoverProductsalways routes to cloud because it needs Google Search Grounding) - Remote Config flags (e.g.,
force_cloud_for_images,board_item_limit_on_device,ai_token_threshold) - Browser capabilities (via
hasBrowserOnDeviceAI()which checks forwindow.ai.languageModel)
The default routing table in routing.ts:
| AI Task | Default Mode | Reason |
|---|---|---|
parseRequest |
PREFER_ON_DEVICE |
Private intent extraction |
askClarification |
PREFER_ON_DEVICE |
Conversational follow-up |
discoverProducts |
ONLY_IN_CLOUD |
Requires Google Search Grounding |
extractPageProduct |
PREFER_ON_DEVICE |
Structured data extraction |
claimCheck |
PREFER_ON_DEVICE |
Specification audit |
summarizeReviews |
PREFER_ON_DEVICE |
Review sentiment synthesis |
trustScore |
PREFER_ON_DEVICE |
Authenticity scoring |
rankAndVerdict |
PREFER_ON_DEVICE |
Final verdict generation |
refine |
PREFER_ON_DEVICE |
Follow-up refinement |
boardQA |
PREFER_ON_DEVICE |
Comparative Q&A on saved items |
After every AI call, getInferenceSource(response) reads the native response.inferenceSource metadata and the UI renders a live telemetry badge showing "ON_DEVICE" (green) or "IN_CLOUD" (amber).
Hybrid Fallback with JSON Validation
The generateJsonWithHybridFallback() function in tasks.ts implements a robust fallback strategy: it first attempts on-device execution with a 12-second timeout, and if Nano stalls, errors, or returns invalid JSON, it transparently falls back to cloud Gemini without the user noticing.
Firebase Remote Config : Real-Time AI Policy Control
Remote Config governs AI routing policies in real time without application rebuilds:
| Parameter | Default Value | Purpose |
|---|---|---|
ai_cloud_model |
gemini-3.8-flash |
Active cloud model identifier |
ai_token_threshold |
1000 |
Token cutoff for on-device vs cloud routing |
force_cloud_for_images |
true |
Force cloud inference when images are detected |
enable_search_grounding |
true |
Toggle Google Search Grounding for discovery |
board_item_limit_on_device |
10 |
Max board items before offloading Q&A to cloud |
trending_categories |
["Jewelry & Accessories", "Sneakers & Footwear", ...] |
Interest categories for trending feed |
Initialized in packages/core/src/firebase/remoteconfig.ts with fetchAndActivate() and a 0-second fetch interval in development mode, 1-hour in production.
Cloud Firestore : Real-Time Persistence
Firestore provides hierarchical real-time storage:
| Collection Path | Purpose |
|---|---|
/users/{uid}/chats/{chatId} |
Conversation metadata |
/users/{uid}/chats/{chatId}/messages/{messageId} |
Message thread with structured verdicts and grounding metadata |
/users/{uid}/boards/{boardId} |
Shopping boards |
/users/{uid}/boards/{boardId}/items/{itemId} |
Saved product verdicts and annotations |
/trending/{weekId} |
Publicly readable weekly trending products |
/reviewCache/{docId} |
Authenticated cache for processed review heuristics |
Security rules strictly enforce /users/{uid}/** access only to request.auth.uid == uid, public read on /trending, and admin-only write on /trending and /reviewCache.
Firebase App Check : Security Gatekeeper
App Check protects all endpoints (AI Logic, Functions, Firestore) from unauthorized traffic:
- Production:
ReCaptchaV3Provider(orReCaptchaEnterpriseProvider) with invisible risk-based scoring. - Development / CI: A custom
createDebugTokenProvider()inappcheck.tsthat exchanges debug tokens directly with the Firebase App Check REST API, enabling headless automated testing in Vitest without loading third-party reCAPTCHA scripts. - Limited-use tokens (
useLimitedUseAppCheckTokens: true) on AI Logic instances to prevent replay attacks.
Cloud Functions v2 : Serverless Workers
Six Cloud Functions deployed on 2nd-generation Cloud Run:
| Function | Trigger | Purpose |
|---|---|---|
aggregateTrending / aggregateTrendingScheduler |
Scheduled (Cloud Scheduler) | Curate and verify trending products into /trending |
recheckWatchlist / recheckWatchlistScheduler |
Scheduled (daily) | Monitor saved board items for price drops, stock changes, recall notices |
redditSearch |
onCall (callable) |
Search Reddit OAuth API for unfiltered community feedback |
semanticSearch |
onCall |
Vector-based semantic retrieval over cached reviews |
embedText |
onCall |
Generate text embeddings for review cache |
deleteUserData |
onCall |
GDPR/CCPA compliant recursive user data deletion |
Frontend : React 19 + Tailwind CSS v4 + Framer Motion
The UI is a single-page application with Lenis smooth scrolling, Framer Motion micro-interactions, and 15+ custom animation primitives (letter swaps, typewriter effects, stacking cards, gooey SVG filters). Pages include a marketing landing page, real-time chat interface, shopping boards, 4-way comparison modal, trending showcase, and settings for inference mode toggling.
Challenges we ran into
1. Gemini Nano Availability Detection
Chrome's Built-in AI flags and model download status are not always immediately queryable. The window.ai.languageModel API and the newer globalThis.LanguageModel surface vary across Chrome versions and flag combinations. We built a robust capability check (hasBrowserOnDeviceAI()) that probes both API surfaces with graceful degradation. When Nano is unavailable, generateJsonWithHybridFallback() automatically bypasses on-device attempts entirely to avoid burning 12-second timeouts on every request.
2. Cross-Tier Inference Chaining
The hardest architectural challenge was coordinating a multi-step pipeline where cloud discovery (Step 2) feeds structured data into on-device audit and scoring (Steps 3-6). Each stage produces JSON output that the next stage consumes. Ensuring data fidelity across the cloud-to-device handoff required strict Firebase AI Logic Schema types on the cloud side and Zod validation on the client side, with fallback re-parsing logic (parseJsonResponse) to handle edge cases where models wrap JSON in markdown code fences.
3. Live Price Extraction Accuracy
Google Search Grounding returns real-time web data, but extracting structured pricing (currency, amount, merchant, URL) from free-form search result snippets demanded extensive prompt engineering. We also had to build robust URL validation (isVerifiedRealUrl()) to reject placeholder URLs, synthetic ASINs, editorial blogs, price-tracker sites, category pages, and store homepages. The function maintains curated lists of non-product domains and retailer-specific URL pattern matchers (e.g., Amazon requires /dp/, Myntra requires /buy, Nykaa requires /p/).
4. Trust Score Calibration
Tuning the 4-pillar heuristic weights to produce meaningful 0-100 scores that align with human intuition about review authenticity was an iterative process. The duplicate phrasing detector uses sentence-level n-gram matching with a 25-character minimum to avoid false positives on short phrases like "Great product." The burst timing detector looks for 40%+ of reviews clustering within a 48-hour window. Getting the penalty curves right so that 3 duplicate sentences feels different from 1 required extensive testing.
5. Optimistic Local-to-Firestore Synchronization
Guest users operate entirely via localStorage, and authenticated users use Firestore with onSnapshot listeners. When a guest signs in with Google, all local chats, messages, boards, and board items must merge into their Firestore account without data loss or UI flicker. The reconciliation logic had to handle duplicate detection (by URL), timestamp normalization, and cover image re-indexing across both storage backends.
6. App Check in Headless CI
Standard App Check requires either reCAPTCHA v3 (which needs a DOM and browser environment) or the built-in debug token flow (which logs tokens to the console and requires manual registration). Neither works in headless Vitest or CI pipelines. We built a custom createDebugTokenProvider() that uses CustomProvider to exchange pre-registered debug tokens directly with the Firebase App Check REST API endpoint, bypassing all browser dependencies.
Accomplishments that we're proud of
True Hybrid Chaining, Not Just Fallback
Most hybrid AI implementations treat on-device inference as a simple fallback when cloud is unavailable. Verdict implements genuine multi-step chaining: the cloud discovers live product data, and the on-device model privately audits it against the user's personal requirements. Neither tier alone delivers the full experience. This is visible in the codebase -- discoverProducts() runs ONLY_IN_CLOUD with tools: [{ googleSearch: {} }], and its output feeds directly into claimCheck() and trustScore() which run PREFER_ON_DEVICE.
Complete Inference Transparency
Every single AI response in the UI shows exactly where it was computed. Users see "Gemini Nano (on-device)" or "Gemini Flash + Search Grounding (cloud)" badges sourced from the native Firebase AI Logic response.inferenceSource metadata -- not approximations or guesses. This level of transparency builds trust with privacy-conscious users.
Robust URL Verification Pipeline
The isVerifiedRealUrl() and isNonProductPage() functions implement a comprehensive URL verification pipeline that rejects placeholder URLs, synthetic ASINs, editorial blogs, price-tracker sites, YouTube reviews, Reddit threads, category homepages, and generic search pages. This ensures every product link Verdict presents to users leads to an actual purchasable listing.
Seamless Guest-to-Authenticated Migration
Users can start using Verdict immediately as guests with zero sign-up friction. All data persists in localStorage. When they optionally sign in with Google, everything -- chats, messages, boards, saved verdicts -- migrates to Firestore without data loss, duplication, or visible loading states.
Remote Config as an AI Control Plane
Using Firebase Remote Config to govern model selection, token thresholds, grounding toggles, and board item limits means we can tune AI behavior for all users in real time without code changes or redeployments. This is infrastructure we can carry forward into production.
What we learned
Hybrid AI is a chaining paradigm, not a fallback strategy. Our biggest insight was that the real power of hybrid inference is not "run locally if you can, otherwise go to cloud." It is chaining cloud and on-device intelligence where each tier handles what it does best. The cloud has world knowledge and tool access; the device has privacy and zero latency. Combining them in sequence produces results neither could achieve alone.
Firebase Remote Config transforms AI routing from code to configuration. Being able to adjust token thresholds, model selection, and grounding toggles in real time -- without touching code -- is transformative for iterating on AI behavior in production. We went from hardcoded routing decisions to a fully configurable policy engine in a single afternoon.
Structured output plus Zod validation equals reliability. Using Firebase AI Logic's Schema types alongside client-side Zod schemas gave us strongly-typed, validated AI outputs that the React UI can render deterministically. Combined with parseJsonResponse() fallback logic (stripping markdown fences, extracting JSON from mixed text), the pipeline handles model output variations gracefully.
App Check debug tokens need careful engineering. The standard debug token flow assumes a browser console and manual token registration. Building a custom REST-based CustomProvider that works in headless Vitest and CI environments was non-trivial but essential for maintaining test coverage without compromising security.
On-device AI demands defensive timeout management. Gemini Nano can stall during model download, produce partial outputs, or return malformed JSON. The generateJsonWithHybridFallback() pattern -- attempt on-device with a strict 12-second timeout, then transparently fall back to cloud -- was the key to making hybrid inference feel seamless to users.
What's next for Verdict
- Browser Extension : A Chrome extension that injects Verdict's hybrid verification pipeline directly into product pages on Amazon, Flipkart, Myntra, and other retailers, so users get verdicts without leaving the shopping site.
- Android App with Gemini Nano : Extend hybrid inference to Android using the Firebase AI Logic SDK's native Android support for Gemini Nano, bringing the same privacy-first verification to mobile shopping.
- Price History Tracking : Integrate the
recheckWatchlistCloud Function with historical price data storage and visualization, so users can see price trends over time and get notified of genuine deals. - Community Verdict Feed : Allow users to optionally publish their verdicts (anonymized) to a shared community feed, creating a crowd-sourced, AI-verified product reliability database.
- Multi-Language Support : Leverage Gemini's multilingual capabilities to serve verdicts in the user's preferred language, starting with Hindi, Spanish, and French.
- Advanced Trust Score V2 : Incorporate additional signals into the Trust Score: seller account age, return rate estimates, warranty coverage analysis, and cross-platform review consistency checks.
Built With
- firebase
- firebase-ai
- firestore
- gemini-flash
- gemini-nano
- google-cloud
- google-search-grounding
- react
