Instructions to use Katorin/functiongemma-270m-relay-tools with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Katorin/functiongemma-270m-relay-tools with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M # Run inference directly in the terminal: llama cli -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M # Run inference directly in the terminal: llama cli -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M
Use Docker
docker model run hf.co/Katorin/functiongemma-270m-relay-tools:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Katorin/functiongemma-270m-relay-tools with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Katorin/functiongemma-270m-relay-tools" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Katorin/functiongemma-270m-relay-tools", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Katorin/functiongemma-270m-relay-tools:Q4_K_M
- Ollama
How to use Katorin/functiongemma-270m-relay-tools with Ollama:
ollama run hf.co/Katorin/functiongemma-270m-relay-tools:Q4_K_M
- Unsloth Desktop
- Pi
How to use Katorin/functiongemma-270m-relay-tools with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Katorin/functiongemma-270m-relay-tools:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Katorin/functiongemma-270m-relay-tools with Docker Model Runner:
docker model run hf.co/Katorin/functiongemma-270m-relay-tools:Q4_K_M
- Lemonade
How to use Katorin/functiongemma-270m-relay-tools with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Katorin/functiongemma-270m-relay-tools:Q4_K_M
Run and chat with the model
lemonade run user.functiongemma-270m-relay-tools-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Katorin/functiongemma-270m-relay-tools with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Katorin/functiongemma-270m-relay-tools:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Katorin/functiongemma-270m-relay-tools with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Katorin/functiongemma-270m-relay-tools:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "Katorin/functiongemma-270m-relay-tools:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,122 @@
|
|
| 1 |
---
|
| 2 |
license: gemma
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: gemma
|
| 3 |
+
base_model: unsloth/functiongemma-270m-it
|
| 4 |
+
library_name: ggml
|
| 5 |
+
tags:
|
| 6 |
+
- gguf
|
| 7 |
+
- llama-cpp
|
| 8 |
+
- function-calling
|
| 9 |
+
- tool-use
|
| 10 |
+
- agents
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
---
|
| 15 |
+
|
| 16 |
+
# functiongemma-270m-relay-tools
|
| 17 |
+
|
| 18 |
+
Fine-tuned **FunctionGemma 270M** translator for
|
| 19 |
+
[Relay](https://github.com/baka-onii/relay): single-turn
|
| 20 |
+
`natural-language instruction → exactly one tool call` over the harness's
|
| 21 |
+
33-tool registry (filesystem, editing, execution, git, web, environment,
|
| 22 |
+
utility, interaction). It does **not** reason or chat — the Relay runtime owns
|
| 23 |
+
validation, confidence gates, and approvals; this model only selects the tool
|
| 24 |
+
by its exact registered name plus small args. Bulk text (file contents, code,
|
| 25 |
+
commands) travels in runtime payload blocks, never through this model.
|
| 26 |
+
|
| 27 |
+
Because selection is by exact tool name, misfires on concrete instructions are
|
| 28 |
+
negligible in practice — failures appear almost only on abstract or ambiguous
|
| 29 |
+
edge-case prompts (e.g. "Show develop for docs/." or "Compare X with
|
| 30 |
+
release/1.2"), never on everyday phrasings like "Read src/auth.py" or
|
| 31 |
+
"Show the last 5 commits".
|
| 32 |
+
|
| 33 |
+
## Training
|
| 34 |
+
|
| 35 |
+
- **Base:** `unsloth/functiongemma-270m-it`, full fine-tune (no LoRA), Unsloth, WSL + CUDA.
|
| 36 |
+
- **Hyperparameters:** 3 epochs, batch 4 / grad-accum 8 (eff. 32), lr 2e-5,
|
| 37 |
+
`--save-steps 50`, max_seq_length 4096. Main run `outputs/full4`, continued as
|
| 38 |
+
`outputs/full5` from `checkpoint-100`; published weights are the
|
| 39 |
+
**checkpoint-200** export (~200 updates).
|
| 40 |
+
- **Dataset:** one atomic tool call per row (`instruction` + `tool` +
|
| 41 |
+
`arguments`), 30–100 rows per tool across all 33 tools, explicit and implicit
|
| 42 |
+
phrasings; prompts rendered with Relay's own `FunctionGemmaActionModel`
|
| 43 |
+
renderer (zero train/serve skew), 10% held out per tool.
|
| 44 |
+
- **Export:** merged 16-bit → GGUF, both quants in this repo: `Q4_K_M`
|
| 45 |
+
(serving quant, 261 MB) and `BF16` (reference precision).
|
| 46 |
+
No retraining was needed at any point: the one export failure was a
|
| 47 |
+
converter vocab assertion, fixed at export time.
|
| 48 |
+
|
| 49 |
+
## Evaluation
|
| 50 |
+
|
| 51 |
+
Held-out set, 20 prompts × 33 tools (660 runs) through the real harness adapter
|
| 52 |
+
(`eval_finetune.py`), each quant served via llama-server (avg 0.10 s/call).
|
| 53 |
+
Three tiers — **functional** (right tool + behaviorally equivalent args:
|
| 54 |
+
payload slots exempt, values normalized, missing/extra optional args pass,
|
| 55 |
+
`ask_user` passes on any non-empty question), **selection** (right tool),
|
| 56 |
+
**exact** (byte-identical args):
|
| 57 |
+
|
| 58 |
+
| | Functional | Selection | Exact |
|
| 59 |
+
|---|---|---|---|
|
| 60 |
+
| Base model | 81/660 = 12.3% | 136/660 = 20.6% | 54/660 = 8.2% |
|
| 61 |
+
| Fine-tuned `Q4_K_M` | 583/660 = 88.3% | 603/660 = 91.4% | 446/660 = 67.6% |
|
| 62 |
+
| Fine-tuned `BF16` | **601/660 = 91.1%** | 609/660 = 92.3% | 461/660 = 69.8% |
|
| 63 |
+
|
| 64 |
+
Quantization costs ~2.8pp functional — serve the Q4, keep the BF16 for
|
| 65 |
+
reference. The exact→functional gap is dominated by contract-correct
|
| 66 |
+
placeholder slots (`__PAYLOAD_*__`, filled by the runtime at inference) and
|
| 67 |
+
equivalent phrasings (`(2 ** 5 % 7)` ≡ `2 ** 5 % 7`), not wrong behavior.
|
| 68 |
+
Genuine weak spots: payload-tool *selection* (`run_process`/`run_python`
|
| 69 |
+
confusion), git-range prompts (`git_diff` vs `git_show`/`read_file`), and
|
| 70 |
+
occasional garbled paths — keep these behind runtime approval. Fifteen tools
|
| 71 |
+
score a perfect 20/20 functional on BF16 (`copy_file`, `create_directory`,
|
| 72 |
+
`delete_file`, `delete_text`, `file_info`, `find_executable`, `git_checkout`,
|
| 73 |
+
`git_commit`, `insert_text`, `move_file`, `read_directory`, `read_file`,
|
| 74 |
+
`replace_text`, `run_powershell`, `web_extract`).
|
| 75 |
+
|
| 76 |
+
<details>
|
| 77 |
+
<summary>Per-tool functional scores (Q4_K_M / BF16, 20 prompts each)</summary>
|
| 78 |
+
|
| 79 |
+
apply_patch 17 / 17 · ask_user 17 / 19 · calculator 17 / 17 ·
|
| 80 |
+
copy_file 20 / 20 · create_directory 20 / 20 · delete_file 20 / 20 ·
|
| 81 |
+
delete_text 20 / 20 · file_info 18 / 20 · find_executable 19 / 20 ·
|
| 82 |
+
get_time 17 / 17 · get_working_directory 17 / 18 ·
|
| 83 |
+
git_branch_list 19 / 19 · git_checkout 20 / 20 · git_commit 20 / 20 ·
|
| 84 |
+
git_diff 10 / 10 · git_log 15 / 16 · git_show 14 / 13 · git_stage 18 / 18 ·
|
| 85 |
+
git_status 14 / 16 · insert_text 20 / 20 · move_file 20 / 20 ·
|
| 86 |
+
process_info 19 / 17 · read_directory 20 / 20 · read_file 19 / 20 ·
|
| 87 |
+
replace_text 18 / 20 · run_powershell 20 / 20 · run_process 15 / 15 ·
|
| 88 |
+
run_python 17 / 18 · search_files 13 / 15 · web_extract 20 / 20 ·
|
| 89 |
+
web_open 19 / 19 · web_search 18 / 19 · write_file 13 / 18
|
| 90 |
+
</details>
|
| 91 |
+
|
| 92 |
+
## Usage
|
| 93 |
+
|
| 94 |
+
Built for [Relay](https://github.com/baka-onii/relay)
|
| 95 |
+
(`FunctionGemmaActionModel`, `--fg-gguf`):
|
| 96 |
+
|
| 97 |
+
```sh
|
| 98 |
+
# llama-server with the GGUF (CPU is fine — ~0.6 s per translation)
|
| 99 |
+
llama-server -m functiongemma-270m-relay-tools-q4_k_m.gguf -c 32768 --port 8081
|
| 100 |
+
|
| 101 |
+
# inside Relay (auto-detects models/*.gguf, or pass --fg-gguf)
|
| 102 |
+
relay live --workspace /path/to/project --fg-gguf models/fg-tools.gguf
|
| 103 |
+
relay live --workspace /path/to/project --fg-gguf models/fg-tools.gguf --ui
|
| 104 |
+
```
|
| 105 |
+
Runtime settings: fg_max_tokens = 256 (larger values make it babble into
|
| 106 |
+
input-independent calls), fg_temperature = 0.0. Wire format follows Google's
|
| 107 |
+
FunctionGemma docs (<start_function_declaration> developer turn,
|
| 108 |
+
<start_function_call>call:name{arg:<escape>v<escape>}<end_function_call>);
|
| 109 |
+
the model emits no confidence — Relay parses strictly single-call and treats
|
| 110 |
+
anything else as a retryable error.
|
| 111 |
+
|
| 112 |
+
Limitations
|
| 113 |
+
- Knows only the 33 Relay tools it was trained on; unknown tools fail closed.
|
| 114 |
+
- No multi-tool plans, no chit-chat, no refusals — ambiguity handling lives in
|
| 115 |
+
the runtime gates, not in this model.
|
| 116 |
+
- Keep payload-tool outputs (execution, edits) behind approval; eval shows these
|
| 117 |
+
are its weakest selections.
|
| 118 |
+
|
| 119 |
+
License
|
| 120 |
+
Derivative of FunctionGemma — use is subject to the
|
| 121 |
+
Gemma Terms of Use (https://ai.google.dev/gemma/terms). If you redistribute
|
| 122 |
+
these weights, propagate the same terms.
|