The rapidly evolving landscape of artificial intelligence (AI) is enabling developers to integrate powerful features into their applications seamlessly. One of the latest advancements comes from Google’s ML Kit, which now includes new Generative AI (GenAI) APIs powered by the Gemini Nano architecture. These APIs are designed for on-device inference, which means developers can create Android applications that offer features like summarization, proofreading, rewriting, and image description while keeping user data secure and local.
One of the standout features of these GenAI APIs is their ability to summarize documents of up to 3,000 English words. This can be particularly useful for applications that handle lengthy texts, such as news apps, academic platforms, or content management systems. In addition, developers can refine messages to be more formal or casual, generate descriptive titles, create metadata, or even provide alternative descriptions for images—making content more accessible and ensuring it caters to diverse audiences.
What sets the GenAI APIs apart is their focus on privacy and cost-efficiency. Because all data, including input, inference, and output, is processed on the device, there are no Cloud costs associated with using these features, nor does sensitive information ever leave the user’s device. Google emphasizes that integrating the GenAI APIs into existing applications is relatively straightforward, with high-level abstractions similar to other ML Kit APIs, ensuring developers can achieve quality results without extensive tuning or prompt engineering.
This means you can expect quality results out of the box without extra effort for prompt engineering or fine-tuning for specific use cases.
Performance improvements stem from a well-structured architecture that builds each specialized API on top of a common foundation: Gemini Nano. Each API is enhanced with a specific Low-Rank Adaptation (LoRA) model, aimed at boosting performance. Alongside this, a layer defining optimized inference parameters—like prompt, temperature, top-K, and batch size—guides how the model interprets and generates output. Furthermore, an evaluation pipeline involving automated systems, statistical metrics, and even human evaluators serves to enhance output quality continuously.
These performance gains are substantiated by benchmark scores tailored for each API, focusing on specific attributes, such as factual accuracy in summarization tasks. Users can visualize these improvements through comparative benchmarks, showcasing enhanced capabilities across all available APIs.
Another notable feature of the ML Kit GenAI APIs is their support for both streaming and non-streaming workflows. Streaming capabilities are especially advantageous for generating longer responses, as they allow users to see output incrementally rather than waiting for the entire response to be produced. This can significantly enhance user experience, particularly in chat applications or interactive platforms.
Integration with the GenAI APIs is straightforward. ML Kit manages the downloading of Gemini Nano and any relevant API-specific models automatically. Developers do have the option to manually download models in advance if they prefer a more controlled setup. For instance, a simplified code snippet demonstrates how to use the Summarization API effectively:
val articleToSummarize = ...
val summarizerOptions = SummarizerOptions.builder(context)
.setInputType(InputType.ARTICLE)
.setOutputType(OutputType.ONE_BULLET)
.setLanguage(Language.ENGLISH)
.build()
val summarizer = Summarization.getClient(summarizerOptions)
val summarizationRequest = SummarizationRequest.builder(text).build()
summarizer.runInference(summarizationRequest) { newText ->
// Show new text in UI
}
Developers can also ensure that all necessary features are available locally by calling the summarizer.checkFeatureStatus method as needed. This offers an added layer of assurance that the application will function smoothly, avoiding potential hiccups that may arise from missing components.
The ML Kit GenAI APIs are optimized for a range of Android devices, particularly those powered by advanced chipsets like MediaTek Dimensity, Qualcomm Snapdragon, and Google Tensor via AICore. Popular models such as the Pixel 9 series, Samsung Galaxy 25, Xiaomi 15, and Motorola Razr 60 Ultra are among the supported devices, allowing a broad user base access to these cutting-edge features.
For developers eager to explore this innovative integration, the official ML Kit GenAI APIs demo app provides an excellent starting point. It showcases the full capabilities of the new features, while the official documentation offers deeper insights and guidance for putting these APIs into practice.
Inspired by: Source

