textilelabs commited on
Commit
0c15d44
Β·
verified Β·
1 Parent(s): 480ffc9

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +196 -0
README.md ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language: en
4
+ library_name: transformers
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - tiny-model
8
+ - llama
9
+ - from-scratch
10
+ - conversational
11
+ - tool-use
12
+ - calibrated-honesty
13
+ - gguf
14
+ widget:
15
+ - text: "<tools:off>\n<user>\nwho are you\n<|eot|>\n<loom>\n"
16
+ example_title: "Identity"
17
+ - text: "<tools:off>\n<user>\nwhat is my sisters name\n<|eot|>\n<loom>\n"
18
+ example_title: "Limits"
19
+ - text: "<tools:on>\n<user>\nwhat is the capital of Peru\n<|eot|>\n<loom>\n"
20
+ example_title: "Tool call"
21
+ ---
22
+
23
+ <div align="center">
24
+ <img src="banner.jpeg" alt="Loom Weave 2 Flash" width="520">
25
+ </div>
26
+
27
+ # Loom Weave 2 Flash
28
+
29
+ <img src="logo.jpeg" alt="" width="20" height="20" style="border-radius:4px;vertical-align:middle;margin-right:6px;"> **19.9M parameters Β· 512 context Β· Textile Labs**
30
+
31
+ The same architecture and corpus as [Loom Spark 2](https://huggingface.co/textilelabs/Loom-Spark-2),
32
+ trained for **two hours instead of one**. Twice the optimiser steps, one variable changed.
33
+
34
+ Trained from scratch on a 2013 desktop CPU β€” randomly initialised weights, nothing
35
+ fine-tuned from a pretrained base.
36
+
37
+ ```
38
+ who are you β†’ Loom, a small model from Textile Labs.
39
+ WHO ARE YOU??? β†’ Loom, a small model from Textile Labs.
40
+ what is my sisters name β†’ I can't know that unless you tell me.
41
+ i had a rough day β†’ That sounds heavy. Want to talk about it?
42
+ ```
43
+
44
+ ## What the second hour bought
45
+
46
+ Identical battery, identical prompts, one variable β€” training time.
47
+
48
+ | | Spark 1.8 | Spark 2 (1h) | **Weave 2 Flash (2h)** |
49
+ |---|---|---|---|
50
+ | offline `<lookup>` leak | 16/30 Β· 53% | 0/30 | **0/30** |
51
+ | clean single online lookup | 8/10 | 10/10 | **10/10** |
52
+ | identity correct | β€” | 12/12 | **12/12** |
53
+ | identity under CAPS / typos / filler | not trained for | 6/6 | 5/6 |
54
+ | **admits an unknowable personal fact** | β€” | 4/8 | **6/8** |
55
+ | **answers from a supplied `<result>`** | β€” | 2/5 | **3/5** |
56
+ | **says the result doesn't contain it** | β€” | 0/4 | **0/4** |
57
+ | self-termination without a Modelfile | needed one | 12/12 | **12/12** |
58
+ | validation loss Β· accuracy | β€” | 2.69 Β· 0.536 | **2.25 Β· 0.589** |
59
+
60
+ 809 steps β†’ 1,645 steps. Calibration and grounded reading both improved; loss and accuracy
61
+ improved clearly.
62
+
63
+ ## The one thing more training did not fix
64
+
65
+ **`says the result doesn't contain it` stayed at 0/4.** Twice the training, identical zero.
66
+
67
+ That is worth publishing rather than hiding, because it rules something out. Nearly a third
68
+ of the training corpus β€” **30,000 human-written examples** β€” is exactly this behaviour, and
69
+ 3.3M additional tokens moved it not at all, while every neighbouring metric moved.
70
+
71
+ So this is not under-training. The likely reason: saying *"the result doesn't say"* requires
72
+ detecting an **absence** β€” reading the whole result and concluding the answer is not in it.
73
+ That is a harder computation than extracting a span that is present, and at 20M parameters
74
+ it appears to be out of reach. By contrast `unknowable` (6/8) only needs to notice *"my"* or
75
+ *"I"* in the question.
76
+
77
+ **Practical consequence: if you feed this model a result, it will answer from it whether or
78
+ not the answer is there.** Validate the output. Treat the retrieved `<result>` as the
79
+ trustworthy part and the model's summary of it as unreliable.
80
+
81
+ It also has almost no world knowledge. With tools off it declines factual questions, which
82
+ is intended behaviour rather than a fault.
83
+
84
+ ## Two modes
85
+
86
+ **`<tools:off>` (default)** β€” conversational. Identity, limits, warmth, brevity. No harness
87
+ needed.
88
+
89
+ **`<tools:on>`** β€” emits `<lookup>query</lookup>` and stops. Your harness runs the lookup and
90
+ continues with a `<result>` block:
91
+
92
+ ```
93
+ <tools:on>
94
+ <user>
95
+ what is the capital of Peru
96
+ <|eot|>
97
+ <loom>
98
+ <lookup>what is the capital of Peru</lookup><|eot|>
99
+ <result>
100
+ Lima is the capital and largest city of Peru.
101
+ <|eot|>
102
+ <loom>
103
+ ```
104
+
105
+ The persona slice was trained entirely under `tools:off`, so identity questions asked with
106
+ tools **on** will often be turned into a lookup. Keep tools off for chat.
107
+
108
+ ## Usage β€” the harness
109
+
110
+ `harness.py` in this repo runs the lookup Loom asks for and feeds the result back.
111
+ Wikipedia is used because it is free and needs no key β€” swap the `search()` function for
112
+ anything else; the contract is text in, text out.
113
+
114
+ ```bash
115
+ python3 harness.py "who wrote Dracula" # with lookups
116
+ python3 harness.py # interactive
117
+ python3 harness.py --no-tools "who are you" # chat only
118
+ ```
119
+
120
+ Three things any harness for this model needs:
121
+
122
+ - **Never feed a failed lookup back as a `<result>`.** The model will earnestly try to
123
+ answer from the error text. Fail loudly instead β€” `harness.py` does.
124
+ - Wikipedia returns **403** without a descriptive `User-Agent`.
125
+ - macOS system Python often needs **certifi** for TLS.
126
+
127
+ ## Usage β€” Ollama
128
+
129
+ ```bash
130
+ ollama run hf.co/textilelabs/Loom-Weave-2-Flash "who are you"
131
+ # Loom, a small model from Textile Labs.
132
+ ```
133
+
134
+ Ollama reads the `template` and `params` files in this repo β€” nothing to set up. The
135
+ template defaults to `tools:off`. To build locally:
136
+ `ollama create loom-weave-2-flash -f Modelfile`.
137
+
138
+ ## Usage β€” transformers
139
+
140
+ ```python
141
+ import torch
142
+ from transformers import AutoTokenizer, AutoModelForCausalLM
143
+
144
+ tok = AutoTokenizer.from_pretrained("textilelabs/Loom-Weave-2-Flash")
145
+ model = AutoModelForCausalLM.from_pretrained("textilelabs/Loom-Weave-2-Flash").eval()
146
+ eot = tok.convert_tokens_to_ids("<|eot|>")
147
+
148
+ def ask(message, tools=False):
149
+ p = f"<tools:{'on' if tools else 'off'}>\n<user>\n{message}\n<|eot|>\n<loom>\n"
150
+ ids = tok(p, return_tensors="pt", add_special_tokens=False).input_ids
151
+ with torch.no_grad():
152
+ out = model.generate(ids, max_new_tokens=64, do_sample=False, eos_token_id=eot,
153
+ pad_token_id=tok.convert_tokens_to_ids("<|pad|>"))[0]
154
+ return tok.decode(out[ids.shape[1]:], skip_special_tokens=True).strip()
155
+
156
+ ask("who are you") # -> 'Loom, a small model from Textile Labs.'
157
+ ```
158
+
159
+ Prompt format is exact: `<tools:off>\n<user>\n{message}\n<|eot|>\n<loom>\n`.
160
+
161
+ ## Which one should I use?
162
+
163
+ **This one**, unless you specifically want the one-hour model. It is better on calibration,
164
+ grounded reading, and both loss metrics, and marginally worse on a single identity probe.
165
+ Spark 2 exists as the one-hour tier and as the control in this comparison.
166
+
167
+ ## Files
168
+
169
+ ```
170
+ config.json / model.safetensors the model
171
+ tokenizer.json / tokenizer_config.json custom BPE tokenizer, 4,096 tokens
172
+ loom-weave-2-flash-f16.gguf 40MB, for Ollama / llama.cpp
173
+ harness.py runnable harness β€” runs lookups, feeds results back
174
+ template / params read automatically by `ollama run hf.co/...`
175
+ Modelfile for building locally
176
+ ATTRIBUTION.md required credits for the training corpora
177
+ ```
178
+
179
+ ## Training data
180
+
181
+ Openly licensed corpora of real human text, plus a persona curriculum written for Loom.
182
+ See `ATTRIBUTION.md` β€” several of these licences require credit.
183
+
184
+ | slice | source |
185
+ |---|---|
186
+ | grounded reading, and "the result doesn't say" | **SQuAD 2.0** (CC BY-SA 4.0) |
187
+ | when to reach for a tool | **MASSIVE** (CC BY 4.0) Β· **CLINC150** (CC BY 3.0) |
188
+ | instruction following | **databricks-dolly-15k** (CC BY-SA 3.0) |
189
+ | multi-turn dialogue structure | **OpenAssistant OASST1** (Apache 2.0) |
190
+ | identity, limits, warmth, brevity | Textile Labs β€” written for Loom |
191
+
192
+ ~11.4M tokens, 43% multi-turn. Validation is a held-out split of the same corpora.
193
+
194
+ ## License
195
+
196
+ Model: MIT. Training data retains its original licences and attribution.