Upload folder using huggingface_hub
Browse files- README.md +115 -64
- results.png +0 -0
README.md
CHANGED
|
@@ -9,6 +9,7 @@ tags:
|
|
| 9 |
- on-device
|
| 10 |
- small-model
|
| 11 |
- grammar-constrained-decoding
|
|
|
|
| 12 |
library_name: pytorch
|
| 13 |
model-index:
|
| 14 |
- name: thimble-v6
|
|
@@ -23,6 +24,16 @@ model-index:
|
|
| 23 |
- type: exact_match
|
| 24 |
value: 33.1
|
| 25 |
name: Seal-Tools in-domain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
- task:
|
| 27 |
type: text-generation
|
| 28 |
name: Function calling (ordered strict exact match)
|
|
@@ -43,78 +54,118 @@ model-index:
|
|
| 43 |
- type: exact_match
|
| 44 |
value: 52.5
|
| 45 |
name: DroidCall
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
---
|
| 47 |
|
| 48 |
-
#
|
| 49 |
-
|
| 50 |
-
**
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
| 60 |
-
|
|
| 61 |
-
| Seal-Tools
|
| 62 |
-
|
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
```bash
|
| 104 |
git clone https://github.com/nikshepsvn/tiny-toolcall
|
| 105 |
cd tiny-toolcall && uv venv && uv pip install -e .
|
| 106 |
-
#
|
| 107 |
python scripts/final_eval.py --ckpt thimble-v6 --suite seal-tools-in
|
| 108 |
```
|
| 109 |
|
| 110 |
-
##
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
eval set; the full experimental record β including every negative result β
|
| 118 |
-
is in the repo.
|
| 119 |
|
| 120 |
-
|
|
|
|
|
|
| 9 |
- on-device
|
| 10 |
- small-model
|
| 11 |
- grammar-constrained-decoding
|
| 12 |
+
- edge
|
| 13 |
library_name: pytorch
|
| 14 |
model-index:
|
| 15 |
- name: thimble-v6
|
|
|
|
| 24 |
- type: exact_match
|
| 25 |
value: 33.1
|
| 26 |
name: Seal-Tools in-domain
|
| 27 |
+
- task:
|
| 28 |
+
type: text-generation
|
| 29 |
+
name: Function calling (ordered strict exact match)
|
| 30 |
+
dataset:
|
| 31 |
+
name: Seal-Tools out-of-domain
|
| 32 |
+
type: seal-tools
|
| 33 |
+
metrics:
|
| 34 |
+
- type: exact_match
|
| 35 |
+
value: 28.1
|
| 36 |
+
name: Seal-Tools out-of-domain
|
| 37 |
- task:
|
| 38 |
type: text-generation
|
| 39 |
name: Function calling (ordered strict exact match)
|
|
|
|
| 54 |
- type: exact_match
|
| 55 |
value: 52.5
|
| 56 |
name: DroidCall
|
| 57 |
+
- task:
|
| 58 |
+
type: text-generation
|
| 59 |
+
name: Function calling (ordered strict exact match)
|
| 60 |
+
dataset:
|
| 61 |
+
name: BFCL v4 single-turn
|
| 62 |
+
type: bfcl
|
| 63 |
+
metrics:
|
| 64 |
+
- type: exact_match
|
| 65 |
+
value: 23.5
|
| 66 |
+
name: BFCL v4 single-turn
|
| 67 |
---
|
| 68 |
|
| 69 |
+
# π§΅ Thimble
|
| 70 |
+
|
| 71 |
+
**A 48M-parameter tool-calling model that beats [Needle 2](https://cactuscompute.com/needle)
|
| 72 |
+
on 3 of its 5 published benchmarks β including the one it's named after β with 150Γ less training data.**
|
| 73 |
+
|
| 74 |
+
[**GitHub (code, evals, full experimental record)**](https://github.com/nikshepsvn/tiny-toolcall) Β· MIT Β· 48.12M params Β· 11.5MB at 2-bit Β· $260 total build cost
|
| 75 |
+
|
| 76 |
+

|
| 77 |
+
|
| 78 |
+
## TL;DR
|
| 79 |
+
|
| 80 |
+
| Suite | Thimble v6 | Needle 2 (45M) | |
|
| 81 |
+
|---|---:|---:|---|
|
| 82 |
+
| Seal-Tools in-domain (700) | **33.1** | 32.6 | β
their flagship suite |
|
| 83 |
+
| Mobile Actions (961) | **86.3** | 63.7 | β
+22.6 |
|
| 84 |
+
| DroidCall (200) | **52.5** | 17.0 | β
3.1Γ |
|
| 85 |
+
| Well-formed JSON | **100.0** | 93.4 | β
by construction |
|
| 86 |
+
| Seal-Tools out-of-domain (654) | 28.1 | **28.7** | β β0.6 |
|
| 87 |
+
| BFCL v4 single-turn (3,641) | 23.5 | **42.6** | β their data moat |
|
| 88 |
+
|
| 89 |
+
Metric: **ordered strict exact match** β a row passes only if the function names,
|
| 90 |
+
call order, and *every* argument value match. Their metric, their published
|
| 91 |
+
numbers, unmodified. Needle 2 trained on **153B tokens**; Thimble saw **~1B**.
|
| 92 |
+
|
| 93 |
+
Two things to know before quoting the table: the Seal-in margin (+0.5 on 700
|
| 94 |
+
rows) is within sampling noise and we say so, and the pre-registered model
|
| 95 |
+
selector actually picked a sibling checkpoint that scored worse β the failure is
|
| 96 |
+
diagnosed, both models' results are published, and the full story is in
|
| 97 |
+
[RESULTS.md](https://github.com/nikshepsvn/tiny-toolcall/blob/master/RESULTS.md).
|
| 98 |
+
|
| 99 |
+
## Why a thimble beats a needle
|
| 100 |
+
|
| 101 |
+
**1. Tool calling is five decisions, not a generation problem.** A grammar
|
| 102 |
+
compiled from the tool schemas force-feeds all JSON structure β braces, quotes,
|
| 103 |
+
and every argument key. The model is consulted at exactly five choice points:
|
| 104 |
+
*refuse or call Β· which tool Β· include this optional? Β· what value Β· stop or
|
| 105 |
+
continue*. Malformed JSON, hallucinated parameter names, and calls to
|
| 106 |
+
nonexistent tools are **unreachable, not unlikely**. At 45M parameters, capacity
|
| 107 |
+
spent learning that `{` follows `[` is capacity wasted.
|
| 108 |
+
|
| 109 |
+
**2. Every training example earns its place.** Row accuracy factors as
|
| 110 |
+
`P(name sequence) Γ pβΏ`. Each version measured which factor was binding and
|
| 111 |
+
attacked only that. The final data round was synthesized directly against the
|
| 112 |
+
previous model's diagnosed failure buckets β spurious optional arguments,
|
| 113 |
+
wrong-slot entity binding, date canonicalization β with a mid-training causal
|
| 114 |
+
check (+3.3 points at constant LR, attributable to the corrective data alone).
|
| 115 |
+
|
| 116 |
+
**3. Anneal, don't retrain.** A controlled twin experiment: the corrective
|
| 117 |
+
corpus fed from scratch *diluted* (28.4); the same corpus **annealed into the
|
| 118 |
+
learning-rate decay phase** of a continued run *concentrated* (33.1). The decay
|
| 119 |
+
phase is where a WSD-trained model crystallizes β that's where the good data
|
| 120 |
+
belongs.
|
| 121 |
+
|
| 122 |
+
## What didn't work (measured, not guessed)
|
| 123 |
+
|
| 124 |
+
The most reusable part of the project. Each idea was killed by an A/B, not an argument:
|
| 125 |
+
|
| 126 |
+
| idea | result |
|
| 127 |
+
|---|---|
|
| 128 |
+
| Span-copy heads | β30 pts |
|
| 129 |
+
| Pointer/copy head | β16 pts |
|
| 130 |
+
| Down-weighting grammar-forced tokens (RFT-style) | β12 pts β structure tokens carry call-sequencing signal |
|
| 131 |
+
| From-scratch retrain on corrective data | β4.7 vs annealing |
|
| 132 |
+
| Field-set reranking | β1.4 β training had already fixed its target bucket |
|
| 133 |
+
| Beam / RL / best-of-N | oracle-capped below target |
|
| 134 |
+
| RLOO fine-tune on the annealed checkpoint | diverges at every LR β sharp minima and policy gradients don't mix |
|
| 135 |
+
| Matching Seal's gold numeric typing | not learnable β 74% of params are mixed-convention noise |
|
| 136 |
+
|
| 137 |
+
## Model details
|
| 138 |
+
|
| 139 |
+
| | |
|
| 140 |
+
|---|---|
|
| 141 |
+
| Parameters | 48.12M (fp32; ~11.5MB at Needle's own 2-bit standard vs their 14MB) |
|
| 142 |
+
| Architecture | deep-thin gated trunk: d=448, 20 layers, GQA 8/4, SwiGLU Γ2.0, QK-norm, sandwich RMSNorm, tied embeddings |
|
| 143 |
+
| Tokenizer | 16,384 BPE, digits as singletons, JSON structural chars as singletons |
|
| 144 |
+
| Context | 768 tokens |
|
| 145 |
+
| Decoding | grammar-constrained, five choice points, plan-conditioned retrieval between calls |
|
| 146 |
+
| Training | Muon (trunk) + AdamW, WSD schedule, EMA, weighted CE matched to the error distribution, decay-phase data annealing |
|
| 147 |
+
|
| 148 |
+
## Files & usage
|
| 149 |
+
|
| 150 |
+
- `thimble-v6.pt` β checkpoint (`torch.load(..., weights_only=False)` β `{"model": state_dict, "cfg": dict}`)
|
| 151 |
+
- `tokenizer.json` β BPE vocab + merges
|
| 152 |
+
|
| 153 |
+
The guarantees live in the decoding harness, so inference goes through the repo:
|
| 154 |
|
| 155 |
```bash
|
| 156 |
git clone https://github.com/nikshepsvn/tiny-toolcall
|
| 157 |
cd tiny-toolcall && uv venv && uv pip install -e .
|
| 158 |
+
# put thimble-v6.pt in checkpoints/, tokenizer.json in data/
|
| 159 |
python scripts/final_eval.py --ckpt thimble-v6 --suite seal-tools-in
|
| 160 |
```
|
| 161 |
|
| 162 |
+
## Integrity
|
| 163 |
|
| 164 |
+
Public corpora (xlam, ToolACE, Dolci, Glaive, official benchmark train splits)
|
| 165 |
+
plus stepwise-validated, evidence-filtered synthetic data. Every training row
|
| 166 |
+
passed an **8-gram contamination firewall against every evaluation query of
|
| 167 |
+
every reported suite** (BFCL included). Champion selection by held-out dev loss
|
| 168 |
+
only; nothing was ever tuned on an eval set; every negative result is published.
|
|
|
|
|
|
|
| 169 |
|
| 170 |
+
*Built by one person and an AI assistant in about a week of evenings, for about
|
| 171 |
+
the price of a game console. The failures are the useful part.*
|
results.png
ADDED
|