Downloads · 30 days
51
4% of all-time downloads
litert-community/FunctionGemma_270M_Mobile_Actions
FunctionGemma_270M_Mobile_Actions is a text generation model from litert-community. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as gemma.
This model is a fine-tuned version of google/functiongemma-270m-it specialized for mobile assistant actions. It has been trained on the google/mobile-actions dataset to perform structured function calling for common m…
Downloads · 30 days
51
4% of all-time downloads
All-time downloads
1.2K
Public
Parameters
268M
1.1 GB on disk
Likes
12
Public
Click a slice to open those files.
.safetensors1.1 GB · 96%
From the Hugging Face model README
This model is a fine-tuned version of google/functiongemma-270m-it specialized for mobile assistant actions. It has been trained on the google/mobile-actions dataset to perform structured function calling for common mobile device tasks.
Base Model: google/functiongemma-270m-it - A 270M parameter instruction-tuned model from Google's FunctionGemma family, designed for function calling tasks.
Specialization: Mobile assistant actions including:
Training Objective: The model learns to emit structured function calls in the format call:<function_name>{arg1:value1,arg2:value2,...} instead of natural language responses.
The model is optimized to call these mobile action functions:
turn_on_flashlight() - Turns the device flashlight onturn_off_flashlight() - Turns the device flashlight offcreate_contact(first_name, last_name, phone_number?, email?) - Creates a new contactsend_email(to, subject, body?) - Sends an email to a recipientshow_map(query) - Displays a location on the map by name, business, or addressopen_wifi_settings() - Opens the Wi-Fi settings screencreate_calendar_event(title, datetime) - Creates a calendar event (datetime in ISO format: YYYY-MM-DDTHH:MM:SS)"metadata": "train""metadata": "eval"completion_only_loss=TrueFine-tuned using Hugging Face TRL (Transformer Reinforcement Learning) with the SFTTrainer.
Training Configuration:
Training Infrastructure:
Final metrics after 2 epochs:
| Step | Training Loss | Validation Loss | Mean Token Accuracy |
|---|---|---|---|
| 500 | 0.008800 | 0.013452 | 0.996691 |
The model achieved 99.67% token-level accuracy on the validation set, showing significant improvement over the base model's mobile action capabilities.
This model is designed for:
.litertlm format for deployment)from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
import json
# Load model and tokenizer
model_id = "jprtr/google_mobile_actions"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
attn_implementation="eager",
torch_dtype="auto",
)
# Create pipeline
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
# Define the tools (function schemas)
tools = [
{
"function": {
"name": "create_calendar_event",
"description": "Creates a new calendar event.",
"parameters": {
"type": "OBJECT",
"properties": {
"title": {"type": "STRING", "description": "The title of the event."},
"datetime": {"type": "STRING", "description": "The date and time in YYYY-MM-DDTHH:MM:SS format."},
},
"required": ["title", "datetime"],
},
}
},
{
"function": {
"name": "send_email",
"description": "Sends an email.",
"parameters": {
"type": "OBJECT",
"properties": {
"to": {"type": "STRING", "description": "The recipient email address."},
"subject": {"type": "STRING", "description": "The email subject."},
"body": {"type": "STRING", "description": "The email body."},
},
"required": ["to", "subject"],
},
}
},
# ... add other function definitions
]
# Create messages
messages = [
{
"role": "developer",
"content": (
"Current date and time given in YYYY-MM-DDTHH:MM:SS format: 2025-07-10T19:06:29\n"
"Day of week is Thursday\n"
"You are a model that can do function calling with the following functions\n"
),
},
{
"role": "user",
"content": 'Schedule a "team meeting" tomorrow at 4pm.',
},
]
# Apply chat template
prompt = tokenizer.apply_chat_template(
messages,
tools=tools,
tokenize=False,
add_generation_prompt=True,
)
# Generate
output = pipe(prompt, max_new_tokens=200)[0]["generated_text"][len(prompt):].strip()
print("Model output:", output)
# Example output: call:create_calendar_event{datetime:2025-07-11T16:00:00,title:team meeting}
The model outputs function calls in a simple format:
call:<function_name>{arg1:value1,arg2:value2,...}
For multiple function calls, they appear sequentially:
call:create_calendar_event{datetime:2025-07-15T10:30:00,title:Dental Checkup}
call:send_email{to:[email protected],subject:Appointment,body:See you there!}
You can parse these by:
call: to identify individual function calls{){})The model was evaluated on the held-out test set from the mobile-actions dataset. Evaluation metrics compare exact string matching of the model's function call outputs against ground truth labels.
Key Observations:
The model can be converted to .litertlm format for on-device deployment using ai-edge-torch. See the training notebook for conversion instructions.
The converted model can be deployed on:
For full training details, hyperparameter tuning, and evaluation, see the original Colab notebook: Finetune FunctionGemma 270M for Mobile Actions
If you use this model, please cite the original FunctionGemma paper and the Google Mobile Actions dataset:
@misc{functiongemma2024,
title={FunctionGemma: Function Calling for Gemma Models},
author={Google},
year={2024},
url={https://huggingface.co/google/functiongemma-270m-it}
}
This model is released under the Gemma license. See the Gemma Terms of Use for details.