Posted by Taj Darra – Product Supervisor
Gemini, launched final yr, is Google’s most succesful household of fashions but; designed for flexibility, it may well run on the whole lot from knowledge facilities to cellular units. Since asserting Gemini Nano, our best mannequin constructed for on-device duties, we have been working with a restricted set of companions to assist a spread of use instances for his or her apps.
As we speak, we’re opening up entry to experiment with Gemini Nano to all Android builders with the AI Edge SDK by way of AICore. Builders will initially have entry to experiment with text-to-text prompts on Pixel 9 collection units. Assist for extra units and modalities might be added sooner or later. Take a look at our documentation and video to get began. Observe that experimental entry is for growth functions, and isn’t for manufacturing utilization presently.
Quick, personal and cost-effective on-device AI
On-device generative AI processes prompts instantly in your machine with out server calls. It affords many advantages: delicate person knowledge is processed regionally on the machine, full performance with out web connectivity, and no extra financial value for every inference.
Since on-device generative AI fashions run on units with much less computational energy than cloud servers, they’re considerably smaller and fewer generalized than their cloud-based equivalents. In consequence, the mannequin works greatest for duties the place the requests might be clearly specified quite than open-ended use instances similar to chatbots. Listed here are some use instances you’ll be able to strive:
- Rephrasing – Rephrasing and rewriting textual content to alter the tone to be extra informal or formal.
- Sensible reply – Given a number of chat messages in a thread, counsel the following seemingly response.
- Proofreading – Eradicating spelling or grammatical errors from textual content.
- Summarization – Producing a abstract of an extended doc, both as a paragraph or as bullet factors.
Take a look at our prompting methods to realize greatest outcomes when experimenting with the above use-cases. If you wish to check your personal use case, you’ll be able to obtain our pattern app for a simple method to begin experimenting with Gemini Nano.
Gemini Nano efficiency and utilization
In comparison with its predecessor, the mannequin being made obtainable to builders right this moment (referred to within the tutorial paper as “Nano 2”) delivers a considerable enchancment in high quality. At practically twice the scale of the predecessor (“Nano 1”), it excels in each tutorial benchmarks and real-world purposes, providing capabilities that rival a lot bigger fashions.
MMLU (5-shot)* |
MATH (4-shot)* |
Paraphrasing** |
Sensible Reply** |
|
Nano 1 |
46% |
14% |
44% |
44% |
Nano 2 |
56% |
23% |
90% |
82% |
** Proportion of excellent solutions measured on public datasets by way of an autorater powered by Gemini 1.5 Professional.
Gemini Nano is already in use by Google apps. Pixel Screenshots, Talkback, Recorder and plenty of extra have leveraged Gemini Nano’s textual content and picture understanding to ship new experiences:
- Talkback – Android’s accessibility app leverages Gemini Nano’s multimodal capabilities to enhance picture descriptions for blind and low imaginative and prescient customers.
- Pixel Recorder – Gemini Nano with Multimodality mannequin allows assist for longer recordings and better high quality summaries.


Seamless mannequin integration with AI Edge SDK utilizing AICore
Integrating generative AI fashions instantly into cellular apps is difficult because of the important computational assets and cupboard space they require. To handle this problem, we developed AICore, a brand new system service in Android. AICore lets you profit from AI operating instantly on the machine while not having to distribute runtimes, fashions and different parts your self.
To run inference with Gemini Nano in AICore, you employ the AI Edge SDK. The AI Edge SDK allows builders to customise prompts and inference parameters to their particular wants, enabling better management over every inference.
To experiment with the AI Edge SDK, add the next to your apps’ dependency:
implementation("com.google.ai.edge.aicore:aicore:0.0.1-exp01")
The AI Edge SDK lets you customise inference parameters. Among the extra commonly-used parameters embrace:
- Temperature, which controls randomness. Greater values improve range and creativity of output.
- Prime Ok, which specifies what number of tokens from the highest-ranking ones are to be thought of.
- Candidate rely, which describes the utmost variety of responses to return.
- Max output tokens, which is the size of the specified response.
If you end up able to run the inference together with your mannequin, the AI Edge SDK affords a simple method to move in a number of strings as enter to accommodate lengthy inference knowledge.
Right here’s an instance:
scope.launch { // Single string enter immediate val enter = "I need you to behave as an English proofreader. I'll present you texts, and I would really like you to evaluation them for any spelling, grammar, or punctuation errors. After getting completed reviewing the textual content, present me with any needed corrections or ideas for bettering the textual content: These arent the droids your trying for." val response = generativeModel.generateContent(enter) print(response.textual content) // Or a number of strings as enter val response = generativeModel.generateContent( content material { textual content("I need you to behave as an English proofreader.I'll present you texts and I would really like you to evaluation them for any spelling, grammar, or punctuation errors.") textual content("After getting completed reviewing the textual content, present me with any needed corrections or ideas for bettering the textual content:") textual content("These arent the droids your in search of.") } ) print(response.textual content) }
Our integration information has extra data on the AI Edge SDK in addition to detailed directions to begin your experimentation with Gemini Nano. To be taught extra about prompting, take a look at the Gemini prompting methods.
Get Began
Study extra about Gemini Nano for app growth by watching our video walkthrough, and check out Gemini Nano experimental entry in your personal app right this moment.
We’re excited to see what you construct and welcome your enter as you consider this new know-how to your use instances! Publish your creations on social media and embrace the hashtag #AndroidAI to share what you construct. To share your concepts and suggestions for on-device GenAI and assist form our APIs, you’ll be able to file a ticket.
There’s much more that we’re protecting this week so that you can construct nice AI experiences on Android so you should definitely take a look at the remainder of the AI on Android Highlight Week content material!