cutterdalton-webai commited on
Commit
7ced750
·
verified ·
1 Parent(s): e309060

Add TwIL-LM2 weights (smollm2-1.7b-formal-logic-mgpo)

Browse files
Files changed (5) hide show
  1. README.md +147 -298
  2. config.json +43 -41
  3. generation_config.json +2 -5
  4. model.safetensors +3 -0
  5. tokenizer_config.json +3 -146
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,329 +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.
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
-
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
-
132
- The broader comparison includes checkpoints with different parameter counts,
133
- training procedures, and adaptation methods. It is useful for context but is not
134
- a controlled architecture or scaling study.
135
-
136
- TwiL-LM performs best on entailment labeling (**0.655**) and improves FOL
137
- translation (**0.235**, compared with approximately zero for the base). Lean
138
- formalization, Lean proving, and procedural reasoning remain weak.
139
-
140
- ### Out-of-Distribution (OOD) evaluation
141
-
142
- OOD transfer was measured on GSM8K, ARC-Challenge chain-of-thought,
143
- ARC-Challenge 25-shot log-likelihood (`acc_norm`), and LogicBench BQA.
144
-
145
- Compared with SmolLM2-1.7B, TwiL-LM improves LogicBench BQA
146
- (**0.590 vs 0.563**) but is lower on GSM8K (**0.380 vs 0.413**), ARC-C
147
- chain-of-thought (**0.463 vs 0.587**), and ARC-C 25-shot log-likelihood
148
- (**0.460 vs 0.490**).
149
-
150
- ### Throughput evaluation
151
-
152
-
153
- The formal-logic run generated 422,627 tokens in 1,152.34 generation seconds,
154
- or **366.8 aggregate tokens per second**. The configuration used a maximum of
155
- 1,024 new tokens per example. Outputs averaged 264.1 new tokens; the median was
156
- 92 tokens, the 90th percentile was 1,024 tokens, and 16.1% of outputs reached the
157
- generation limit.
158
-
159
- This is aggregate evaluation throughput, not single-request latency or a
160
- controlled serving benchmark. It depends on hardware, precision, backend,
161
- batching, prompt length, output length, and stopping behavior. The comparison
162
- runs did not consistently control all of these variables, so the figure should
163
- not be used to claim that LoRA intrinsically accelerates generation.
164
-
165
- ### Evaluation limitations
166
-
167
- - The formal-logic suite includes custom tasks and metrics and is not a standard
168
- Hugging Face benchmark dataset.
169
- - Some comparison checkpoints used different output limits and evaluation runs.
170
- - The evaluation primarily covers English.
171
- - The current records do not provide confidence intervals or repeated-seed
172
- variance.
173
- - Exact-match metrics can penalize semantically equivalent formal expressions.
174
- - The training corpus is not public, limiting independent contamination checks.
175
-
176
- Structured Hub evaluation files are not included because the internal suite is
177
- not registered as a Hugging Face Benchmark and the available records do not
178
- contain verified task IDs for the OOD benchmarks. The scores above are therefore
179
- reported in the card rather than submitted as verified Hub leaderboard results.
180
-
181
- ## How to use
182
-
183
- ### Installation and authentication
184
-
185
- The model repository may require access approval. Install the dependencies and
186
- authenticate with the Hugging Face Hub:
187
-
188
- ```bash
189
- pip install -U torch transformers peft accelerate huggingface_hub
190
- hf auth login
191
- ```
192
-
193
- ### Transformers with PEFT
194
 
195
  ```python
196
  import torch
197
- from peft import PeftModel
198
  from transformers import AutoModelForCausalLM, AutoTokenizer
199
 
200
- base_id = "HuggingFaceTB/SmolLM2-1.7B-Instruct"
201
- adapter_id = "webAI-Official/TwIL-LM"
202
-
203
- tokenizer = AutoTokenizer.from_pretrained(base_id)
204
- base_model = AutoModelForCausalLM.from_pretrained(
205
- base_id,
206
- torch_dtype="auto",
207
- device_map="auto",
208
  )
209
- model = PeftModel.from_pretrained(base_model, adapter_id)
210
- model.eval()
211
-
212
- messages = [
213
- {
214
- "role": "user",
215
- "content": "Translate to first-order logic: All cats are mammals.",
216
- }
217
- ]
218
- input_ids = tokenizer.apply_chat_template(
219
- messages,
220
- tokenize=True,
221
- add_generation_prompt=True,
222
- return_tensors="pt",
223
- ).to(model.device)
224
-
225
- with torch.inference_mode():
226
- output_ids = model.generate(
227
- input_ids,
228
- max_new_tokens=256,
229
- do_sample=False,
230
- )
231
-
232
- new_tokens = output_ids[0, input_ids.shape[-1]:]
233
- print(tokenizer.decode(new_tokens, skip_special_tokens=True))
234
- ```
235
-
236
- Use the base model's tokenizer and chat template. Loading the adapter over a
237
- different base checkpoint is unsupported and can cause incorrect output or tensor
238
- shape errors.
239
 
240
- ### llama.cpp with GGUF
241
-
242
- Download the model repository:
243
-
244
- ```bash
245
- hf download webAI-Official/TwIL-LM --local-dir TwIL-LM
246
- ```
247
-
248
- If the release contains a GGUF LoRA adapter, apply it to a GGUF converted from
249
- the matching SmolLM2-1.7B-Instruct base:
250
-
251
- ```bash
252
- llama-cli \
253
- -m /path/to/smollm2-1.7b-instruct-f16.gguf \
254
- --lora TwIL-LM/smollm2-lorav1-ps-lora-f16.gguf \
255
- -p "Translate to FOL: All cats are mammals." \
256
- -n 256
257
- ```
258
-
259
- If the release contains a merged GGUF, use it without `--lora`:
260
-
261
- ```bash
262
- llama-cli \
263
- -m TwIL-LM/smollm2-lorav1-ps-merged-Q4_K_M.gguf \
264
- -p "Translate to FOL: All cats are mammals." \
265
- -n 256
266
- ```
267
 
268
- GGUF filenames can vary between releases. Confirm the downloaded filenames
269
- before running these commands.
270
-
271
- ## Files and formats
272
-
273
- - `adapter_model.safetensors`: PEFT LoRA weights, approximately 289 MB.
274
- - `adapter_config.json`: PEFT configuration that identifies the required base
275
- model.
276
- - `smollm2-lorav1-ps-lora-f16.gguf`: optional GGUF LoRA adapter, approximately
277
- 145 MB.
278
- - Merged GGUF variants may be provided as FP16 (approximately 3.42 GB), Q8_0
279
- (1.82 GB), Q5_K_M (1.23 GB), or Q4_K_M (1.06 GB).
280
-
281
- Availability and filenames can vary by release. Quantized GGUF variants may not
282
- match the evaluation quality reported for the original adapter; validate the
283
- selected artifact on the target workload.
284
-
285
- ## Limitations, risks, and biases
286
-
287
- - **Not a verifier:** Plausible-looking FOL or Lean output can be syntactically or
288
- semantically wrong. Use a symbolic solver, Lean/Mathlib, or expert review.
289
- - **Narrow specialization:** The adapter is designed for formal logic, not as a
290
- replacement for a general-purpose assistant.
291
- - **Mixed OOD performance:** Improvements on LogicBench do not transfer
292
- consistently to GSM8K or ARC-Challenge.
293
- - **Small-model capacity:** Long reasoning chains, deeply nested quantifiers,
294
- complex rule induction, and long formal contexts can fail or hallucinate.
295
- - **Synthetic-data artifacts:** Synthetic examples and LLM verification can
296
- introduce systematic style, content, or verifier bias.
297
- - **English-first:** Performance in other languages is not established.
298
- - **Base-model inheritance:** The adapter retains the base model's limitations,
299
- biases, and potential for unsafe or inaccurate content.
300
- - **Context limit:** Inputs near 8,192 tokens leave less room for generation and
301
- can be truncated by serving frameworks.
302
- - **Quantization effects:** Q4 and Q5 builds may change formal-token generation
303
- and exact-match accuracy.
304
- - **No uncertainty calibration:** Scores do not establish that model confidence
305
- corresponds to correctness.
306
-
307
- ## Environmental impact
308
-
309
- Training-energy use, hardware type, training duration, datacenter region, and
310
- carbon emissions were not recorded in the available release artifacts. No
311
- emissions estimate is provided. Inference impact varies with hardware, precision,
312
- quantization, sequence length, and utilization.
313
-
314
- ## License
315
-
316
- The model weights are distributed under the
317
- [webAI Non-Commercial License ver. 1.0](https://huggingface.co/webAI-Official/webAI-ColVec1-4b/blob/main/LICENSE.md).
318
- Review that license and the
319
- [SmolLM2 base-model terms](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct)
320
- before use. The license applied to source code in this repository does not
321
- override the model-weight license.
322
-
323
- ## Citation
324
-
325
- ```bibtex
326
- @misc{twil_lm_1_7b,
327
- title = {TwiL-LM(1.7B) Formal-Logic LoRA},
328
- author = {webAI Intelligence Lab},
329
- year = {2026},
330
- url = {https://huggingface.co/webAI-Official/TwIL-LM}
331
- }
332
  ```
333
 
334
- ## Contact
335
-
336
- For model questions, licensing requests, or reports of harmful behavior, use the
337
- Community tab of the
338
- [webAI-Official/TwIL-LM](https://huggingface.co/webAI-Official/TwIL-LM)
339
- 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.
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
  }