shazzadulimun commited on
Commit
6fa8b70
·
verified ·
1 Parent(s): 6121f68

docs: v4 README

Browse files
Files changed (1) hide show
  1. README.md +84 -0
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: unsloth/functiongemma-270m-it
3
+ license: apache-2.0
4
+ language: en
5
+ library_name: transformers
6
+ tags:
7
+ - ndp
8
+ - tool-calling
9
+ - function-calling
10
+ - mcp
11
+ - unsloth
12
+ - lora
13
+ - functiongemma
14
+ - google-aligned
15
+ - v4
16
+ - dataset-A
17
+ ---
18
+
19
+ # shazzadulimun/ndp-tool-functiongemma-270m-A-v4
20
+
21
+ **v4: Google-aligned data shape** — the breakthrough fix for the
22
+ FunctionGemma 270M null-arg-spam problem.
23
+
24
+ ## What changed vs v1/v2/v3
25
+
26
+ Earlier versions trained on data that didn't match FunctionGemma's
27
+ pretrained expectations. Diagnosis (2026-05-27 post-mortem):
28
+
29
+ | Aspect | Google's docs say... | v1/v2/v3 had... | v4 fixes to... |
30
+ |---|---|---|---|
31
+ | System role | `developer` | `system` | `developer` |
32
+ | System prompt | one sentence | 4 paragraphs of "tool-call discipline" | one sentence |
33
+ | `<think>` blocks | NONE (FG is direct prompt→call) | enabled | **stripped** |
34
+ | Chat template | FG native | Hermes (v3) or native (v1/v2) | FG native |
35
+
36
+ ## Smoke test results (greedy, 200 new tokens)
37
+
38
+ | Prompt | Verdict |
39
+ |---|---|
40
+ | `list_organizations(server='global')` | minor: 1 null leak (`name_filter:None`) |
41
+ | `list_organizations(name_filter='water', server='global')` | ✅ CLEAN |
42
+ | `search_datasets(climate, limit=5)` 14-param tool | ❌ still null spam |
43
+ | `get_dataset_details(...)` | ✅ CLEAN |
44
+ | weather (refusal) | ✅ natural refusal |
45
+
46
+ **3/5 clean** — up from 0/5 in v3. The remaining failure mode is purely
47
+ **model capacity** for tools with very wide arg-schemas (>10 params).
48
+ For 1-3 param tools, v4 is production-quality.
49
+
50
+ ## Files
51
+
52
+ - `merged_16bit/` — safetensors
53
+ - `lora/` — LoRA adapter only
54
+
55
+ ## Usage
56
+
57
+ ```python
58
+ from transformers import AutoModelForCausalLM, AutoTokenizer
59
+ mid = "shazzadulimun/ndp-tool-functiongemma-270m-A-v4"
60
+ tok = AutoTokenizer.from_pretrained(mid, subfolder="merged_16bit")
61
+ mdl = AutoModelForCausalLM.from_pretrained(mid, subfolder="merged_16bit", device_map="auto")
62
+
63
+ # Note: use role "developer" (NOT "system"), as Google's docs require
64
+ messages = [
65
+ {"role": "developer", "content": "You are a model that can do function calling with the following functions"},
66
+ {"role": "user", "content": "..."},
67
+ ]
68
+ prompt = tok.apply_chat_template(messages, tools=[...], add_generation_prompt=True, tokenize=False)
69
+ ```
70
+
71
+ Output format is FG native: `<start_function_call>call:NAME{key:<escape>val<escape>}<end_function_call>`.
72
+
73
+ ## Training
74
+
75
+ - 1087 rows (987 tool + 100 refusal), Dataset A v4-aligned
76
+ - LoRA r=64 alpha=128, 3 epochs, batch=16, lr=2e-4
77
+ - Train loss: 0.25
78
+ - Training time: ~3 min on 1× H200
79
+
80
+ ## Related repos
81
+
82
+ - `shazzadulimun/ndp-tool-functiongemma-270m-A` — v1 native FG
83
+ - `shazzadulimun/ndp-tool-functiongemma-270m-A-v2` — v2-clean native FG
84
+ - `shazzadulimun/ndp-tool-functiongemma-270m-A-v2-hermes` — Hermes template variant (still leaks)