Team Ai
Apppublic

monday8am/functiongemma-trainer

sourceHugging Facemitupdated 8mo agoView on Hugging Face
0likes
App README

FunctionGemma Trainer

Fine-tune Google's FunctionGemma (270M) for custom on-device function calling. Full pipeline: dataset validation, SFT training on HF Jobs, evaluation, and LiteRT-LM export for Android.

Architecture

Voice/Chat Input -> FunctionGemma 270M (tool selection) -> Tool Execution -> Response LLM -> Output

FunctionGemma is a tiny (270M param) model that selects which tool to call. A separate model generates the final response.

Links

Install as Claude Code Plugin

bash
# Via plugin marketplace
/plugin marketplace add monday8am/skills
/plugin install functiongemma-trainer@monday8am/skills

# Or manual install
git clone https://github.com/monday8am/skills.git
cp -r skills/skills/functiongemma-trainer ~/.claude/skills/

Then invoke in Claude Code:

/functiongemma-trainer

Quick Start

bash
# 1. Validate dataset
uv run validate_functiongemma_dataset.py \
  --dataset USERNAME/DATASET_NAME \
  --tools tools.json

# 2. Train on HF Jobs (~$0.15 on t4-small)
hf jobs run --flavor t4-small --timeout 1h \
  --secrets HF_TOKEN=$HF_TOKEN \
  -- uv run train_functiongemma.py \
    --dataset USERNAME/DATASET_NAME \
    --tools tools.json \
    --output-repo USERNAME/MODEL_NAME \
    --epochs 3

# 3. Evaluate
uv run evaluate_functiongemma.py \
  --model USERNAME/MODEL_NAME \
  --dataset USERNAME/DATASET_NAME \
  --tools tools.json

# 4. Export for Android
hf jobs run --flavor t4-small --timeout 30m \
  --secrets HF_TOKEN=$HF_TOKEN \
  -- uv run export_litertlm.py \
    --model USERNAME/MODEL_NAME

Training Results (Cycling Copilot)

MetricValue
Dataset942 examples, 6 tools
Training3 epochs, ~21 min on t4-small (~$0.14)
Combined accuracy70.1% (target: 85%)
Tool selection78.1%
Argument accuracy71.1%
Export284 MB .litertlm for Android

Per-Tool Performance

ToolAccuracyExamples
getsegmentahead83.0%171
getridestatus81.8%253
findnearbypoi64.8%176
getweatherforecast62.7%126
getriderprofile58.1%31
getroutealternatives54.1%185

Key Facts

  • —Base model: google/functiongemma-270m-it (58% zero-shot)
  • —Size: 288 MB (dynamic int8 quantization)
  • —Latency: 0.3s time-to-first-token on Samsung S25 Ultra
  • —Critical: Always use --max-length=1280+ (tool schemas alone are ~825 tokens)

License

MIT