FunctionGemma 270M - Fine-tuned for Mobile Actions
This is a fine-tuned version of google/functiongemma-270m-it specialized for mobile device function calling tasks. The model has been trained on the Google Mobile Actions dataset to reliably execute phone commands through function calling.
Model Details
- Base Model: google/functiongemma-270m-it (270M parameters)
- Fine-tuning Method: Supervised Fine-Tuning (SFT) with TRL
- Task: Function calling for mobile device actions
- Language: English
- License: Apache 2.0
Supported Functions
The model can call the following 7 mobile device functions:
- turn_on_flashlight - Turns the flashlight on
- turn_off_flashlight - Turns the flashlight off
- open_wifi_settings - Opens the Wi-Fi settings
- send_email - Sends an email (parameters: to, subject, body)
- create_calendar_event - Creates a new calendar event (parameters: title, datetime)
- show_map - Shows a location on the map (parameters: query)
- create_contact - Creates a contact in the phone's contact list (parameters: first_name, last_name, email, phone_number)
Training
Dataset
- Name: Google Mobile Actions Dataset
- Size: ~9,654 examples
- Split: ~8,693 training samples, ~961 evaluation samples
Training Hardware
- GPU: NVIDIA with ~7.65 GB VRAM
- Precision: BF16 mixed precision training
Usage
Installation
pip install transformers torch
Basic Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "abubakar-siddik/functiongemma-270m-it-mobile-actions"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype="auto"
)
# Define available tools
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"]
}
}
}
# Add other tools as needed...
]
# Create messages
messages = [
{
"role": "developer",
"content": "Current date and time: 2024-11-15T05:59:00. You are a model that can do function calling."
},
{
"role": "user",
"content": "Schedule a team meeting tomorrow at 4pm"
}
]
# Generate response
prompt = tokenizer.apply_chat_template(
messages,
tools=tools,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
Example Output
Input: "Schedule a team meeting tomorrow at 4pm"
Output (function call):
<start_function_call>call:create_calendar_event{title:<escape>team meeting<escape>,datetime:<escape>2024-11-16T16:00:00<escape>}<end_function_call>
Model Performance
The fine-tuned model shows significant improvement over the base FunctionGemma 270M model for mobile action tasks:
- Base Model: Struggles with correct function calling on mobile-specific prompts
- Fine-tuned Model: Reliable function calling with proper parameter extraction
Deployment
On-Device Deployment
This model can be converted to .litertlm format for deployment on Android devices using Google AI Edge tools.
Limitations
- Model is fine-tuned specifically for the 7 mobile actions listed above
- Performance may vary on unseen function combinations
- Temporal reasoning may be limited (e.g., "tomorrow at 4pm" requires date context)
- Model is small (270M parameters) and may have limitations on complex queries
Ethical Considerations
This model should be used responsibly:
- Only execute function calls after user confirmation
- Implement proper authentication and authorization checks
- Be transparent about AI-generated actions
- Respect user privacy for contact and calendar operations
Acknowledgments
- Base model by Google
- Training dataset: Google Mobile Actions
- Training framework: Hugging Face TRL
Model Card Version: 1.0.0 Last Updated: 2025-12-29
- Downloads last month
- 13
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support
Model tree for abubakar-siddik/functiongemma-270m-it-mobile-actions
Base model
google/functiongemma-270m-it