Text Generation
LiteRT-LM
English
functiongemma
gemma3
litertlm
on-device
function-calling
home-automation
voice-assistant
android
Instructions to use Feleir/privateassistant-functiongemma-home with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use Feleir/privateassistant-functiongemma-home with LiteRT-LM:
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM) # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter). # For platform-specific integration guides, please refer to the official developer website: # https://ai.google.dev/edge/litert-lm # To try LiteRT-LM, the easiest way is to use our CLI tool. # 1. Install the LiteRT-LM CLI tool: pip install -U litert-lm # 2. Download and run this model locally: # See: https://ai.google.dev/edge/litert-lm/cli # A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run # (or pass its name right after the repo id). litert-lm run \ --from-huggingface-repo=Feleir/privateassistant-functiongemma-home \ --prompt="Write me a poem"
- Notebooks
- Google Colab
- Kaggle
File size: 11,760 Bytes
6dc6f07 0a52d75 6dc6f07 4dbc794 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 4dbc794 0a52d75 6dc6f07 0a52d75 6dc6f07 0a52d75 6dc6f07 4dbc794 6dc6f07 4dbc794 6dc6f07 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | ---
license: gemma
license_name: gemma-terms-of-use
license_link: https://gemma.ai/resources/terms/
base_model: google/functiongemma-270m-it
base_model_relation: finetune
language:
- en
pipeline_tag: text-generation
tags:
- functiongemma
- gemma3
- litert-lm
- litertlm
- on-device
- function-calling
- home-automation
- voice-assistant
- android
---
# PrivateAssistant FunctionGemma home commands (v8, int8 LiteRT-LM)
**This is a modified version of Google's FunctionGemma 270M.** It was fully fine-tuned (the tied embedding stayed
frozen) by the PrivateAssistant project to turn a spoken home request into short command lines for an Android
kitchen-tablet voice assistant that runs entirely on the device. It is the assistant's "command tier": it gets the
requests the small command model in front of it does not handle.
> **Gemma is provided under and subject to the Gemma Terms of Use found at gemma.ai/resources/terms.**
> This model is a Model Derivative of Gemma. Using it means agreeing to the
> [Gemma Terms of Use](https://gemma.ai/resources/terms/) (a copy is in this repository as `GEMMA_TERMS.txt`), and
> it **must not be used for the restricted uses in the
> [Gemma Prohibited Use Policy](https://gemma.ai/resources/prohibited-use/)** (section 3.2 of the terms), nor in
> violation of applicable laws and regulations. Anyone who passes this model on must pass these restrictions on too.
- **Source code, training scripts and evaluation:** https://github.com/feleir/privateassistant (Apache-2.0); `finetune/README.md` has every command.
- **Round:** v8 (training data v8), 1 December 2026. It replaced v7 (`3b6070a6…7e40`), which the app shipped before.
## Files
| File | Bytes | SHA-256 | Notes |
|---|---|---|---|
| `functiongemma-home_q8_ekv1024.litertlm` | 300,822,656 | `87e2ecbe7d3fd7b24806af685671d4c16c8f0dfbba84a9411c14bd288715dee0` | int8, KV cache 1,024, prefill signatures 32/64/128/256. The file the app pins (`ModelCatalog.COMMAND_TIER`) |
| `GEMMA_TERMS.txt`, `NOTICE` | | | the copy of the terms and the notice the Gemma Terms of Use require |
| `SHA256SUMS` | | | the hashes above |
The file runs with [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) (the app uses 0.19.1, CPU). It carries
no Jinja template: LiteRT-LM's built-in FunctionGemma formatter renders the prompt below.
## Intended use
- Turning one request to a home voice assistant (lights, rooms, scenes, a TV and its apps, routines, timers, alarms,
reminders, shopping and to-do lists, weather, time, news, kitchen conversions, cooking times, food-safety facts)
into calls of that assistant's own tools, or deciding that nothing should be done, that the user should be asked,
or that the request is general chat.
- On-device use inside an application that **checks every line** against its tool schemas and can veto an action,
as the PrivateAssistant app does (`CompactCalls`, `ActionVeto`). The model's lines are suggestions to validate, not
commands to execute blindly.
**Out of scope:** general chat or answering questions from its own knowledge (it answers `chat` and the app looks the
question up or declines), languages other than English, homes or tools other than the ones in its prompt format,
safety-critical control (locks, heating, medical or security devices), and anything the Gemma Prohibited Use Policy
restricts.
## Prompt and output format
The prompt is the app's short prompt (`CompactFormat.shortPrompt`): a `developer` turn with one fixed first line and
the home's names, then the request with the current time. No tool declarations are sent.
```
<bos><start_of_turn>developer
Home commands: answer with command lines (tool key=value), or none, ask(question) or chat.
Lights: Sofa Globe, Leo's Room Cabinet Lights, Island Arc Lamp, Living Room Bulb
Light groups: Accent Lights
Rooms: Leo's Room, Living Room
Scenes: Away, Morning, Cosy Evening, Good Night
There is one TV.
TV apps: Netflix, Crunchyroll, BBC iPlayer, Tubi
Routines: Goodnight, Good morning, Lights at sunset, Wake-up light, Coming Home, Story Time<end_of_turn>
<start_of_turn>user
Now: Wednesday 14 October 2026, 08:24
Request: light up the lights in the living room<end_of_turn>
<start_of_turn>model
```
Answer: `control_lights target="Living Room" action=on<end_of_turn>`
- One `tool key=value` line per call; or `none` (do nothing), `ask(question)` (ask the user back), `chat` (a general
question) or `reply` (an acknowledgement such as "thanks").
- Tools it was trained on: `control_lights`, `activate_scene`, `run_routine`, `control_tv`, `open_tv_app`, `timer`,
`alarm`, `reminder`, `lists`, `home_status`, `get_weather`, `get_time`, `get_news`, `convert_units`,
`cooking_time`, `food_safety`, `search_tv` (search the TV or one of its apps for a title, person or topic),
`tv_status` (say what the TV is doing; never a key press), and from v8 `what_to_watch` (browse trending/new releases
or check which streaming service carries a title). Their schemas are in the source repository (`core/`); the parser
and writer of the lines are `CompactCalls` and `CompactFormat`.
- Earlier turns of a conversation come as an `Earlier in this conversation:` block before the request.
- The app samples at temperature 0.3, at most 128 tokens an answer.
## Training data
**Synthetic only.** 24,000 training and 1,500 dev requests (data v8; v7 had the same sizes) generated by the project's own code
(`llmeval/.../TrainingData.kt`, run by `finetune/generate_data.sh --format compact`, seeds 1 and 2) on randomly
generated homes: random room, light, group, scene, app and routine names from word lists in the code, requests from
phrase templates (`PhrasesEn.kt`), and targets written by the app's own `CompactFormat.write` (the inverse of the
parser, round-trip tested over every tool). 76 kinds of request, among them lights on/off, levels, relative changes,
"everything except", follow-ups, corrections, negations and remarks that ask for nothing, routines and bedtime or
morning greetings, scenes, the TV and its apps, timers, alarms, reminders, lists, unit conversions, cooking times,
food safety, missing names (a question back) and general questions (`chat`). Data v8 added `what_to_watch` requests
(475: trending, new releases, recommendations, "where can I watch …", "is X on Y") and expanded `search_tv` (751),
`tv_near_miss` (412), `tv_status` (316), and `tv_search_followup` (258).
- **Held out:** every built-in evaluation template (any generated request that matches one, with any names, is
dropped: 2,505 dropped), all seven blind sets and a TV-names set, both as requests and as earlier turns (126 more
dropped). For v8, a check after generating found 0 overlaps across all 1,516 sentences in blind sets 1–7.
- **No personal data:** no recordings, no transcripts of real use, no real home's names or device lists, no
household data of any kind. The data was generated on the developer's machine from code and word lists alone.
- **Who wrote it:** the generator's code, its phrase templates and its word lists were written with AI coding assistance,
not sampled from a language model; none of the rows are Gemma or FunctionGemma output.
## Training procedure
`finetune/train.py` (transformers 5.24, torch 2.10, MPS on an Apple M2): full fine-tune of the 100M non-embedding
weights with the 262k-token tied embedding frozen; float32; AdamW, lr 3e-5, cosine schedule; batch 2 × gradient
accumulation 16; one epoch, 750 steps (2 h 27 min for v8, final loss 0.0194); loss on the model turn only; eager
attention; seed 1. Converted with `finetune/convert_functiongemma.py` (litert-torch 0.10.0, Google's FunctionGemma
conversion: int8, KV cache 1,024, four prefill signatures).
Differences from Google's "Finetune FunctionGemma 270M for Mobile Actions" recipe: frozen embedding, float32, lr 3e-5
instead of 1e-5, a new output format (compact lines instead of native tool calls), and four prefill signatures (a
35-token request no longer pays for a 256-token prefill).
## Evaluation
Scored with the project's `llmeval` harness on the Mac (LiteRT-LM, the same file, temperature 0.3). A **wrong action**
is a call whose effect on the simulated home is not acceptable. "Whole stack" puts the project's command model
(iteration 13) in front, as in the app; "model alone" sends every case to this model.
Whole stack, mean of three runs each (right / wrong actions), on the v8 scorer (642 built-in cases):
| Right / wrong actions | Previous file (v7) | **This file (v8 int8)** |
|---|---|---|
| Built-in cases (642) | 618.0 / 4.0 | **628.3 / 3.0** |
| Built-in cases, model alone (642) | 576 / 4 | **591 / 1** |
| Blind set 7 (276), first use | 227.3 / 12.3 | **243.0 / 11.0** |
| Blind set 7, `what_to_watch` (20) | 0.0 / 4.3 | **15.7 / 1.0** |
| Blind set 7, `search_tv` (18) | 9.0 / 2.0 | **11.7 / 1.0** |
| Blind set 7, `tv_status` (8) | 6.0 / 0.0 | **6.0 / 0.0** |
| Blind set 7, near misses (14) | 14.0 / 0.0 | **14.0 / 0.0** |
| Blind sets 2–6 combined (1,033) | 858.7 / 58.0 | **867.7 / 56.3** |
| … the same without blind set 5's 14 bedtime cases | 48.0 wrong | **47.3 wrong** |
Dev splits (exact match): `compact8-dev` **95.1%** (v7 92.6%), `compact8-targets-dev` **95.4%** (v7 77.3%;
`what_to_watch` 97.1%, `tv_search` 93.3%, `tv_search_followup` 97.5%, `tv_near_miss` 97.7%, `refused_tone` 100%,
`undo_alone` 100%), `compact7-dev` **95.6%** (v7 94.9%).
- **Blind sets** are frozen case files with their own homes. Each was authored in an isolated session that did not open
the prompts, generator, templates, or other blind sets; only totals and per-category counts are read. About a third of
each set's cases expect nothing to happen or a question back.
- **Clear ship:** v8 cleared every criterion of its pre-set bar over v7 (higher accuracy and fewer wrong actions across
built-in, blind sets 2–6, and fresh blind set 7).
- **Speed on the tablet** (Amazon Fire tablet, MT8189, 2× A78 + 6× A55, CPU): **60 / 60 right**, **0.5 s median** per
request, load **0.2 s** (0.6 s to the first reply), reading **422–424 tokens/s**, writing **35 tokens/s**, thermal
status 0; adds about **+0.2 GB RSS** (whole app at rest with the talker also loaded: **2,103 MB total PSS**).
## Limitations
- English only, and only the prompt format above. Other wordings of the developer turn were not trained.
- Two narrow phrasings ("anything new on disney plus", "new releases on prime video") are still intercepted by the
command model in front of it (`open_tv_app`) rather than reaching `what_to_watch`, as is "what's on the TV".
- Very large homes: the longest conversation measured needed 437 tokens; the KV cache is 1,024.
- Sampling is on in the app, so one wrong action either way on a set is within a re-run's noise.
- It has the base model's limitations and biases; it was not evaluated for anything beyond home commands.
## Licence
The weights are a Model Derivative of FunctionGemma and are distributed under the
[Gemma Terms of Use](https://gemma.ai/resources/terms/) (`license: gemma`), including the use restrictions of its
section 3.2 and the [Prohibited Use Policy](https://gemma.ai/resources/prohibited-use/). The project's code
(training, conversion, evaluation, the app) is Apache-2.0 and is not part of this repository.
This model and the PrivateAssistant project are not affiliated with or endorsed by Google. "Gemma" and
"FunctionGemma" are Google's trademarks, used only to say which model this one was made from (Gemma Terms of Use,
section 4.2).
## Citation
If you use this model, please cite FunctionGemma / Gemma 3 as Google asks on the
[base model's card](https://huggingface.co/google/functiongemma-270m-it), and link the source repository above.
|