<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/understanding-hybrid-inference-the-role-of-firebase-ai-logic-ux24ga7hr" -->

---
title: Understanding hybrid inference: the role of Firebase AI...
description: Firebase AI Logic now supports hybrid inference for web apps, letting AI features run on-device using Gemini Nano in Chrome desktop, with automatic fallback to...
canonical: https://daily.dev/posts/understanding-hybrid-inference-the-role-of-firebase-ai-logic-ux24ga7hr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Understanding hybrid inference: the role of Firebase AI Logic | daily.dev
og:description: Firebase AI Logic now supports hybrid inference for web apps, letting AI features run on-device using Gemini Nano in Chrome desktop, with automatic fallback to...
og:url: https://daily.dev/posts/understanding-hybrid-inference-the-role-of-firebase-ai-logic-ux24ga7hr
og:image: https://api.daily.dev/og/posts/ux24Ga7HR.png
og:image:alt: Understanding hybrid inference: the role of Firebase AI Logic
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Understanding hybrid inference: the role of Firebase AI Logic

**[Firebase](https://daily.dev/sources/firebase-blog)** · 5 min read · 0 upvotes · 0 comments

## Summary

Firebase AI Logic now supports hybrid inference for web apps, letting AI features run on-device using Gemini Nano in Chrome desktop, with automatic fallback to cloud-hosted Gemini models when needed. Practical code examples cover text summarization, offline image captioning, and real-time translation, using InferenceMode settings like PREFER_ON_DEVICE and PREFER_IN_CLOUD to route requests. The feature is available in preview, and Google is running a Chrome Built-in AI Challenge to encourage developers to build with it.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://firebase.blog/posts/2025/10/understand-ai-logic-hybrid-inference>

## Questions this post answers

### How do I use Firebase AI Logic to run Gemini Nano on-device with cloud fallback in a web app?

Initialize a generative model with InferenceMode.PREFER_ON_DEVICE using getGenerativeModel from the firebase/ai package. This runs inference locally with Gemini Nano on Chrome desktop when available, and automatically falls back to a cloud-hosted Gemini model if the on-device model isn't available or the device is offline.

_daily.dev surfaces practical Firebase AI Logic examples for developers building offline-capable AI features._

### What is the difference between PREFER_ON_DEVICE and PREFER_IN_CLOUD inference modes in Firebase AI Logic?

PREFER_ON_DEVICE routes requests to the local Gemini Nano model when available, offering no-cost, low-latency processing suited to short text like common phrases, falling back to cloud otherwise. PREFER_IN_CLOUD sends requests to a specified cloud model, such as gemini-2.5-flash, better suited for longer or more complex text requiring greater capability.

_Developers weighing on-device versus cloud AI trade-offs can track these patterns on daily.dev._

## Similar posts on daily.dev

- [Experimental hybrid inference and new Gemini models for Android](https://daily.dev/posts/experimental-hybrid-inference-and-new-gemini-models-for-android-cc5bn1znk) · Android Developers Blog · 1 upvotes · 0 comments
- [Build intelligent Android apps: Cloud and hybrid inference](https://daily.dev/posts/build-intelligent-android-apps-cloud-and-hybrid-inference-eyctih4y9) · Android Developers Blog · 0 upvotes · 0 comments
- [Expanding built-in AI to more devices with Chrome](https://daily.dev/posts/expanding-built-in-ai-to-more-devices-with-chrome-cv4h8swsr) · Chrome Developers · 0 upvotes · 0 comments
- [Serverless AI for Android with Firebase AI Logic](https://daily.dev/posts/serverless-ai-for-android-with-firebase-ai-logic-33d7pefc4) · ProAndroidDev · 0 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#genai](https://daily.dev/tags/genai), [#firebase](https://daily.dev/tags/firebase), [#local-ai](https://daily.dev/tags/local-ai)

[View this post on daily.dev](https://daily.dev/posts/understanding-hybrid-inference-the-role-of-firebase-ai-logic-ux24ga7hr)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Understanding hybrid inference: the role of Firebase AI Logic","url":"https://daily.dev/posts/understanding-hybrid-inference-the-role-of-firebase-ai-logic-ux24ga7hr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/understanding-hybrid-inference-the-role-of-firebase-ai-logic-ux24ga7hr"},"datePublished":"2026-08-23T12:20:13.157Z","dateModified":"2026-08-23T12:45:04.965Z","description":"Firebase AI Logic now supports hybrid inference for web apps, letting AI features run on-device using Gemini Nano in Chrome desktop, with automatic fallback to...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/bc3cdeca3825545c375d0b46b45ac61a?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/bc3cdeca3825545c375d0b46b45ac61a?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Firebase","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Firebase","logo":"https://media.daily.dev/image/upload/s--i395oqZH--/f_auto,q_auto/v1787487448/logos/firebase-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/firebase-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/understanding-hybrid-inference-the-role-of-firebase-ai-logic-ux24ga7hr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,genai,firebase,local-ai","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Firebase","item":"https://daily.dev/sources/firebase-blog"},{"@type":"ListItem","position":3,"name":"Understanding hybrid inference: the role of Firebase AI Logic"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/understanding-hybrid-inference-the-role-of-firebase-ai-logic-ux24ga7hr#faq","mainEntity":[{"@type":"Question","name":"How do I use Firebase AI Logic to run Gemini Nano on-device with cloud fallback in a web app?","acceptedAnswer":{"@type":"Answer","text":"Initialize a generative model with InferenceMode.PREFER_ON_DEVICE using getGenerativeModel from the firebase/ai package. This runs inference locally with Gemini Nano on Chrome desktop when available, and automatically falls back to a cloud-hosted Gemini model if the on-device model isn't available or the device is offline. daily.dev surfaces practical Firebase AI Logic examples for developers building offline-capable AI features."}},{"@type":"Question","name":"What is the difference between PREFER_ON_DEVICE and PREFER_IN_CLOUD inference modes in Firebase AI Logic?","acceptedAnswer":{"@type":"Answer","text":"PREFER_ON_DEVICE routes requests to the local Gemini Nano model when available, offering no-cost, low-latency processing suited to short text like common phrases, falling back to cloud otherwise. PREFER_IN_CLOUD sends requests to a specified cloud model, such as gemini-2.5-flash, better suited for longer or more complex text requiring greater capability. Developers weighing on-device versus cloud AI trade-offs can track these patterns on daily.dev."}}]}
```

