cutterdalton-webai Cursor commited on
Commit
f96f8c2
·
2 Parent(s): 656c0a3d15c2bc

Merge TwIL-LM2 into main

Browse files

Archives prior TwIL-LM (v1) at branch/tag TwIL-LM1.

Co-authored-by: Cursor <cursoragent@cursor.com>

.gitattributes CHANGED
@@ -45,3 +45,7 @@ TwIL-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
45
  TwIL-merged-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
46
  TwIL-merged-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
47
  TwIL-merged-f16.gguf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
45
  TwIL-merged-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
46
  TwIL-merged-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
47
  TwIL-merged-f16.gguf filter=lfs diff=lfs merge=lfs -text
48
+ TwIL-LM2-F16.gguf filter=lfs diff=lfs merge=lfs -text
49
+ TwIL-LM2-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
50
+ TwIL-LM2-Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
51
+ TwIL-LM2-Q8_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,7 +1,7 @@
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
@@ -11,330 +11,178 @@ 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. Our updated TwIL-LM2 model can be downloaded from
28
- the TwIL-LM2 branch. That model shows better general reasoning capabilities while solving formal logic tasks.
29
 
30
- ## Model details
 
31
 
32
- - **Developed by:** webAI Intelligence Lab
33
- - **Model repository:** [webAI-Official/TwIL-LM](https://huggingface.co/webAI-Official/TwIL-LM)
34
- - **Model type:** Decoder-only Transformer with a PEFT LoRA adapter
35
- - **Base model:** SmolLM2-1.7B-Instruct
36
- - **Language:** English
37
- - **License:** webAI Non-Commercial License ver. 1.0
38
- - **LoRA configuration:** rank 64, alpha 128, dropout 0.0, no bias
39
- - **Context window:** 8,192 tokens, inherited from the base model
40
- - **Runtime parameters:** 1,783,728,128 total, consisting of approximately
41
- 1.711B backbone parameters and 72.35M LoRA parameters
42
- - **Release formats:** PEFT adapter and optional GGUF artifacts
43
 
44
- This is an adapter, not an independently trained foundation model. Use it with
45
- the exact base checkpoint and tokenizer listed above.
46
 
47
- ## Model description
48
 
49
- TwiL-LM adds a relatively small set of trainable weights to SmolLM2-1.7B-Instruct.
50
- The adapter was trained on a proprietary multi-task corpus engineered for formal
51
- logic, multi-step deduction, and mathematical reasoning. The corpus combines
52
- examples from 47 reasoning sources with filtered synthetic examples.
53
 
54
- In the evaluation described below, TwiL-LM achieved a macro-primary score of
55
- **0.361**, compared with **0.185** for the unadapted SmolLM2-1.7B base. It led
56
- the sub-2B models included in this comparison. This result is specific to the
57
- reported formal-logic suite and should not be interpreted as a general measure
58
- of intelligence or performance on all reasoning tasks.
 
 
 
59
 
60
- ## Intended uses
 
 
61
 
62
- ### Direct use
63
 
64
- - Translating English statements into first-order logic.
65
- - Classifying whether a conclusion follows from a set of premises.
66
- - Answering multiple-choice logic questions.
67
- - Parsing natural language into structured representations.
68
- - Drafting or critiquing Lean formalizations with external verification.
69
- - Research and experimentation on small formal-reasoning models.
70
 
71
- ### Downstream use
 
 
 
72
 
73
- The model can be integrated into systems that combine language-model generation
74
- with symbolic solvers, theorem provers, schema validators, or human review.
75
- Downstream developers should validate outputs for their target domain and retain
76
- the license and safety restrictions of both this adapter and its base model.
77
 
78
- ### Out-of-scope uses
 
 
 
 
 
 
 
 
79
 
80
- - Autonomous medical, legal, financial, or safety-critical decisions.
81
- - Treating generated FOL or Lean as verified without running an appropriate
82
- checker or theorem prover.
83
- - Unsupervised deployment where logically incorrect or fabricated output can
84
- cause material harm.
85
- - Uses prohibited by the webAI Non-Commercial License or the base-model license.
86
- - Impersonation, deceptive systems, autonomous weaponry, or surveillance that
87
- targets protected classes.
88
 
89
- ## Training details
90
-
91
- ### Training data
92
-
93
- The training corpus is proprietary and is not currently published as a Hugging
94
- Face dataset. It was assembled from 47 reasoning sources and augmented with
95
- synthetic examples. Samples were normalized into a shared schema, filtered for
96
- structural quality, deduplicated, and checked using a two-stage LLM verification
97
- process. Synthetic data can still contain undetected errors, stylistic artifacts,
98
- or verifier preferences.
99
-
100
- Because the complete training corpus and all source-level mixture weights are not
101
- public, independent reproduction and contamination auditing are limited. Users
102
- should account for this limitation when comparing results or deploying the model.
103
-
104
- ### Training procedure
105
-
106
- - **Method:** Supervised fine-tuning with PEFT LoRA
107
- - **Rank:** 64
108
- - **Alpha:** 128
109
- - **Dropout:** 0.0
110
- - **Bias:** none
111
- - **Target modules:** `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`,
112
- `up_proj`, and `down_proj`
113
- - **Task type:** `CAUSAL_LM`
114
-
115
- Optimizer settings, learning-rate schedule, epoch count, random seed, training
116
- hardware, wall-clock time, and energy consumption are not documented in the
117
- current release artifacts. These should be added when verified records become
118
- available.
119
-
120
-
121
-
122
- ## Evaluation
123
-
124
- ### Formal-logic evaluation
125
-
126
- The in-domain evaluation used held-out samples with up to 200 rows per objective
127
- and greedy decoding. The reported macro-primary score is an equal-weight average
128
- over the eligible objectives. `mcq_answer` and `procedural` use
129
- `max(accuracy, loose_match)`. `lean_prove` and perplexity corpora are excluded
130
- from the macro score.
131
-
132
-
133
- The broader comparison includes checkpoints with different parameter counts,
134
- training procedures, and adaptation methods. It is useful for context but is not
135
- a controlled architecture or scaling study.
136
-
137
- TwiL-LM performs best on entailment labeling (**0.655**) and improves FOL
138
- translation (**0.235**, compared with approximately zero for the base). Lean
139
- formalization, Lean proving, and procedural reasoning remain weak.
140
-
141
- ### Out-of-Distribution (OOD) evaluation
142
-
143
- OOD transfer was measured on GSM8K, ARC-Challenge chain-of-thought,
144
- ARC-Challenge 25-shot log-likelihood (`acc_norm`), and LogicBench BQA.
145
-
146
- Compared with SmolLM2-1.7B, TwiL-LM improves LogicBench BQA
147
- (**0.590 vs 0.563**) but is lower on GSM8K (**0.380 vs 0.413**), ARC-C
148
- chain-of-thought (**0.463 vs 0.587**), and ARC-C 25-shot log-likelihood
149
- (**0.460 vs 0.490**).
150
-
151
- ### Throughput evaluation
152
-
153
-
154
- The formal-logic run generated 422,627 tokens in 1,152.34 generation seconds,
155
- or **366.8 aggregate tokens per second**. The configuration used a maximum of
156
- 1,024 new tokens per example. Outputs averaged 264.1 new tokens; the median was
157
- 92 tokens, the 90th percentile was 1,024 tokens, and 16.1% of outputs reached the
158
- generation limit.
159
-
160
- This is aggregate evaluation throughput, not single-request latency or a
161
- controlled serving benchmark. It depends on hardware, precision, backend,
162
- batching, prompt length, output length, and stopping behavior. The comparison
163
- runs did not consistently control all of these variables, so the figure should
164
- not be used to claim that LoRA intrinsically accelerates generation.
165
-
166
- ### Evaluation limitations
167
-
168
- - The formal-logic suite includes custom tasks and metrics and is not a standard
169
- Hugging Face benchmark dataset.
170
- - Some comparison checkpoints used different output limits and evaluation runs.
171
- - The evaluation primarily covers English.
172
- - The current records do not provide confidence intervals or repeated-seed
173
- variance.
174
- - Exact-match metrics can penalize semantically equivalent formal expressions.
175
- - The training corpus is not public, limiting independent contamination checks.
176
-
177
- Structured Hub evaluation files are not included because the internal suite is
178
- not registered as a Hugging Face Benchmark and the available records do not
179
- contain verified task IDs for the OOD benchmarks. The scores above are therefore
180
- reported in the card rather than submitted as verified Hub leaderboard results.
181
-
182
- ## How to use
183
-
184
- ### Installation and authentication
185
-
186
- The model repository may require access approval. Install the dependencies and
187
- authenticate with the Hugging Face Hub:
188
-
189
- ```bash
190
- pip install -U torch transformers peft accelerate huggingface_hub
191
- hf auth login
192
- ```
193
-
194
- ### Transformers with PEFT
195
 
196
  ```python
197
  import torch
198
- from peft import PeftModel
199
  from transformers import AutoModelForCausalLM, AutoTokenizer
200
 
201
- base_id = "HuggingFaceTB/SmolLM2-1.7B-Instruct"
202
- adapter_id = "webAI-Official/TwIL-LM"
203
-
204
- tokenizer = AutoTokenizer.from_pretrained(base_id)
205
- base_model = AutoModelForCausalLM.from_pretrained(
206
- base_id,
207
- torch_dtype="auto",
208
- device_map="auto",
209
  )
210
- model = PeftModel.from_pretrained(base_model, adapter_id)
211
- model.eval()
212
-
213
- messages = [
214
- {
215
- "role": "user",
216
- "content": "Translate to first-order logic: All cats are mammals.",
217
- }
218
- ]
219
- input_ids = tokenizer.apply_chat_template(
220
- messages,
221
- tokenize=True,
222
- add_generation_prompt=True,
223
- return_tensors="pt",
224
- ).to(model.device)
225
-
226
- with torch.inference_mode():
227
- output_ids = model.generate(
228
- input_ids,
229
- max_new_tokens=256,
230
- do_sample=False,
231
- )
232
-
233
- new_tokens = output_ids[0, input_ids.shape[-1]:]
234
- print(tokenizer.decode(new_tokens, skip_special_tokens=True))
235
- ```
236
-
237
- Use the base model's tokenizer and chat template. Loading the adapter over a
238
- different base checkpoint is unsupported and can cause incorrect output or tensor
239
- shape errors.
240
 
241
- ### llama.cpp with GGUF
242
-
243
- Download the model repository:
244
-
245
- ```bash
246
- hf download webAI-Official/TwIL-LM --local-dir TwIL-LM
247
- ```
248
-
249
- If the release contains a GGUF LoRA adapter, apply it to a GGUF converted from
250
- the matching SmolLM2-1.7B-Instruct base:
251
-
252
- ```bash
253
- llama-cli \
254
- -m /path/to/smollm2-1.7b-instruct-f16.gguf \
255
- --lora TwIL-LM/smollm2-lorav1-ps-lora-f16.gguf \
256
- -p "Translate to FOL: All cats are mammals." \
257
- -n 256
258
- ```
259
-
260
- If the release contains a merged GGUF, use it without `--lora`:
261
-
262
- ```bash
263
- llama-cli \
264
- -m TwIL-LM/smollm2-lorav1-ps-merged-Q4_K_M.gguf \
265
- -p "Translate to FOL: All cats are mammals." \
266
- -n 256
267
- ```
268
 
269
- GGUF filenames can vary between releases. Confirm the downloaded filenames
270
- before running these commands.
271
-
272
- ## Files and formats
273
-
274
- - `adapter_model.safetensors`: PEFT LoRA weights, approximately 289 MB.
275
- - `adapter_config.json`: PEFT configuration that identifies the required base
276
- model.
277
- - `smollm2-lorav1-ps-lora-f16.gguf`: optional GGUF LoRA adapter, approximately
278
- 145 MB.
279
- - Merged GGUF variants may be provided as FP16 (approximately 3.42 GB), Q8_0
280
- (1.82 GB), Q5_K_M (1.23 GB), or Q4_K_M (1.06 GB).
281
-
282
- Availability and filenames can vary by release. Quantized GGUF variants may not
283
- match the evaluation quality reported for the original adapter; validate the
284
- selected artifact on the target workload.
285
-
286
- ## Limitations, risks, and biases
287
-
288
- - **Not a verifier:** Plausible-looking FOL or Lean output can be syntactically or
289
- semantically wrong. Use a symbolic solver, Lean/Mathlib, or expert review.
290
- - **Narrow specialization:** The adapter is designed for formal logic, not as a
291
- replacement for a general-purpose assistant.
292
- - **Mixed OOD performance:** Improvements on LogicBench do not transfer
293
- consistently to GSM8K or ARC-Challenge.
294
- - **Small-model capacity:** Long reasoning chains, deeply nested quantifiers,
295
- complex rule induction, and long formal contexts can fail or hallucinate.
296
- - **Synthetic-data artifacts:** Synthetic examples and LLM verification can
297
- introduce systematic style, content, or verifier bias.
298
- - **English-first:** Performance in other languages is not established.
299
- - **Base-model inheritance:** The adapter retains the base model's limitations,
300
- biases, and potential for unsafe or inaccurate content.
301
- - **Context limit:** Inputs near 8,192 tokens leave less room for generation and
302
- can be truncated by serving frameworks.
303
- - **Quantization effects:** Q4 and Q5 builds may change formal-token generation
304
- and exact-match accuracy.
305
- - **No uncertainty calibration:** Scores do not establish that model confidence
306
- corresponds to correctness.
307
-
308
- ## Environmental impact
309
-
310
- Training-energy use, hardware type, training duration, datacenter region, and
311
- carbon emissions were not recorded in the available release artifacts. No
312
- emissions estimate is provided. Inference impact varies with hardware, precision,
313
- quantization, sequence length, and utilization.
314
-
315
- ## License
316
-
317
- The model weights are distributed under the
318
- [webAI Non-Commercial License ver. 1.0](https://huggingface.co/webAI-Official/webAI-ColVec1-4b/blob/main/LICENSE.md).
319
- Review that license and the
320
- [SmolLM2 base-model terms](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct)
321
- before use. The license applied to source code in this repository does not
322
- override the model-weight license.
323
-
324
- ## Citation
325
-
326
- ```bibtex
327
- @misc{twil_lm_1_7b,
328
- title = {TwiL-LM(1.7B) Formal-Logic LoRA},
329
- author = {webAI Intelligence Lab},
330
- year = {2026},
331
- url = {https://huggingface.co/webAI-Official/TwIL-LM}
332
- }
333
  ```
334
 
335
- ## Contact
336
-
337
- For model questions, licensing requests, or reports of harmful behavior, use the
338
- Community tab of the
339
- [webAI-Official/TwIL-LM](https://huggingface.co/webAI-Official/TwIL-LM)
340
- repository.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  language:
3
  - en
4
+ library_name: transformers
5
  pipeline_tag: text-generation
6
  base_model: HuggingFaceTB/SmolLM2-1.7B-Instruct
7
  license: other
 
11
  - formal-logic
12
  - reasoning
13
  - lora
14
+ - model-merging
15
+ - wise-ft
16
+ - reinforcement-learning
17
+ - grpo
18
  - smollm2
19
  - twil-lm
20
  ---
21
 
22
+ # TwIL-LM2
23
 
24
+ A 1.7B reasoning model for **formal logic** tasks, built from
25
+ [`HuggingFaceTB/SmolLM2-1.7B-Instruct`](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct)
26
+ through LoRA supervised fine-tuning, checkpoint fusion, WiSE-FT weight interpolation, and
27
+ entropy-weighted GRPO reinforcement learning.
 
 
28
 
29
+ It raises in-domain formal-logic performance by **+49% relative** over its base model
30
+ (macro gate 0.263 → 0.393) while holding held-out general capability roughly flat.
31
 
32
+ Its larger sibling, **TwIL-LM3** (3B, from SmolLM3), trades a smaller in-domain gain for
33
+ strictly better held-out retention. If you care about not regressing on general benchmarks,
34
+ prefer that one.
 
 
 
 
 
 
 
 
35
 
36
+ ## Results
 
37
 
38
+ ### Track A — in-domain formal logic
39
 
40
+ The **macro gate** is the mean of five objective scores: entailment labelling, multiple-choice
41
+ answering, procedural reasoning, Lean proof critique, and rule induction (scored by its
42
+ continuous derivation score). MCQ and procedural are credited as `max(exact_match, loose_match)`.
43
+ `n = 200` prompts per objective, greedy decoding, 2048 max new tokens.
44
 
45
+ | objective | SmolLM2-1.7B-Instruct | TwIL-LM2 | Δ |
46
+ |---|---:|---:|---:|
47
+ | entailment_label | 0.245 | **0.585** | +0.340 |
48
+ | rule_induction | 0.135 | **0.514** | +0.379 |
49
+ | lean_critic | 0.490 | **0.525** | +0.035 |
50
+ | mcq_answer | 0.290 | 0.270 | −0.020 |
51
+ | procedural | 0.155 | 0.070 | −0.085 |
52
+ | **macro gate** | **0.2630** | **0.3927** | **+0.1297** |
53
 
54
+ The gain is concentrated in entailment labelling and rule induction. MCQ answering and
55
+ procedural reasoning **regressed**, and that is not hidden by the macro — it is averaged into
56
+ the number above.
57
 
58
+ ### Track B — held-out benchmarks
59
 
60
+ Nothing in this suite was trained on. Scores are re-derived from saved generations with
61
+ delimiter-aware answer extractors rather than read from harness metrics.
 
 
 
 
62
 
63
+ | | SmolLM2-1.7B-Instruct | TwIL-LM2 | Δ |
64
+ |---|---:|---:|---:|
65
+ | core average | 0.499 | **0.508** | +0.009 |
66
+ | suite average (14 datasets) | 0.384 | 0.374 | −0.010 |
67
 
68
+ Per-dataset, largest moves in each direction:
 
 
 
69
 
70
+ | dataset | base | TwIL-LM2 | Δ |
71
+ |---|---:|---:|---:|
72
+ | GSM-Symbolic | 0.220 | 0.260 | +0.040 |
73
+ | CommonsenseQA | 0.397 | 0.433 | +0.037 |
74
+ | LogicBench BQA | 0.507 | 0.540 | +0.033 |
75
+ | MATH-500 | 0.190 | 0.210 | +0.020 |
76
+ | IFEval (strict) | 0.470 | 0.430 | −0.040 |
77
+ | SVAMP | 0.487 | 0.383 | −0.103 |
78
+ | MuSR | 0.422 | 0.313 | −0.109 |
79
 
80
+ **This model does not pass a no-regression bar on held-out tasks.** MuSR and SVAMP lose about
81
+ ten points each. The suite average is slightly negative. The honest summary is that in-domain
82
+ logic improves substantially and general capability is approximately preserved *on average*,
83
+ with real losses on multi-step narrative and word-problem reasoning.
 
 
 
 
84
 
85
+ ## Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  ```python
88
  import torch
 
89
  from transformers import AutoModelForCausalLM, AutoTokenizer
90
 
91
+ model_id = "webAI-Official/TwIL-LM"
92
+ tok = AutoTokenizer.from_pretrained(model_id, revision="TwIL-LM2")
93
+ model = AutoModelForCausalLM.from_pretrained(
94
+ model_id, revision="TwIL-LM2", torch_dtype=torch.bfloat16, device_map="auto"
 
 
 
 
95
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ messages = [{"role": "user", "content":
98
+ "Does 'All dogs are mammals. Rex is a dog.' entail 'Rex is a mammal'? "
99
+ "Answer entailment, contradiction, or neutral."}]
100
+ inputs = tok.apply_chat_template(
101
+ messages, add_generation_prompt=True,
102
+ return_tensors="pt", return_dict=True,
103
+ ).to(model.device)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
+ out = model.generate(**inputs, max_new_tokens=2048, do_sample=False)
106
+ print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ```
108
 
109
+ `return_dict=True` matters on transformers 5.x, where `apply_chat_template` returns a
110
+ `BatchEncoding` rather than a bare tensor; the above works on both 4.x and 5.x.
111
+
112
+ The model was trained and evaluated with **greedy decoding** (`do_sample=False`) and a
113
+ **2048-token** generation budget. It usually opens a `<think>...</think>` reasoning block before
114
+ answering, so give it room — the reported numbers assume at least 2048 new tokens, and a shorter
115
+ budget truncates reasoning and scores far worse.
116
+
117
+ ## How it was built
118
+
119
+ Four stages on top of the base model:
120
+
121
+ 1. **LoRA supervised fine-tuning** on a synthetic formal-logic corpus covering the Track A
122
+ objectives (first-order-logic translation, entailment labelling, semantic parsing, Lean
123
+ formalisation and critique, procedural reasoning, rule induction).
124
+ 2. **Checkpoint fusion** — parameter-space averaging of intermediate SFT checkpoints selected
125
+ by a diversity probe, rather than taking the final checkpoint.
126
+ 3. **WiSE-FT interpolation** toward the pretrained base, `W = (1 − λ)·W_base + λ·W_finetuned`
127
+ with **λ = 0.75**. λ was chosen by constrained optimisation: maximise in-domain score
128
+ subject to minimal degradation on held-out benchmarks.
129
+ 4. **MGPO** — entropy-weighted GRPO reinforcement learning against a programmatic verifier,
130
+ with partial credit for loose matches and token-F1 so that all-fail prompt groups still
131
+ produce gradient. Published checkpoint is **step 1680**.
132
+
133
+ ## Limitations and caveats
134
+
135
+ **Truncation.** At a 2048-token budget, 6.9% of Track A generations hit the cap (down from
136
+ 11.7% for the base). Our protocol marks a comparison `rankable` only below 2% truncation, so
137
+ both the base and this model are formally **not rankable** on Track A and the macro gate should
138
+ be read as indicative rather than exact. A truncated response scores zero regardless of whether
139
+ its reasoning was sound, so both numbers are pessimistic — the base more so.
140
+
141
+ **Scope.** Tuned for formal logic. The Track B suite does not cover code generation or tool use
142
+ (HumanEval, LiveCodeBench and BFCL were not run for this model or its base), so this release
143
+ makes no claim about those.
144
+
145
+ **Not a chat model.** It was optimised against automatic verifiers on logic tasks. It has had no
146
+ safety tuning beyond whatever the base model carries, and no instruction-following alignment
147
+ work — IFEval in fact regressed.
148
+
149
+ **Failed consolidation stage.** A post-RL self-distillation round (SDFT) was attempted to recover
150
+ held-out capability and made both tracks worse at every budget tried. It is not part of this
151
+ model. See the accompanying `SDFT_RESULT.md` in the project repository.
152
+
153
+ ## Evaluation protocol
154
+
155
+ - Track A: `n = 200` per objective, greedy (`temperature = 0`), `max_new_tokens = 2048`, one
156
+ retry at 4096 for truncated rows, `max_seq_len = 8192`, seed 42.
157
+ - Track B: 300 examples per task, greedy, `max_gen_toks = 4096`, `max_model_len = 8192`,
158
+ `repetition_penalty = 1.0`, chat template applied, vLLM backend.
159
+ - Both tracks use the same protocol for the model and its base, in a paired run over identical
160
+ sampled rows.
161
+
162
+ `repetition_penalty = 1.0` is load-bearing. A 1.1 penalty produced apparent 20-point swings on
163
+ Track B that were pure decoding artefact; the decoding kwargs are hashed into the protocol
164
+ identity so a mismatched runner fails loudly instead of quietly producing a different number.
165
+
166
+ ## Relationship to the `main` branch
167
+
168
+ The `main` branch of this repository holds the original TwIL-LM release: a PEFT **LoRA adapter**
169
+ (plus GGUF builds) for the supervised fine-tuning stage only. This branch holds a **full merged
170
+ model** from a later point in the pipeline — after fusion, WiSE-FT interpolation and MGPO
171
+ reinforcement learning — so it is loaded directly with `AutoModelForCausalLM`, with no adapter
172
+ and no base checkpoint required.
173
+
174
+ The two are scored on different protocols and their headline numbers are not directly
175
+ comparable: `main` reports a macro-*primary* average, while this card reports the five-component
176
+ macro *gate* described above.
177
+
178
+ ## License and attribution
179
+
180
+ Released under the **webAI Non-Commercial License ver. 1.0** — see `LICENSE.md` in this
181
+ repository. This matches the licensing of the `main` branch.
182
+
183
+ The base model,
184
+ [`HuggingFaceTB/SmolLM2-1.7B-Instruct`](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct),
185
+ is Apache 2.0; its licence text is retained as `apache-2.0-LICENSE.txt` and all credit for the
186
+ base model goes to the HuggingFaceTB team. Apache 2.0 permits distributing derivative works
187
+ under different terms provided attribution is preserved, which is what the pair of licence files
188
+ in this repository does.
TwIL-Q8_0.gguf → TwIL-LM2-F16.gguf RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9b2797be007757c22d8fe9b87557946e4b3d40616718d5cc12a692d1ed9792cc
3
- size 1820414496
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db9dcc9d0bce00e4977ee28b86e826dc0cb9a5333a4c112452b2ee285cafc4be
3
+ size 3424735872
TwIL-merged-Q4_K_M.gguf → TwIL-LM2-Q4_K_M.gguf RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:185abb5a630ba760b0abd4f4f886d74b1c193d6c8350e9c2bab88355ba38bcf9
3
- size 1055609376
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ff68eb7548eca6840701787f4e6bab4b622f51af8d453ea03a6043674324806
3
+ size 1055609472
TwIL-merged-Q5_K_M.gguf → TwIL-LM2-Q5_K_M.gguf RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:add126e1a9dc5d4c4c01fb273df5e111a2c54f711684b22d2f56a8f43658006d
3
- size 1225478688
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08469f2f6cb14a46a3490a50c0e3fe6f3fde35b5eeb3de16e1f1d0c6589d9a67
3
+ size 1225478784
TwIL-merged-f16.gguf → TwIL-LM2-Q8_0.gguf RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eec8fc823f1d67b460b39ed402efdd43b7c1f89c1c64d1a32d0a63a4d8c8cca4
3
- size 3424735776
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7dfb571fc737f5fe7b538e2890f009a33a8d61aa02d73ca885ee19458f8bbe7e
3
+ size 1820414592
config.json CHANGED
@@ -1,43 +1,45 @@
1
  {
2
- "architectures": [
3
- "LlamaForCausalLM"
4
- ],
5
- "attention_bias": false,
6
- "attention_dropout": 0.0,
7
- "bos_token_id": 1,
8
- "torch_dtype": "bfloat16",
9
- "eos_token_id": 2,
10
- "head_dim": 64,
11
- "hidden_act": "silu",
12
- "hidden_size": 2048,
13
- "initializer_range": 0.02,
14
- "intermediate_size": 8192,
15
- "max_position_embeddings": 8192,
16
- "mlp_bias": false,
17
- "model_type": "llama",
18
- "num_attention_heads": 32,
19
- "num_hidden_layers": 24,
20
- "num_key_value_heads": 32,
21
- "pad_token_id": 0,
22
- "pretraining_tp": 1,
23
- "rms_norm_eps": 1e-05,
24
- "rope_parameters": {
25
- "rope_theta": 130000,
26
- "rope_type": "default"
 
 
 
 
 
 
 
27
  },
28
- "tie_word_embeddings": true,
29
- "transformers.js_config": {
30
- "torch_dtype": "q4",
31
- "kv_cache_dtype": {
32
- "fp16": "float16",
33
- "q4f16": "float16"
34
- },
35
- "use_external_data_format": {
36
- "model.onnx": true,
37
- "model_fp16.onnx": true
38
- }
39
- },
40
- "unsloth_version": "2026.7.4",
41
- "use_cache": true,
42
- "vocab_size": 49152
43
- }
 
1
  {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 2,
10
+ "head_dim": 64,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 2048,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 8192,
15
+ "max_position_embeddings": 8192,
16
+ "mlp_bias": false,
17
+ "model_type": "llama",
18
+ "num_attention_heads": 32,
19
+ "num_hidden_layers": 24,
20
+ "num_key_value_heads": 32,
21
+ "pad_token_id": 2,
22
+ "pretraining_tp": 1,
23
+ "rms_norm_eps": 1e-05,
24
+ "rope_parameters": {
25
+ "rope_theta": 130000,
26
+ "rope_type": "default"
27
+ },
28
+ "tie_word_embeddings": true,
29
+ "transformers.js_config": {
30
+ "dtype": "q4",
31
+ "kv_cache_dtype": {
32
+ "fp16": "float16",
33
+ "q4f16": "float16"
34
  },
35
+ "use_external_data_format": {
36
+ "model.onnx": true,
37
+ "model_fp16.onnx": true
38
+ }
39
+ },
40
+ "transformers_version": "5.5.0",
41
+ "use_cache": true,
42
+ "vocab_size": 49152,
43
+ "rope_theta": 130000,
44
+ "torch_dtype": "bfloat16"
45
+ }
 
 
 
 
 
generation_config.json CHANGED
@@ -1,10 +1,7 @@
1
  {
2
  "_from_model_config": true,
3
  "bos_token_id": 1,
4
- "eos_token_id": [
5
- 2
6
- ],
7
- "max_length": 8192,
8
- "pad_token_id": 0,
9
  "transformers_version": "5.5.0"
10
  }
 
1
  {
2
  "_from_model_config": true,
3
  "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 2,
 
 
 
6
  "transformers_version": "5.5.0"
7
  }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f84bad0cbadc4b908fbfe6d350ff025df2d229a3e82e3caeeb526410ef8e26c
3
+ size 3422777952
tokenizer_config.json CHANGED
@@ -5,153 +5,10 @@
5
  "clean_up_tokenization_spaces": false,
6
  "eos_token": "<|im_end|>",
7
  "errors": "replace",
8
- "extra_special_tokens": [
9
- "<|im_start|>",
10
- "<|im_end|>"
11
- ],
12
- "is_local": false,
13
  "model_max_length": 8192,
14
- "pad_token": "<|endoftext|>",
15
- "padding_side": "left",
16
  "tokenizer_class": "GPT2Tokenizer",
17
  "unk_token": "<|endoftext|>",
18
- "vocab_size": 49152,
19
- "added_tokens_decoder": {
20
- "0": {
21
- "content": "<|endoftext|>",
22
- "single_word": false,
23
- "lstrip": false,
24
- "rstrip": false,
25
- "normalized": false,
26
- "special": true
27
- },
28
- "1": {
29
- "content": "<|im_start|>",
30
- "single_word": false,
31
- "lstrip": false,
32
- "rstrip": false,
33
- "normalized": false,
34
- "special": true
35
- },
36
- "2": {
37
- "content": "<|im_end|>",
38
- "single_word": false,
39
- "lstrip": false,
40
- "rstrip": false,
41
- "normalized": false,
42
- "special": true
43
- },
44
- "3": {
45
- "content": "<repo_name>",
46
- "single_word": false,
47
- "lstrip": false,
48
- "rstrip": false,
49
- "normalized": false,
50
- "special": true
51
- },
52
- "4": {
53
- "content": "<reponame>",
54
- "single_word": false,
55
- "lstrip": false,
56
- "rstrip": false,
57
- "normalized": false,
58
- "special": true
59
- },
60
- "5": {
61
- "content": "<file_sep>",
62
- "single_word": false,
63
- "lstrip": false,
64
- "rstrip": false,
65
- "normalized": false,
66
- "special": true
67
- },
68
- "6": {
69
- "content": "<filename>",
70
- "single_word": false,
71
- "lstrip": false,
72
- "rstrip": false,
73
- "normalized": false,
74
- "special": true
75
- },
76
- "7": {
77
- "content": "<gh_stars>",
78
- "single_word": false,
79
- "lstrip": false,
80
- "rstrip": false,
81
- "normalized": false,
82
- "special": true
83
- },
84
- "8": {
85
- "content": "<issue_start>",
86
- "single_word": false,
87
- "lstrip": false,
88
- "rstrip": false,
89
- "normalized": false,
90
- "special": true
91
- },
92
- "9": {
93
- "content": "<issue_comment>",
94
- "single_word": false,
95
- "lstrip": false,
96
- "rstrip": false,
97
- "normalized": false,
98
- "special": true
99
- },
100
- "10": {
101
- "content": "<issue_closed>",
102
- "single_word": false,
103
- "lstrip": false,
104
- "rstrip": false,
105
- "normalized": false,
106
- "special": true
107
- },
108
- "11": {
109
- "content": "<jupyter_start>",
110
- "single_word": false,
111
- "lstrip": false,
112
- "rstrip": false,
113
- "normalized": false,
114
- "special": true
115
- },
116
- "12": {
117
- "content": "<jupyter_text>",
118
- "single_word": false,
119
- "lstrip": false,
120
- "rstrip": false,
121
- "normalized": false,
122
- "special": true
123
- },
124
- "13": {
125
- "content": "<jupyter_code>",
126
- "single_word": false,
127
- "lstrip": false,
128
- "rstrip": false,
129
- "normalized": false,
130
- "special": true
131
- },
132
- "14": {
133
- "content": "<jupyter_output>",
134
- "single_word": false,
135
- "lstrip": false,
136
- "rstrip": false,
137
- "normalized": false,
138
- "special": true
139
- },
140
- "15": {
141
- "content": "<jupyter_script>",
142
- "single_word": false,
143
- "lstrip": false,
144
- "rstrip": false,
145
- "normalized": false,
146
- "special": true
147
- },
148
- "16": {
149
- "content": "<empty_output>",
150
- "single_word": false,
151
- "lstrip": false,
152
- "rstrip": false,
153
- "normalized": false,
154
- "special": true
155
- }
156
- }
157
  }
 
5
  "clean_up_tokenization_spaces": false,
6
  "eos_token": "<|im_end|>",
7
  "errors": "replace",
8
+ "is_local": true,
 
 
 
 
9
  "model_max_length": 8192,
10
+ "pad_token": "<|im_end|>",
 
11
  "tokenizer_class": "GPT2Tokenizer",
12
  "unk_token": "<|endoftext|>",
13
+ "vocab_size": 49152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }