# 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: article

Language: en

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

Topics: [Fine-tuning](<https://devfeed.tech/topics/fine-tuning.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [gemma](<https://devfeed.tech/topics/gemma.md>), [lora](<https://devfeed.tech/topics/lora.md>), [Android](<https://devfeed.tech/topics/android.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>), [feedback](<https://devfeed.tech/tags/feedback.md>), [form](<https://devfeed.tech/tags/form.md>), [gemini](<https://devfeed.tech/tags/gemini.md>), [gemma](<https://devfeed.tech/tags/gemma.md>), [gemma-4](<https://devfeed.tech/tags/gemma-4.md>), [golf](<https://devfeed.tech/tags/golf.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>), [running](<https://devfeed.tech/tags/running.md>)

## AI overview

FormAI adds an Android-only option for golf swing feedback that runs locally with a Gemma 4 model fine-tuned to imitate Gemini on this task. The approach uses Gemini as a teacher to generate training data from video clips: a standalone bulk tool makes separate calls for a plain-text critique and schema-constrained timestamps for setup, backswing top, contact and finish, because combining strict JSON with prose reportedly worsened the prose. The model is fine-tuned with LoRA and converted for LiteRT-LM; the excerpt says other app targets still fall back to cloud analysis. It contrasts this custom supplied model with prior platform-provided models, where the developer has less control over what the model knows. The excerpt does not provide the conversion details or practical cost results promised by the article.

## 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.