cutterdalton-webai commited on
Commit
44bc424
·
verified ·
1 Parent(s): 5b63ca3

Model card update

Browse files
Files changed (1) hide show
  1. README.md +349 -1
README.md CHANGED
@@ -1,5 +1,353 @@
1
  ---
 
 
 
 
 
2
  license: other
3
  license_name: webai-non-commercial-license-ver.-1.0
4
- license_link: LICENSE
 
 
 
 
 
 
 
 
 
5
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ library_name: peft
5
+ pipeline_tag: text-generation
6
+ base_model: HuggingFaceTB/SmolLM2-1.7B-Instruct
7
  license: other
8
  license_name: webai-non-commercial-license-ver.-1.0
9
+ license_link: https://huggingface.co/webAI-Official/webAI-ColVec1-4b/blob/main/LICENSE.md
10
+ tags:
11
+ - formal-logic
12
+ - reasoning
13
+ - lora
14
+ - peft
15
+ - gguf
16
+ - llama.cpp
17
+ - smollm2
18
+ - twil-lm
19
  ---
20
+
21
+ # TwiL-LM(1.7B)
22
+
23
+ TwiL-LM(1.7B) is a parameter-efficient LoRA adapter for
24
+ [SmolLM2-1.7B-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct).
25
+ It is designed for formal-logic tasks including first-order logic (FOL)
26
+ translation, entailment classification, multiple-choice reasoning, semantic
27
+ parsing, Lean assistance, and procedural reasoning.
28
+
29
+ ## Model details
30
+
31
+ - **Developed by:** webAI Intelligence Lab
32
+ - **Model repository:** [webAI-Official/TwIL-LM](https://huggingface.co/webAI-Official/TwIL-LM)
33
+ - **Model type:** Decoder-only Transformer with a PEFT LoRA adapter
34
+ - **Base model:** SmolLM2-1.7B-Instruct
35
+ - **Language:** English
36
+ - **License:** webAI Non-Commercial License ver. 1.0
37
+ - **LoRA configuration:** rank 64, alpha 128, dropout 0.0, no bias
38
+ - **Context window:** 8,192 tokens, inherited from the base model
39
+ - **Runtime parameters:** 1,783,728,128 total, consisting of approximately
40
+ 1.711B backbone parameters and 72.35M LoRA parameters
41
+ - **Release formats:** PEFT adapter and optional GGUF artifacts
42
+
43
+ This is an adapter, not an independently trained foundation model. Use it with
44
+ the exact base checkpoint and tokenizer listed above.
45
+
46
+ ## Model description
47
+
48
+ TwiL-LM adds a relatively small set of trainable weights to SmolLM2-1.7B-Instruct.
49
+ The adapter was trained on a proprietary multi-task corpus engineered for formal
50
+ logic, multi-step deduction, and mathematical reasoning. The corpus combines
51
+ examples from 47 reasoning sources with filtered synthetic examples.
52
+
53
+ In the evaluation described below, TwiL-LM achieved a macro-primary score of
54
+ **0.361**, compared with **0.185** for the unadapted SmolLM2-1.7B base. It led
55
+ the sub-2B models included in this comparison. This result is specific to the
56
+ reported formal-logic suite and should not be interpreted as a general measure
57
+ of intelligence or performance on all reasoning tasks.
58
+
59
+ ## Intended uses
60
+
61
+ ### Direct use
62
+
63
+ - Translating English statements into first-order logic.
64
+ - Classifying whether a conclusion follows from a set of premises.
65
+ - Answering multiple-choice logic questions.
66
+ - Parsing natural language into structured representations.
67
+ - Drafting or critiquing Lean formalizations with external verification.
68
+ - Research and experimentation on small formal-reasoning models.
69
+
70
+ ### Downstream use
71
+
72
+ The model can be integrated into systems that combine language-model generation
73
+ with symbolic solvers, theorem provers, schema validators, or human review.
74
+ Downstream developers should validate outputs for their target domain and retain
75
+ the license and safety restrictions of both this adapter and its base model.
76
+
77
+ ### Out-of-scope uses
78
+
79
+ - Autonomous medical, legal, financial, or safety-critical decisions.
80
+ - Treating generated FOL or Lean as verified without running an appropriate
81
+ checker or theorem prover.
82
+ - Unsupervised deployment where logically incorrect or fabricated output can
83
+ cause material harm.
84
+ - Uses prohibited by the webAI Non-Commercial License or the base-model license.
85
+ - Impersonation, deceptive systems, autonomous weaponry, or surveillance that
86
+ targets protected classes.
87
+
88
+ ## Training details
89
+
90
+ ### Training data
91
+
92
+ The training corpus is proprietary and is not currently published as a Hugging
93
+ Face dataset. It was assembled from 47 reasoning sources and augmented with
94
+ synthetic examples. Samples were normalized into a shared schema, filtered for
95
+ structural quality, deduplicated, and checked using a two-stage LLM verification
96
+ process. Synthetic data can still contain undetected errors, stylistic artifacts,
97
+ or verifier preferences.
98
+
99
+ Because the complete training corpus and all source-level mixture weights are not
100
+ public, independent reproduction and contamination auditing are limited. Users
101
+ should account for this limitation when comparing results or deploying the model.
102
+
103
+ ### Training procedure
104
+
105
+ - **Method:** Supervised fine-tuning with PEFT LoRA
106
+ - **Rank:** 64
107
+ - **Alpha:** 128
108
+ - **Dropout:** 0.0
109
+ - **Bias:** none
110
+ - **Target modules:** `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`,
111
+ `up_proj`, and `down_proj`
112
+ - **Task type:** `CAUSAL_LM`
113
+
114
+ Optimizer settings, learning-rate schedule, epoch count, random seed, training
115
+ hardware, wall-clock time, and energy consumption are not documented in the
116
+ current release artifacts. These should be added when verified records become
117
+ available.
118
+
119
+ ![TwiL-LM data creation, training, and evaluation workflow](card_assets/data_workflow_v2.png)
120
+
121
+ ## Evaluation
122
+
123
+ ### Formal-logic evaluation
124
+
125
+ The in-domain evaluation used held-out samples with up to 200 rows per objective
126
+ and greedy decoding. The reported macro-primary score is an equal-weight average
127
+ over the eligible objectives. `mcq_answer` and `procedural` use
128
+ `max(accuracy, loose_match)`. `lean_prove` and perplexity corpora are excluded
129
+ from the macro score.
130
+
131
+ ![Macro accuracy compared with base models](card_assets/macro_vs_bases.png)
132
+
133
+ ![Macro accuracy compared across Base and LoRA models](card_assets/macro_vs_bases_and_lora.png)
134
+
135
+ The broader comparison includes checkpoints with different parameter counts,
136
+ training procedures, and adaptation methods. It is useful for context but is not
137
+ a controlled architecture or scaling study.
138
+
139
+ ![TwiL-LM compared with SmolLM2-1.7B by objective](card_assets/objectives_vs_smollm2.png)
140
+
141
+ TwiL-LM performs best on entailment labeling (**0.655**) and improves FOL
142
+ translation (**0.235**, compared with approximately zero for the base). Lean
143
+ formalization, Lean proving, and procedural reasoning remain weak.
144
+
145
+ ### Out-of-Distribution (OOD) evaluation
146
+
147
+ OOD transfer was measured on GSM8K, ARC-Challenge chain-of-thought,
148
+ ARC-Challenge 25-shot log-likelihood (`acc_norm`), and LogicBench BQA.
149
+
150
+ ![TwiL-LM and SmolLM2-1.7B on OOD benchmarks](card_assets/unseen_benchmarks.png)
151
+
152
+ Compared with SmolLM2-1.7B, TwiL-LM improves LogicBench BQA
153
+ (**0.590 vs 0.563**) but is lower on GSM8K (**0.380 vs 0.413**), ARC-C
154
+ chain-of-thought (**0.463 vs 0.587**), and ARC-C 25-shot log-likelihood
155
+ (**0.460 vs 0.490**).
156
+
157
+ ![OOD benchmark macro accuracy for Base, FT, and PS variants](card_assets/unseen_macro_no_gsm8k.png)
158
+
159
+ These results indicate mixed transfer outside the formal-logic training
160
+ distribution. Larger general reasoning models remain stronger on several OOD
161
+ benchmarks.
162
+
163
+ ### Throughput evaluation
164
+
165
+ ![Aggregate generation throughput](card_assets/throughput.png)
166
+
167
+ The formal-logic run generated 422,627 tokens in 1,152.34 generation seconds,
168
+ or **366.8 aggregate tokens per second**. The configuration used a maximum of
169
+ 1,024 new tokens per example. Outputs averaged 264.1 new tokens; the median was
170
+ 92 tokens, the 90th percentile was 1,024 tokens, and 16.1% of outputs reached the
171
+ generation limit.
172
+
173
+ This is aggregate evaluation throughput, not single-request latency or a
174
+ controlled serving benchmark. It depends on hardware, precision, backend,
175
+ batching, prompt length, output length, and stopping behavior. The comparison
176
+ runs did not consistently control all of these variables, so the figure should
177
+ not be used to claim that LoRA intrinsically accelerates generation.
178
+
179
+ ### Evaluation limitations
180
+
181
+ - The formal-logic suite includes custom tasks and metrics and is not a standard
182
+ Hugging Face benchmark dataset.
183
+ - Some comparison checkpoints used different output limits and evaluation runs.
184
+ - The evaluation primarily covers English.
185
+ - The current records do not provide confidence intervals or repeated-seed
186
+ variance.
187
+ - Exact-match metrics can penalize semantically equivalent formal expressions.
188
+ - The training corpus is not public, limiting independent contamination checks.
189
+
190
+ Structured Hub evaluation files are not included because the internal suite is
191
+ not registered as a Hugging Face Benchmark and the available records do not
192
+ contain verified task IDs for the OOD benchmarks. The scores above are therefore
193
+ reported in the card rather than submitted as verified Hub leaderboard results.
194
+
195
+ ## How to use
196
+
197
+ ### Installation and authentication
198
+
199
+ The model repository may require access approval. Install the dependencies and
200
+ authenticate with the Hugging Face Hub:
201
+
202
+ ```bash
203
+ pip install -U torch transformers peft accelerate huggingface_hub
204
+ hf auth login
205
+ ```
206
+
207
+ ### Transformers with PEFT
208
+
209
+ ```python
210
+ import torch
211
+ from peft import PeftModel
212
+ from transformers import AutoModelForCausalLM, AutoTokenizer
213
+
214
+ base_id = "HuggingFaceTB/SmolLM2-1.7B-Instruct"
215
+ adapter_id = "webAI-Official/TwIL-LM"
216
+
217
+ tokenizer = AutoTokenizer.from_pretrained(base_id)
218
+ base_model = AutoModelForCausalLM.from_pretrained(
219
+ base_id,
220
+ torch_dtype="auto",
221
+ device_map="auto",
222
+ )
223
+ model = PeftModel.from_pretrained(base_model, adapter_id)
224
+ model.eval()
225
+
226
+ messages = [
227
+ {
228
+ "role": "user",
229
+ "content": "Translate to first-order logic: All cats are mammals.",
230
+ }
231
+ ]
232
+ input_ids = tokenizer.apply_chat_template(
233
+ messages,
234
+ tokenize=True,
235
+ add_generation_prompt=True,
236
+ return_tensors="pt",
237
+ ).to(model.device)
238
+
239
+ with torch.inference_mode():
240
+ output_ids = model.generate(
241
+ input_ids,
242
+ max_new_tokens=256,
243
+ do_sample=False,
244
+ )
245
+
246
+ new_tokens = output_ids[0, input_ids.shape[-1]:]
247
+ print(tokenizer.decode(new_tokens, skip_special_tokens=True))
248
+ ```
249
+
250
+ Use the base model's tokenizer and chat template. Loading the adapter over a
251
+ different base checkpoint is unsupported and can cause incorrect output or tensor
252
+ shape errors.
253
+
254
+ ### llama.cpp with GGUF
255
+
256
+ Download the model repository:
257
+
258
+ ```bash
259
+ hf download webAI-Official/TwIL-LM --local-dir TwIL-LM
260
+ ```
261
+
262
+ If the release contains a GGUF LoRA adapter, apply it to a GGUF converted from
263
+ the matching SmolLM2-1.7B-Instruct base:
264
+
265
+ ```bash
266
+ llama-cli \
267
+ -m /path/to/smollm2-1.7b-instruct-f16.gguf \
268
+ --lora TwIL-LM/smollm2-lorav1-ps-lora-f16.gguf \
269
+ -p "Translate to FOL: All cats are mammals." \
270
+ -n 256
271
+ ```
272
+
273
+ If the release contains a merged GGUF, use it without `--lora`:
274
+
275
+ ```bash
276
+ llama-cli \
277
+ -m TwIL-LM/smollm2-lorav1-ps-merged-Q4_K_M.gguf \
278
+ -p "Translate to FOL: All cats are mammals." \
279
+ -n 256
280
+ ```
281
+
282
+ GGUF filenames can vary between releases. Confirm the downloaded filenames
283
+ before running these commands.
284
+
285
+ ## Files and formats
286
+
287
+ - `adapter_model.safetensors`: PEFT LoRA weights, approximately 289 MB.
288
+ - `adapter_config.json`: PEFT configuration that identifies the required base
289
+ model.
290
+ - `smollm2-lorav1-ps-lora-f16.gguf`: optional GGUF LoRA adapter, approximately
291
+ 145 MB.
292
+ - Merged GGUF variants may be provided as FP16 (approximately 3.42 GB), Q8_0
293
+ (1.82 GB), Q5_K_M (1.23 GB), or Q4_K_M (1.06 GB).
294
+
295
+ Availability and filenames can vary by release. Quantized GGUF variants may not
296
+ match the evaluation quality reported for the original adapter; validate the
297
+ selected artifact on the target workload.
298
+
299
+ ## Limitations, risks, and biases
300
+
301
+ - **Not a verifier:** Plausible-looking FOL or Lean output can be syntactically or
302
+ semantically wrong. Use a symbolic solver, Lean/Mathlib, or expert review.
303
+ - **Narrow specialization:** The adapter is designed for formal logic, not as a
304
+ replacement for a general-purpose assistant.
305
+ - **Mixed OOD performance:** Improvements on LogicBench do not transfer
306
+ consistently to GSM8K or ARC-Challenge.
307
+ - **Small-model capacity:** Long reasoning chains, deeply nested quantifiers,
308
+ complex rule induction, and long formal contexts can fail or hallucinate.
309
+ - **Synthetic-data artifacts:** Synthetic examples and LLM verification can
310
+ introduce systematic style, content, or verifier bias.
311
+ - **English-first:** Performance in other languages is not established.
312
+ - **Base-model inheritance:** The adapter retains the base model's limitations,
313
+ biases, and potential for unsafe or inaccurate content.
314
+ - **Context limit:** Inputs near 8,192 tokens leave less room for generation and
315
+ can be truncated by serving frameworks.
316
+ - **Quantization effects:** Q4 and Q5 builds may change formal-token generation
317
+ and exact-match accuracy.
318
+ - **No uncertainty calibration:** Scores do not establish that model confidence
319
+ corresponds to correctness.
320
+
321
+ ## Environmental impact
322
+
323
+ Training-energy use, hardware type, training duration, datacenter region, and
324
+ carbon emissions were not recorded in the available release artifacts. No
325
+ emissions estimate is provided. Inference impact varies with hardware, precision,
326
+ quantization, sequence length, and utilization.
327
+
328
+ ## License
329
+
330
+ The model weights are distributed under the
331
+ [webAI Non-Commercial License ver. 1.0](https://huggingface.co/webAI-Official/webAI-ColVec1-4b/blob/main/LICENSE.md).
332
+ Review that license and the
333
+ [SmolLM2 base-model terms](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct)
334
+ before use. The license applied to source code in this repository does not
335
+ override the model-weight license.
336
+
337
+ ## Citation
338
+
339
+ ```bibtex
340
+ @misc{twil_lm_1_7b,
341
+ title = {TwiL-LM(1.7B) Formal-Logic LoRA},
342
+ author = {webAI Intelligence Lab},
343
+ year = {2026},
344
+ url = {https://huggingface.co/webAI-Official/TwIL-LM}
345
+ }
346
+ ```
347
+
348
+ ## Contact
349
+
350
+ For model questions, licensing requests, or reports of harmful behavior, use the
351
+ Community tab of the
352
+ [webAI-Official/TwIL-LM](https://huggingface.co/webAI-Official/TwIL-LM)
353
+ repository.