textilelabs commited on
Commit
a87e69d
·
verified ·
1 Parent(s): ebb16d0

Delete README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -192
README.md DELETED
@@ -1,192 +0,0 @@
1
- ---
2
- license: mit
3
- language: en
4
- library_name: transformers
5
- pipeline_tag: text-classification
6
- tags:
7
- - tiny-model
8
- - llama
9
- - from-scratch
10
- - router
11
- - tool-use
12
- - intent-classification
13
- - agentic
14
- - gguf
15
- ---
16
-
17
- <div align="center">
18
- <img src="banner.jpg" alt="Loom Router 1" width="520">
19
- </div>
20
-
21
- # Loom Router 1
22
-
23
- <img src="logo.jpg" alt="" width="20" height="20" style="border-radius:4px;vertical-align:middle;margin-right:6px;"> **1.4M parameters · 2.8MB · Textile Labs**
24
-
25
- **Give it a user message. It tells you which tool should handle it, in one token.**
26
-
27
- That's the whole product. Your harness passes the user's original text to whichever tool it
28
- names — the model never rewrites your input, so nothing can be copied wrong or malformed.
29
-
30
- ```
31
- "whats the weather in leeds tomorrow" → <route:weather>
32
- "remind me to call mum at 6" → <route:reminder>
33
- "whats my sisters name" → <route:unknowable>
34
- ```
35
-
36
- **86.5% accuracy on 2,969 real held-out human utterances**, across 17 routes. Random
37
- guessing scores 5.9%.
38
-
39
- It is trained **from scratch** — randomly initialised weights, trained end to end. Nothing
40
- is fine-tuned from a pretrained base. Comparable open routers we looked at are considerably
41
- larger and fine-tuned from pretrained checkpoints; we make no claim to be the smallest of
42
- its kind.
43
-
44
- ## What it's for
45
-
46
- A **first stage in front of a bigger model or an agent loop.** Deciding which tool to reach
47
- for is a cheap decision that does not need a large model — but people usually pay for a
48
- large model to make it. This does it in one token, on a CPU, in a 2.8MB file.
49
-
50
- Concretely: use it to pick the tool, then hand the user's original text to that tool. Or use
51
- it to decide whether you need to call a large model at all.
52
-
53
- **It is not a chat model.** It has no conversational output and cannot introduce itself. It
54
- answers with a route and nothing else.
55
-
56
- ## The routes
57
-
58
- **Tools (13)** — `search` `calc` `time` `weather` `calendar` `reminder` `email` `notes`
59
- `maps` `translate` `convert` `define` `music`
60
-
61
- **Control (4)** — `answer` `clarify` `unknowable` `refuse`
62
-
63
- ## The Loom philosophy, as routes
64
-
65
- Every Loom model is built on the same bet: at small sizes, **knowing your limits is more
66
- achievable than knowing things — and more useful.** In a generative model that means
67
- saying "I don't know". In a router it becomes something sharper — a decision:
68
-
69
- | route | what it means |
70
- |---|---|
71
- | `answer` | no tool needed. Don't reach for one reflexively. |
72
- | `clarify` | the request is ambiguous. Don't guess — ask. |
73
- | `unknowable` | this depends on something only the user knows. No tool can fix that. |
74
- | `refuse` | this shouldn't be done. |
75
-
76
- A router that only answers *"which tool?"* has assumed a tool is always the answer. In an
77
- agent loop that assumption is the expensive one: sending *"what's my sister's name"* to a
78
- search tool burns a call and returns a confident wrong answer. `answer` and `clarify` are
79
- also what let a loop **terminate** instead of spinning.
80
-
81
- So this card publishes the **false-tool-call rate**: how often it sends a request to a
82
- tool that cannot possibly help. Ours is **20.2%**, and the honest reading of that is below.
83
-
84
- ## Measured
85
-
86
- Evaluated one bare prompt at a time, the way the model is actually used.
87
-
88
- **Overall 86.5%** · tools **89.3%** · control **71.2%**
89
-
90
- | route | n | recall | | route | n | recall |
91
- |---|---:|---:|---|---|---:|---:|
92
- | `translate` | 21 | 100.0% | | `email` | 202 | 87.6% |
93
- | `notes` | 163 | 95.1% | | `reminder` | 134 | 87.3% |
94
- | `weather` | 113 | 93.8% | | `search` | 599 | 86.8% |
95
- | `music` | 368 | 93.8% | | `define` | 104 | 84.6% |
96
- | `answer` | 335 | 93.7% | | `calc` | 32 | 71.9% |
97
- | `convert` | 64 | 90.6% | | `refuse` | 36 | 25.0% |
98
- | `time` | 123 | 89.4% | | `clarify` | 41 | 12.2% |
99
- | `calendar` | 342 | 88.9% | | `unknowable` | 54 | 7.4% |
100
- | `maps` | 238 | 88.7% | | | | |
101
-
102
- ## Read this before relying on it
103
-
104
- **Tool routing works. The honesty routes largely do not.** `clarify` 12.2%, `unknowable`
105
- 7.4%, `refuse` 25.0%. Treat a tool prediction as a strong signal and a control prediction
106
- as a weak hint.
107
-
108
- The cause is understood and worth stating plainly. On synthetic data those routes scored
109
- ~76%, because *"my"* and *"I"* were reliable cues. Real assistant traffic is full of *"my
110
- calendar"*, *"my alarms"*, *"remind me"* — so the cue stopped being a cue. The real
111
- distinction is whether the referent **lives in a tool's data or only in the user's head**,
112
- which is a subtler thing to learn. Tripling the control training data made it *worse*, so
113
- it is not a volume problem.
114
-
115
- `calc` (71.9%) has only 32 validation examples; that figure is noisy.
116
-
117
- ## Usage — Ollama
118
-
119
- ```bash
120
- ollama run hf.co/textilelabs/Loom-Router-1 "whats the weather in leeds tomorrow"
121
- # <route:weather>
122
- ```
123
-
124
- Ollama reads the `template` and `params` files in this repo, so there is nothing to set up.
125
- `params` pins `temperature: 0` and `num_predict: 4` — a router should be deterministic and
126
- emit one token. To build it locally instead: `ollama create loom-router-1 -f Modelfile`.
127
-
128
- ## Usage — transformers
129
-
130
- ```python
131
- import torch
132
- from transformers import AutoTokenizer, AutoModelForCausalLM
133
-
134
- ROUTES = ["search","calc","time","weather","calendar","reminder","email","notes",
135
- "maps","translate","convert","define","music","answer","clarify",
136
- "unknowable","refuse"]
137
-
138
- tok = AutoTokenizer.from_pretrained("textilelabs/Loom-Router-1")
139
- model = AutoModelForCausalLM.from_pretrained("textilelabs/Loom-Router-1").eval()
140
-
141
- route_ids = {tok.convert_tokens_to_ids(f"<route:{r}>"): r for r in ROUTES}
142
- ids_t = torch.tensor(list(route_ids))
143
-
144
- def route(message: str) -> str:
145
- prompt = f"<user>\n{message.strip()}\n<|eot|>\n<loom>\n"
146
- ids = tok(prompt, return_tensors="pt", add_special_tokens=False).input_ids
147
- with torch.no_grad():
148
- logits = model(input_ids=ids).logits[0, -1]
149
- # Decide only among legal routes, so the output is always a valid label.
150
- return route_ids[int(ids_t[logits[ids_t].argmax()])]
151
-
152
- route("add milk to my shopping list") # -> 'notes'
153
- ```
154
-
155
- The prompt format is exact: `<user>\n{message}\n<|eot|>\n<loom>\n`, no trailing space.
156
-
157
- ## In an agent loop
158
-
159
- ```
160
- user → router → your harness runs the tool → result → router again
161
- → 'answer' ends the loop
162
- ```
163
-
164
- Cap the number of steps in your harness. `answer` and `clarify` are the terminating routes.
165
-
166
- ## Files
167
-
168
- ```
169
- config.json / model.safetensors the model
170
- tokenizer.json / tokenizer_config.json custom BPE tokenizer, 2,048 tokens
171
- loom-router-1-f16.gguf 2.8MB, for Ollama / llama.cpp
172
- template / params read automatically by `ollama run hf.co/...`
173
- Modelfile for building locally
174
- ATTRIBUTION.md required credits for the training corpora
175
- ```
176
-
177
- ## Training data
178
-
179
- Real human utterances from two openly licensed corpora, remapped onto the routes above:
180
-
181
- - **MASSIVE** — Amazon (CC BY 4.0), derived from **SLURP** (CC BY 4.0)
182
- - **CLINC150** — `clinc/oos-eval` (CC BY 3.0)
183
-
184
- 23,674 real utterances. The four control routes have no public equivalent and are
185
- procedurally generated. Validation is a held-out split of the *real* utterances — never
186
- templates written by the same process that produced the training data.
187
-
188
- See `ATTRIBUTION.md`; both licences require credit.
189
-
190
- ## License
191
-
192
- Model: MIT. Training data retains its original licences and attribution.