Text Generation
Transformers
Safetensors
GGUF
English
llama
formal-logic
reasoning
lora
model-merging
wise-ft
reinforcement-learning
grpo
smollm2
twil-lm
conversational
text-generation-inference
Instructions to use webAI-Official/TwIL-LM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use webAI-Official/TwIL-LM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="webAI-Official/TwIL-LM") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("webAI-Official/TwIL-LM") model = AutoModelForCausalLM.from_pretrained("webAI-Official/TwIL-LM", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use webAI-Official/TwIL-LM with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf webAI-Official/TwIL-LM:Q4_K_M # Run inference directly in the terminal: llama cli -hf webAI-Official/TwIL-LM:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf webAI-Official/TwIL-LM:Q4_K_M # Run inference directly in the terminal: llama cli -hf webAI-Official/TwIL-LM:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf webAI-Official/TwIL-LM:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf webAI-Official/TwIL-LM:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf webAI-Official/TwIL-LM:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf webAI-Official/TwIL-LM:Q4_K_M
Use Docker
docker model run hf.co/webAI-Official/TwIL-LM:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use webAI-Official/TwIL-LM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "webAI-Official/TwIL-LM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "webAI-Official/TwIL-LM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/webAI-Official/TwIL-LM:Q4_K_M
- SGLang
How to use webAI-Official/TwIL-LM with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "webAI-Official/TwIL-LM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "webAI-Official/TwIL-LM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "webAI-Official/TwIL-LM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "webAI-Official/TwIL-LM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use webAI-Official/TwIL-LM with Ollama:
ollama run hf.co/webAI-Official/TwIL-LM:Q4_K_M
- Unsloth Studio
How to use webAI-Official/TwIL-LM with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for webAI-Official/TwIL-LM to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for webAI-Official/TwIL-LM to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for webAI-Official/TwIL-LM to start chatting
- Docker Model Runner
How to use webAI-Official/TwIL-LM with Docker Model Runner:
docker model run hf.co/webAI-Official/TwIL-LM:Q4_K_M
- Lemonade
How to use webAI-Official/TwIL-LM with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull webAI-Official/TwIL-LM:Q4_K_M
Run and chat with the model
lemonade run user.TwIL-LM-Q4_K_M
List all available models
lemonade list
- Atomic Chat
Add highlights and model details, refresh comparison tables
#3
by anurag051194 - opened
README.md
CHANGED
|
@@ -27,60 +27,189 @@ through LoRA supervised fine-tuning, checkpoint fusion, WiSE-FT weight interpola
|
|
| 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)
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
## Results
|
| 37 |
|
| 38 |
### Track A β in-domain formal logic
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
| 46 |
-
|
|
| 47 |
-
|
|
| 48 |
-
|
|
| 49 |
-
|
|
| 50 |
-
|
|
| 51 |
-
|
|
| 52 |
-
|
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
### Track B β held-out benchmarks
|
| 59 |
|
| 60 |
-
Nothing in this suite was trained on.
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
| | SmolLM2-1.7B-
|
| 64 |
-
|---|---
|
| 65 |
-
|
|
| 66 |
-
|
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
| 71 |
-
|
|
| 72 |
-
|
|
| 73 |
-
|
|
| 74 |
-
|
|
| 75 |
-
|
|
| 76 |
-
|
|
| 77 |
-
|
|
| 78 |
-
|
|
| 79 |
-
|
| 80 |
-
**
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
## Usage
|
| 86 |
|
|
@@ -109,18 +238,73 @@ print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=Tru
|
|
| 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
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
budget truncates reasoning and scores far worse.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
## Limitations and caveats
|
| 118 |
|
| 119 |
-
**
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
**Scope.** Tuned for formal logic. The Track B suite does not cover code generation or tool use
|
| 126 |
(HumanEval, LiveCodeBench and BFCL were not run for this model or its base), so this release
|
|
@@ -130,9 +314,9 @@ makes no claim about those.
|
|
| 130 |
safety tuning beyond whatever the base model carries, and no instruction-following alignment
|
| 131 |
work β IFEval in fact regressed.
|
| 132 |
|
| 133 |
-
**Failed consolidation stage.** A post-RL self-distillation round (SDFT) was attempted to
|
| 134 |
-
held-out capability and made both tracks worse at every budget tried. It is not part of
|
| 135 |
-
model. See the accompanying `SDFT_RESULT.md` in the project repository.
|
| 136 |
|
| 137 |
## Evaluation protocol
|
| 138 |
|
|
@@ -141,25 +325,33 @@ model. See the accompanying `SDFT_RESULT.md` in the project repository.
|
|
| 141 |
- Track B: 300 examples per task, greedy, `max_gen_toks = 4096`, `max_model_len = 8192`,
|
| 142 |
`repetition_penalty = 1.0`, chat template applied, vLLM backend.
|
| 143 |
- Both tracks use the same protocol for the model and its base, in a paired run over identical
|
| 144 |
-
sampled rows.
|
| 145 |
|
| 146 |
`repetition_penalty = 1.0` is load-bearing. A 1.1 penalty produced apparent 20-point swings on
|
| 147 |
Track B that were pure decoding artefact; the decoding kwargs are hashed into the protocol
|
| 148 |
identity so a mismatched runner fails loudly instead of quietly producing a different number.
|
| 149 |
|
|
|
|
|
|
|
|
|
|
| 150 |
## Relationship to prior releases
|
| 151 |
|
| 152 |
-
`main` holds **TwIL-LM2**: a **full merged model** from
|
| 153 |
-
WiSE-FT interpolation and MGPO reinforcement learning β so
|
| 154 |
-
`AutoModelForCausalLM`, with no adapter and no base checkpoint required.
|
|
|
|
| 155 |
|
| 156 |
-
The original TwIL-LM (v1) release β a PEFT **LoRA adapter**
|
| 157 |
-
|
| 158 |
-
|
| 159 |
|
| 160 |
The two are scored on different protocols and their headline numbers are not directly
|
| 161 |
comparable: v1 reports a macro-*primary* average, while this card reports the five-component
|
| 162 |
-
macro *gate* described above.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
## License and attribution
|
| 165 |
|
|
|
|
| 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), and on the strict, no-partial-credit reading of Track A it is the
|
| 31 |
+
strongest model we have measured at any size β ahead of Qwen3-8B and of a 26B Gemma-4 MoE.
|
| 32 |
+
|
| 33 |
+
Its larger sibling, [**TwIL-LM3**](https://huggingface.co/webAI-Official/TwIL-LM3) (3B, from SmolLM3),
|
| 34 |
+
trades a smaller in-domain gain for strictly better held-out retention. If you care about not
|
| 35 |
+
regressing on general benchmarks, prefer that one.
|
| 36 |
+
|
| 37 |
+
## Highlights
|
| 38 |
+
|
| 39 |
+
* **Best strict-7 score of any model we have evaluated** β 0.2386, against 0.2093 for Qwen3-8B
|
| 40 |
+
and 0.2050 for Gemma-4-26B-A4B-it. Strict-7 gives no loose-match or partial credit anywhere,
|
| 41 |
+
so it rewards emitting the exactly-requested form rather than merely reasoning near it.
|
| 42 |
+
* **Structured-output accuracy is where the gain lands.** Semantic parsing token-F1 0.8428 and
|
| 43 |
+
Lean formalisation token-F1 0.6199 are both the highest in the comparison table below, by
|
| 44 |
+
margins of roughly 0.39 and 0.21 over the next model.
|
| 45 |
+
* **Rule induction nearly quadruples and entailment more than doubles** over the base model
|
| 46 |
+
(0.135 β 0.514 derivation score, 0.245 β 0.585 accuracy).
|
| 47 |
+
* **Formatted answering becomes possible at all.** Strict MCQ accuracy moves 0.000 β 0.160,
|
| 48 |
+
where every other model in the comparison table scores 0.020 or below β including both
|
| 49 |
+
8B-and-larger arms, which answer the question correctly but almost never in the requested form.
|
| 50 |
+
* **Lowest perplexity in the table on both held-out corpora** (2.2981 language, 3.0390 maths),
|
| 51 |
+
including against models up to fifteen times its size.
|
| 52 |
+
* **Short answers.** Track A generations average 460 tokens against the base model's 719, at
|
| 53 |
+
14,963 tok/s decode on one H100 β roughly 32 completed answers per second.
|
| 54 |
+
* **Runs anywhere.** 1.7B parameters in bf16, with Q4\_K\_M GGUF at 0.98 GiB for CPU or 2 GB of
|
| 55 |
+
VRAM.
|
| 56 |
+
|
| 57 |
+
Two things this model is **not**: it is not a general assistant (see
|
| 58 |
+
[Limitations](#limitations-and-caveats)), and it does not preserve held-out benchmark
|
| 59 |
+
performance β it gives back about a point of Track B macro relative to its base, which is the
|
| 60 |
+
trade TwIL-LM3 was built to avoid.
|
| 61 |
+
|
| 62 |
+
## Model Details
|
| 63 |
+
|
| 64 |
+
| Property | Value |
|
| 65 |
+
| ------------------------- | --------------------------------------------------------------------------------------------------- |
|
| 66 |
+
| Model ID | `webAI-Official/TwIL-LM` (weights on `main`) |
|
| 67 |
+
| Base model | [`HuggingFaceTB/SmolLM2-1.7B-Instruct`](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct) |
|
| 68 |
+
| Total parameters | 1.71B |
|
| 69 |
+
| Architecture | Llama-style decoder-only transformer; 24 layers, hidden size 2048 |
|
| 70 |
+
| Input / output | Text / text |
|
| 71 |
+
| Language | English |
|
| 72 |
+
| Tokenizer vocabulary size | 49,152 |
|
| 73 |
+
| Context window | 8,192 tokens |
|
| 74 |
+
| Checkpoint precision | bfloat16 (3.19 GiB), plus Q4\_K\_M / Q5\_K\_M / Q8\_0 / F16 GGUF builds |
|
| 75 |
+
| Post-training | LoRA SFT β checkpoint fusion β WiSE-FT (Ξ» = 0.75) β MGPO reinforcement learning (step 1680) |
|
| 76 |
+
| Reasoning format | Emits a `<think>β¦</think>` block before the answer |
|
| 77 |
+
| Evaluated decoding | Greedy, 2048 new tokens, `max_seq_len` 8192 |
|
| 78 |
+
| Specialisation | Formal logic: FOL translation, entailment, semantic parsing, Lean formalisation and critique |
|
| 79 |
+
| License | webAI Non-Commercial License ver. 1.0 |
|
| 80 |
+
|
| 81 |
+
The base model's 8,192-token context is carried through unchanged; nothing in this pipeline
|
| 82 |
+
extends or reduces it, and every reported score was measured inside that window.
|
| 83 |
|
| 84 |
## Results
|
| 85 |
|
| 86 |
### Track A β in-domain formal logic
|
| 87 |
|
| 88 |
+
Every arm below ran through the same harness, prompts and decoding settings described under
|
| 89 |
+
[Evaluation protocol](#evaluation-protocol) β 200 prompts per objective, greedy, 2048 new
|
| 90 |
+
tokens.
|
| 91 |
+
|
| 92 |
+
| lane / metric | TwIL-LM2 | SmolLM2-1.7B base | LFM2.5-1.2B-Thinking | LFM2-2.6B | Granite-4.1-3B | Llama-3.2-3B | Qwen3-8B | Gemma-4-26B-A4B-it |
|
| 93 |
+
| -------------------------- | ---------- | ----------------- | -------------------- | --------- | -------------- | ------------ | ---------- | ------------------ |
|
| 94 |
+
| parameters | 1.7B | 1.7B | 1.2B | 2.6B | 3B | 3B | 8B | 26B (4B active) |
|
| 95 |
+
| lean\_formalize token\_f1 | **0.6199** | 0.1087 | 0.1890 | 0.1321 | 0.2652 | 0.3690 | 0.4022 | 0.4107 |
|
| 96 |
+
| rule\_induction derivation | 0.5136 | 0.1350 | 0.0837 | 0.0615 | 0.2476 | 0.0825 | 0.3680 | **0.7319** |
|
| 97 |
+
| entailment\_label accuracy | 0.5850 | 0.2450 | 0.4700 | 0.4700 | 0.4900 | 0.3300 | 0.5800 | **0.6200** |
|
| 98 |
+
| mcq\_answer accuracy | **0.1600** | 0.0000 | 0.0000 | 0.0150 | 0.0100 | 0.0000 | 0.0000 | 0.0200 |
|
| 99 |
+
| semantic\_parse token\_f1 | **0.8428** | 0.2155 | 0.4439 | 0.3665 | 0.1953 | 0.3102 | 0.4257 | 0.4567 |
|
| 100 |
+
| lean\_critic accuracy | 0.5250 | 0.4950 | 0.5450 | 0.5900 | 0.5150 | 0.5300 | **0.7950** | 0.7500 |
|
| 101 |
+
| lm\_corpus perplexity β | **2.2981** | 2.5845 | 5.0065 | 4.3815 | 2.4736 | 2.8478 | 2.5440 | 16.1145 |
|
| 102 |
+
| math\_corpus perplexity β | **3.0390** | 3.2670 | 7.7402 | 6.7472 | 4.1162 | 4.7531 | 4.0083 | 59.7838 |
|
| 103 |
+
| average, 6 lanes | **0.5410** | 0.1999 | 0.2886 | 0.2725 | 0.2872 | 0.2703 | 0.4285 | 0.4982 |
|
| 104 |
+
| **strict-7** | **0.2386** | 0.1071 | 0.1450 | 0.1579 | 0.1507 | 0.1229 | 0.2093 | 0.2050 |
|
| 105 |
+
| **macro gate** | 0.3927 | 0.2590 β | 0.3067 | 0.3473 | 0.3435 | 0.2925 | 0.5336 | **0.6344** |
|
| 106 |
+
| macro\_primary | 0.3625 | 0.2900 | 0.3625 | 0.4188 | 0.3675 | 0.3450 | 0.5750 | **0.6100** |
|
| 107 |
+
| mean generation length β | 460 | 719 | 2464 | 2296 | **246** | 696 | 2094 | 1183 |
|
| 108 |
+
|
| 109 |
+
β The base column comes from the external-comparison run rather than the paired base-vs-TwIL
|
| 110 |
+
run, hence 0.2590 against the 0.2630 quoted in the summary at the top of this card β
|
| 111 |
+
run-to-run variation of the same checkpoint. The paired run is the correct basis for the
|
| 112 |
+
improvement claim.
|
| 113 |
+
|
| 114 |
+
**`average, 6 lanes`** is the plain mean of the six objective rows above it, each at whatever
|
| 115 |
+
scoring that row reports. It mixes token-F1 with accuracy, so it is coarse, but it is the
|
| 116 |
+
broadest summary every arm can be compared on.
|
| 117 |
+
|
| 118 |
+
The three rows after it aggregate more carefully, and none of them include the perplexity lanes
|
| 119 |
+
or the token-F1 scorings, which are not on a common 0β1 accuracy scale.
|
| 120 |
+
|
| 121 |
+
**`strict-7`** is the mean of seven lanes scored under strict metrics only (`fol_translation`,
|
| 122 |
+
`entailment_label`, `mcq_answer`, `semantic_parse` and `lean_formalize` exact match,
|
| 123 |
+
`lean_critic` and `procedural` accuracy), with no loose-match credit anywhere. Exact match on
|
| 124 |
+
generative lanes is near zero for every model, so it is a harsh scale β useful for ranking
|
| 125 |
+
models against each other rather than as an absolute capability measure.
|
| 126 |
+
|
| 127 |
+
**`macro gate`** is the metric the training pipeline gates on: the equal-weight mean of the four
|
| 128 |
+
bounded classification lanes (`entailment_label`, `mcq_answer`, `procedural`, `lean_critic`)
|
| 129 |
+
plus `rule_induction`, scored by its continuous derivation score. Rule induction is included
|
| 130 |
+
specifically so a fine-tune cannot pass the gate while quietly regressing inductive reasoning.
|
| 131 |
+
In the gate, `mcq_answer` and `procedural` are credited as `max(exact_match, loose_match)`: for
|
| 132 |
+
free-text answer lanes, a response that is correct but differently formatted is a formatting
|
| 133 |
+
artefact rather than a reasoning failure. This affects the aggregate only β the per-lane rows
|
| 134 |
+
above stay strict.
|
| 135 |
+
|
| 136 |
+
**`macro_primary`** is the same mean over the four classification lanes alone, without
|
| 137 |
+
`rule_induction`. It is kept for comparability with earlier reports, and it is the one summary
|
| 138 |
+
where TwIL-LM2 looks unremarkable: it excludes all three lanes this model is strongest on
|
| 139 |
+
(`semantic_parse`, `lean_formalize`, `rule_induction`) and it credits loose matches, which is
|
| 140 |
+
where the larger models recover most of their score.
|
| 141 |
+
|
| 142 |
+
Read against models at its own scale, TwIL-LM2 wins outright. It beats its own base on all six
|
| 143 |
+
objective lanes and all four summary rows, and it beats every 1β3B arm here on strict-7 by at
|
| 144 |
+
least 0.08.
|
| 145 |
+
|
| 146 |
+
The more interesting comparison is upward. On **strict-7 it leads the entire table** β 0.2386
|
| 147 |
+
against 0.2093 for Qwen3-8B (4.7x the parameters) and 0.2050 for Gemma-4-26B-A4B-it β and it
|
| 148 |
+
holds the best six-lane average at 0.5410 against Gemma's 0.4982. It also has the lowest
|
| 149 |
+
perplexity in the table on both corpora.
|
| 150 |
+
|
| 151 |
+
It does not lead the macro gate, where Gemma-4-26B-A4B-it reaches 0.6344 and Qwen3-8B 0.5336
|
| 152 |
+
against 0.3927. Most of that gap is partial credit rather than capability: the gate credits
|
| 153 |
+
`mcq_answer` and `procedural` at `max(exact_match, loose_match)`, and both larger models answer
|
| 154 |
+
those lanes correctly while almost never producing the requested form β Qwen3-8B's strict MCQ
|
| 155 |
+
accuracy is 0.0000 against TwIL-LM2's 0.1600. Gemma also genuinely leads rule induction
|
| 156 |
+
(0.7319) and entailment (0.6200), which no amount of scoring convention explains away.
|
| 157 |
+
|
| 158 |
+
So the honest reading is a split one. If what you need is a model that emits exactly the
|
| 159 |
+
demanded formal object β a parse, a Lean statement, a bare label β this is the strongest option
|
| 160 |
+
in the table and by some distance the smallest. If what you need is a model that gets the answer
|
| 161 |
+
approximately right in free text, the 8B and 26B arms are better.
|
| 162 |
|
| 163 |
### Track B β held-out benchmarks
|
| 164 |
|
| 165 |
+
Nothing in this suite was trained on. All arms are scored by the same aggregation over 300
|
| 166 |
+
randomly sampled, model-identical examples per dataset.
|
| 167 |
+
|
| 168 |
+
| dataset | TwIL-LM2 | SmolLM2-1.7B base | LFM2.5-1.2B-Thinking | LFM2-2.6B | Granite-4.1-3B | Llama-3.2-3B | Qwen3-8B | Gemma-4-26B-A4B-it |
|
| 169 |
+
| --------------------------- | -------- | ----------------- | -------------------- | ---------- | -------------- | ------------ | ---------- | ------------------ |
|
| 170 |
+
| gsm8k | 0.4633 | 0.4800 | 0.8400 | 0.8767 | 0.9100 | 0.8300 | 0.9567 | **0.9733** |
|
| 171 |
+
| svamp | 0.3833 | 0.4867 | 0.9167 | 0.9000 | 0.9000 | 0.8200 | 0.9367 | **0.9500** |
|
| 172 |
+
| gsm\_symbolic | 0.2600 | 0.2200 | 0.6867 | 0.9767 | 0.9533 | 0.8067 | 0.8133 | **0.9967** |
|
| 173 |
+
| arc\_cot | 0.5200 | 0.5100 | 0.8300 | 0.8667 | 0.8633 | 0.7967 | 0.9633 | **0.9767** |
|
| 174 |
+
| logicbench | 0.5400 | 0.5067 | 0.6700 | 0.6267 | 0.7367 | 0.5733 | 0.8567 | **0.8667** |
|
| 175 |
+
| strategyqa | 0.5900 | 0.6000 | 0.5933 | 0.6433 | 0.6333 | 0.6533 | 0.7400 | **0.7700** |
|
| 176 |
+
| drop | 0.4367 | 0.4233 | 0.6667 | 0.6900 | 0.7600 | 0.6733 | **0.8833** | 0.7933 |
|
| 177 |
+
| csqa | 0.4333 | 0.3967 | 0.6100 | 0.7433 | 0.7633 | 0.7500 | **0.8633** | **0.8633** |
|
| 178 |
+
| musr | 0.3131 | 0.4223 | 0.5227 | 0.4867 | 0.5669 | 0.4932 | 0.6301 | **0.6369** |
|
| 179 |
+
| mmlu\_redux | 0.3933 | 0.4100 | 0.6400 | 0.7133 | 0.6800 | 0.6000 | 0.8500 | **0.9633** |
|
| 180 |
+
| ifeval | 0.4300 | 0.4700 | 0.8233 | 0.7300 | 0.7967 | 0.7167 | 0.8400 | **0.8733** |
|
| 181 |
+
| rudas\_ood | 0.0289 | 0.0128 | 0.0089 | 0.0017 | 0.0355 | 0.0733 | 0.0468 | **0.1547** |
|
| 182 |
+
| bbh\_logic | 0.2373 | 0.2447 | 0.5327 | 0.5713 | 0.7727 | 0.5333 | 0.6367 | **0.9940** |
|
| 183 |
+
| math500 | 0.2100 | 0.1900 | 0.6867 | 0.7133 | 0.6067 | 0.4233 | 0.6100 | **0.9000** |
|
| 184 |
+
| **macro (10 CoT datasets)** | 0.4333 | 0.4456 | 0.6976 | 0.7523 | 0.7767 | 0.6997 | 0.8493 | **0.8790** |
|
| 185 |
+
| **macro (all 14)** | 0.3742 | 0.3838 | 0.6448 | 0.6814 | 0.7127 | 0.6245 | 0.7591 | **0.8366** |
|
| 186 |
+
|
| 187 |
+
The 10-dataset macro covers the chain-of-thought reasoning and QA sets (`gsm8k`, `svamp`,
|
| 188 |
+
`gsm_symbolic`, `arc_cot`, `logicbench`, `strategyqa`, `drop`, `csqa`, `musr`, `mmlu_redux`);
|
| 189 |
+
the 14-dataset macro adds `ifeval`, `rudas_ood`, `bbh_logic` and `math500`.
|
| 190 |
+
|
| 191 |
+
**TwIL-LM2 is last in this table, and slightly below its own base.** The 10-dataset macro moves
|
| 192 |
+
0.4456 β 0.4333 and the 14-dataset macro 0.3838 β 0.3742, so roughly one point is given back on
|
| 193 |
+
both. Every other arm is larger, and the ordering is close to a size ordering, so the only
|
| 194 |
+
like-for-like comparison here is against SmolLM2-1.7B β and that comparison is mildly negative.
|
| 195 |
+
|
| 196 |
+
Per dataset, the moves against the base go in both directions:
|
| 197 |
+
|
| 198 |
+
| dataset | base | TwIL-LM2 | Ξ |
|
| 199 |
+
| ------------- | ------ | -------- | ------ |
|
| 200 |
+
| gsm\_symbolic | 0.2200 | 0.2600 | +0.040 |
|
| 201 |
+
| csqa | 0.3967 | 0.4333 | +0.037 |
|
| 202 |
+
| logicbench | 0.5067 | 0.5400 | +0.033 |
|
| 203 |
+
| math500 | 0.1900 | 0.2100 | +0.020 |
|
| 204 |
+
| ifeval | 0.4700 | 0.4300 | β0.040 |
|
| 205 |
+
| svamp | 0.4867 | 0.3833 | β0.103 |
|
| 206 |
+
| musr | 0.4223 | 0.3131 | β0.109 |
|
| 207 |
+
|
| 208 |
+
The pattern is coherent: the sets that reward committing to a discrete, checkable answer improve
|
| 209 |
+
(symbolic arithmetic, commonsense MCQ, propositional logic), and the sets that reward
|
| 210 |
+
open-ended multi-step narrative reasoning lose (MuSR, SVAMP word problems). Instruction
|
| 211 |
+
following also regresses, which is expected of a model tuned against verifiers rather than
|
| 212 |
+
preferences. **This model does not pass a no-regression bar on held-out tasks.**
|
| 213 |
|
| 214 |
## Usage
|
| 215 |
|
|
|
|
| 238 |
`return_dict=True` matters on transformers 5.x, where `apply_chat_template` returns a
|
| 239 |
`BatchEncoding` rather than a bare tensor; the above works on both 4.x and 5.x.
|
| 240 |
|
| 241 |
+
The reported numbers use **greedy decoding** (`do_sample=False`) and a **2048-token** generation
|
| 242 |
+
budget. The shipped `generation_config.json` carries no sampling defaults, so greedy is what you
|
| 243 |
+
get unless you ask for otherwise. The model opens a `<think>...</think>` reasoning block before
|
| 244 |
+
answering, so give it room β a short budget truncates the reasoning and scores far worse.
|
| 245 |
+
|
| 246 |
+
### GGUF / llama.cpp
|
| 247 |
+
|
| 248 |
+
Quantized GGUF builds ship alongside the safetensors weights. The `llama` architecture is fully
|
| 249 |
+
supported by llama.cpp, and the chat template, `<|im_end|>` EOS and BOS are carried into the
|
| 250 |
+
GGUF metadata, so chat mode works without extra flags.
|
| 251 |
+
|
| 252 |
+
| file | quant | size | bits/weight | notes |
|
| 253 |
+
| ---------------------- | -------- | -------- | ----------- | ------------------------------------------------- |
|
| 254 |
+
| TwIL-LM2-Q4\_K\_M.gguf | Q4\_K\_M | 0.98 GiB | 4.93 | recommended default; runs on CPU or 2 GB of VRAM |
|
| 255 |
+
| TwIL-LM2-Q5\_K\_M.gguf | Q5\_K\_M | 1.14 GiB | 5.73 | a little more headroom than Q4\_K\_M |
|
| 256 |
+
| TwIL-LM2-Q8\_0.gguf | Q8\_0 | 1.70 GiB | 8.51 | near-lossless, for quality-sensitive use |
|
| 257 |
+
| TwIL-LM2-F16.gguf | F16 | 3.19 GiB | 16.01 | unquantized, for requantization or reference runs |
|
| 258 |
+
|
| 259 |
+
```bash
|
| 260 |
+
llama-cli -m TwIL-LM2-Q4_K_M.gguf -cnv --temp 0 -n 2048
|
| 261 |
+
```
|
| 262 |
+
|
| 263 |
+
Pass `--temp 0` and leave the generation budget at 2048 tokens or more: the model emits a
|
| 264 |
+
`<think>` block before answering, and truncating it costs far more accuracy than the
|
| 265 |
+
quantization does.
|
| 266 |
+
|
| 267 |
+
F16 was produced directly by `convert_hf_to_gguf.py` from the released bf16 weights; the
|
| 268 |
+
K-quants were quantized from the F16 build with `llama-quantize`, without an importance matrix.
|
| 269 |
+
Note that F16 is not bit-identical to the released weights: bf16 and f16 carry the same 16 bits
|
| 270 |
+
but trade exponent range against mantissa precision, so the conversion is a narrowing one, in
|
| 271 |
+
practice negligible for inference.
|
| 272 |
+
|
| 273 |
+
The published Track A and Track B numbers were measured on the **bf16** weights through vLLM,
|
| 274 |
+
not on any of these GGUF builds, so expect small deviations β most likely at Q4\_K\_M β that
|
| 275 |
+
have not been quantified here.
|
| 276 |
+
|
| 277 |
+
## How it was built
|
| 278 |
+
|
| 279 |
+
Four stages on top of the base model:
|
| 280 |
+
|
| 281 |
+
1. **LoRA supervised fine-tuning** on a synthetic formal-logic corpus covering the Track A
|
| 282 |
+
objectives (first-order-logic translation, entailment labelling, semantic parsing, Lean
|
| 283 |
+
formalisation and critique, procedural reasoning, rule induction).
|
| 284 |
+
2. **Checkpoint fusion** β parameter-space averaging of intermediate SFT checkpoints selected
|
| 285 |
+
by a diversity probe, rather than taking the final checkpoint.
|
| 286 |
+
3. **WiSE-FT interpolation** toward the pretrained base, `W = (1 β Ξ»)Β·W_base + λ·W_finetuned`
|
| 287 |
+
with **Ξ» = 0.75** β three quarters of the fine-tuned delta is retained. Ξ» was chosen by
|
| 288 |
+
constrained optimisation: maximise in-domain score subject to minimal degradation on held-out
|
| 289 |
+
benchmarks. TwIL-LM3 keeps only a quarter of its delta, and that difference is most of why it
|
| 290 |
+
holds Track B where this model does not.
|
| 291 |
+
4. **MGPO** β entropy-weighted GRPO reinforcement learning against a programmatic verifier,
|
| 292 |
+
with partial credit for loose matches and token-F1 so that all-fail prompt groups still
|
| 293 |
+
produce gradient. Published checkpoint is **step 1680**.
|
| 294 |
|
| 295 |
## Limitations and caveats
|
| 296 |
|
| 297 |
+
**Held-out regression.** The 10-dataset Track B macro moves 0.4456 β 0.4333 against the base.
|
| 298 |
+
An earlier revision of this card quoted a narrower five-dataset "core average" that showed a
|
| 299 |
+
small gain; the canonical 10- and 14-dataset macros in the table above are the numbers to use,
|
| 300 |
+
and both are slightly negative.
|
| 301 |
+
|
| 302 |
+
**Truncation.** At a 2048-token budget, 6.9% of Track A generations hit the cap, down from 11.7%
|
| 303 |
+
for the base. Our protocol marks a comparison `rankable` only below 2% truncation, so both the
|
| 304 |
+
base and this model are formally **not rankable** on Track A and the macro gate should be read
|
| 305 |
+
as indicative rather than exact. A truncated response scores zero regardless of whether its
|
| 306 |
+
reasoning was sound, so both numbers are pessimistic β the base more so, meaning the true gap is
|
| 307 |
+
probably narrower than +0.130.
|
| 308 |
|
| 309 |
**Scope.** Tuned for formal logic. The Track B suite does not cover code generation or tool use
|
| 310 |
(HumanEval, LiveCodeBench and BFCL were not run for this model or its base), so this release
|
|
|
|
| 314 |
safety tuning beyond whatever the base model carries, and no instruction-following alignment
|
| 315 |
work β IFEval in fact regressed.
|
| 316 |
|
| 317 |
+
**Failed consolidation stage.** A post-RL self-distillation round (SDFT) was attempted to
|
| 318 |
+
recover held-out capability and made both tracks worse at every budget tried. It is not part of
|
| 319 |
+
this model. See the accompanying `SDFT_RESULT.md` in the project repository.
|
| 320 |
|
| 321 |
## Evaluation protocol
|
| 322 |
|
|
|
|
| 325 |
- Track B: 300 examples per task, greedy, `max_gen_toks = 4096`, `max_model_len = 8192`,
|
| 326 |
`repetition_penalty = 1.0`, chat template applied, vLLM backend.
|
| 327 |
- Both tracks use the same protocol for the model and its base, in a paired run over identical
|
| 328 |
+
sampled rows. The comparison arms are scored on the same sampled rows as well.
|
| 329 |
|
| 330 |
`repetition_penalty = 1.0` is load-bearing. A 1.1 penalty produced apparent 20-point swings on
|
| 331 |
Track B that were pure decoding artefact; the decoding kwargs are hashed into the protocol
|
| 332 |
identity so a mismatched runner fails loudly instead of quietly producing a different number.
|
| 333 |
|
| 334 |
+
Track B is sampled at 300 examples per dataset for compute reasons. Absolute scores can shift on
|
| 335 |
+
the full sets, but the comparative ordering across models is stable.
|
| 336 |
+
|
| 337 |
## Relationship to prior releases
|
| 338 |
|
| 339 |
+
The `main` branch of this repository holds **TwIL-LM2**: a **full merged model** from a later
|
| 340 |
+
point in the pipeline β after fusion, WiSE-FT interpolation and MGPO reinforcement learning β so
|
| 341 |
+
it loads directly with `AutoModelForCausalLM`, with no adapter and no base checkpoint required.
|
| 342 |
+
It is also mirrored on the `TwIL-LM2` branch.
|
| 343 |
|
| 344 |
+
The original TwIL-LM (v1) release β a PEFT **LoRA adapter** for the supervised fine-tuning stage
|
| 345 |
+
only β is archived on the `TwIL-LM1` branch and matching tag. Load it with
|
| 346 |
+
`revision="TwIL-LM1"`.
|
| 347 |
|
| 348 |
The two are scored on different protocols and their headline numbers are not directly
|
| 349 |
comparable: v1 reports a macro-*primary* average, while this card reports the five-component
|
| 350 |
+
macro *gate* and the seven-lane strict mean described above.
|
| 351 |
+
|
| 352 |
+
[**TwIL-LM3**](https://huggingface.co/webAI-Official/TwIL-LM3) is the 3B member of the family, built from
|
| 353 |
+
SmolLM3 by the same pipeline. It gains less in-domain than this model but improves its held-out
|
| 354 |
+
scores at the same time, which this model does not.
|
| 355 |
|
| 356 |
## License and attribution
|
| 357 |
|