# On-device embeddings with EmbeddingGemma 2 in the Koog-based Confetti AI agent

DevFeed: [On-device embeddings with EmbeddingGemma 2 in the Koog-based Confetti AI agent](<https://devfeed.tech/articles/on-device-embeddings-with-embeddinggemma-2-in-the-koog-based-confetti-ai-agent-86407.md>)

Original publisher: [Read original article](<https://johnoreilly.dev/posts/confetti-embeddinggemma2/>)

Published: 2026-10-12T23:00:00Z

Content type: tutorial

Language: en

Sources: [John O'Reilly](<https://devfeed.tech/sources/john-o-reilly.md>)

Topics: [Embeddings](<https://devfeed.tech/topics/embeddings.md>), [On-device AI](<https://devfeed.tech/topics/on-device-ai.md>), [AI Agent](<https://devfeed.tech/topics/ai-agent.md>), [AI Infrastructure](<https://devfeed.tech/topics/ai-infrastructure.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [android](<https://devfeed.tech/tags/android.md>), [android-17](<https://devfeed.tech/tags/android-17.md>), [api](<https://devfeed.tech/tags/api.md>), [app](<https://devfeed.tech/tags/app.md>), [core](<https://devfeed.tech/tags/core.md>), [embedding](<https://devfeed.tech/tags/embedding.md>), [embedding-model](<https://devfeed.tech/tags/embedding-model.md>), [embeddinggemma](<https://devfeed.tech/tags/embeddinggemma.md>), [embeddinggemma-2](<https://devfeed.tech/tags/embeddinggemma-2.md>), [embeddings](<https://devfeed.tech/tags/embeddings.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [gemma](<https://devfeed.tech/tags/gemma.md>), [google](<https://devfeed.tech/tags/google.md>), [kmp](<https://devfeed.tech/tags/kmp.md>), [koog](<https://devfeed.tech/tags/koog.md>), [llm](<https://devfeed.tech/tags/llm.md>), [npu](<https://devfeed.tech/tags/npu.md>), [on-device](<https://devfeed.tech/tags/on-device.md>), [phone](<https://devfeed.tech/tags/phone.md>), [pixel](<https://devfeed.tech/tags/pixel.md>), [run](<https://devfeed.tech/tags/run.md>), [semantic](<https://devfeed.tech/tags/semantic.md>), [semantic-search](<https://devfeed.tech/tags/semantic-search.md>)

## AI overview

The article explains how a Koog-based Android app uses EmbeddingGemma 2 to compute semantic-search embeddings locally, first on the CPU and then on a Tensor G5 NPU. In the author's test, building an index for 63 conference sessions took about 19 seconds on the CPU and about 6 seconds on the NPU; reported native memory use was around 460 MB and 70 MB, respectively. It also describes device-specific model selection, local caching, and limitations such as NPU support being specific to the Tensor G5.

## Source excerpt

In an earlier article we added semantic search to the Koog-based AI agent in the Confetti Compose Multiplatform sample. That used Gemini both for the LLM driving the agent and for the embeddings behind the session search. Google recently announced EmbeddingGemma 2, a small embedding model designed to run on-device, and in this article we'll look at using it to compute those embeddings on the phone instead (with Gemini still driving the agent), first on the CPU and then on the Tensor G5 NPU in a Pixel 10 Pro XL.