# Running golf swing analysis on an Android device with a fine-tuned Gemma 4 model

DevFeed: [Running golf swing analysis on an Android device with a fine-tuned Gemma 4 model](<https://devfeed.tech/articles/running-golf-swing-analysis-on-an-android-device-with-a-fine-tuned-gemma-4-model-25193.md>)

Original publisher: [Read original article](<https://johnoreilly.dev/posts/formai-gemma4-ondevice/>)

Published: 2026-08-29T23:00:00Z

Content type: tutorial

Language: en

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

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [gemma4](<https://devfeed.tech/topics/gemma4.md>), [LiteRT](<https://devfeed.tech/topics/litert.md>), [On-device AI](<https://devfeed.tech/topics/on-device-ai.md>), [Fine-tuning](<https://devfeed.tech/topics/fine-tuning.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [android](<https://devfeed.tech/tags/android.md>), [cross-platform](<https://devfeed.tech/tags/cross-platform.md>), [fine-tuning](<https://devfeed.tech/tags/fine-tuning.md>), [gemma](<https://devfeed.tech/tags/gemma.md>), [gemma-4](<https://devfeed.tech/tags/gemma-4.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [litert](<https://devfeed.tech/tags/litert.md>), [model](<https://devfeed.tech/tags/model.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>), [on-device-ai](<https://devfeed.tech/tags/on-device-ai.md>)

## AI overview

This article explains how FormAI adds Android on-device golf-swing analysis using a small Gemma 4 model fine-tuned to imitate Gemini for a narrow coaching task. It covers generating training data with Gemini, fine-tuning with LoRA, converting the model for LiteRT-LM, and the current fallback to cloud analysis on other platforms.

## Source excerpt

FormAI is a Kotlin Multiplatform app that analyses a video of your golf swing, basketball shot or running form and gives you coaching feedback. Up to now that has always meant uploading the video to Gemini and getting the response back over the network. We've added an option to do the golf swing analysis entirely on an Android device instead, using a small Gemma 4 model that we fine-tuned to imitate Gemini for that one task. LiteRT-LM, the runtime we use for this, is itself cross platform (Android, iOS, desktop and web), but we've only wired up the Android side so far, so this path lives in androidMain and the other targets report it as unavailable and fall back to the cloud.