Text Generation
Transformers
Safetensors
GGUF
English
smollm3
formal-logic
reasoning
lora
model-merging
wise-ft
reinforcement-learning
grpo
twil-lm
conversational
Instructions to use webAI-Official/TwIL-LM3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use webAI-Official/TwIL-LM3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="webAI-Official/TwIL-LM3") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("webAI-Official/TwIL-LM3") model = AutoModelForCausalLM.from_pretrained("webAI-Official/TwIL-LM3", 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-LM3 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-LM3:Q4_K_M # Run inference directly in the terminal: llama cli -hf webAI-Official/TwIL-LM3: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-LM3:Q4_K_M # Run inference directly in the terminal: llama cli -hf webAI-Official/TwIL-LM3: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-LM3:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf webAI-Official/TwIL-LM3: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-LM3:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf webAI-Official/TwIL-LM3:Q4_K_M
Use Docker
docker model run hf.co/webAI-Official/TwIL-LM3:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use webAI-Official/TwIL-LM3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "webAI-Official/TwIL-LM3" # 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-LM3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/webAI-Official/TwIL-LM3:Q4_K_M
- SGLang
How to use webAI-Official/TwIL-LM3 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-LM3" \ --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-LM3", "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-LM3" \ --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-LM3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use webAI-Official/TwIL-LM3 with Ollama:
ollama run hf.co/webAI-Official/TwIL-LM3:Q4_K_M
- Unsloth Studio
How to use webAI-Official/TwIL-LM3 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-LM3 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-LM3 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-LM3 to start chatting
- Pi
How to use webAI-Official/TwIL-LM3 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf webAI-Official/TwIL-LM3:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "webAI-Official/TwIL-LM3:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- OpenClaw new
How to use webAI-Official/TwIL-LM3 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf webAI-Official/TwIL-LM3:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "webAI-Official/TwIL-LM3:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
- Docker Model Runner
How to use webAI-Official/TwIL-LM3 with Docker Model Runner:
docker model run hf.co/webAI-Official/TwIL-LM3:Q4_K_M
- Lemonade
How to use webAI-Official/TwIL-LM3 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull webAI-Official/TwIL-LM3:Q4_K_M
Run and chat with the model
lemonade run user.TwIL-LM3-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use webAI-Official/TwIL-LM3 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf webAI-Official/TwIL-LM3:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default webAI-Official/TwIL-LM3:Q4_K_M
Run Hermes
hermes
- Atomic Chat
Update TwIL-LM3: weights, tokenizer and model card
Browse files
README.md
CHANGED
|
@@ -82,13 +82,99 @@ Every regression is within 0.033, and the gains on logical-reasoning transfer ta
|
|
| 82 |
(LogicBench +0.070, DROP +0.047) are larger than any loss. IFEval is the one place worth
|
| 83 |
noting — instruction-following degrades slightly, which is a common cost of verifier-driven RL.
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
## Usage
|
| 86 |
|
| 87 |
```python
|
| 88 |
import torch
|
| 89 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 90 |
|
| 91 |
-
model_id = "webAI-Official/TwIL-LM3
|
| 92 |
tok = AutoTokenizer.from_pretrained(model_id)
|
| 93 |
model = AutoModelForCausalLM.from_pretrained(
|
| 94 |
model_id, torch_dtype=torch.bfloat16, device_map="auto"
|
|
@@ -115,6 +201,32 @@ budget. Note that the shipped `generation_config.json` inherits SmolLM3's sampli
|
|
| 115 |
explicitly to reproduce the evaluation. The model opens a `<think>...</think>` reasoning block
|
| 116 |
before answering, so a short generation budget truncates reasoning and scores far worse.
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
## How it was built
|
| 119 |
|
| 120 |
Four stages on top of the base model:
|
|
|
|
| 82 |
(LogicBench +0.070, DROP +0.047) are larger than any loss. IFEval is the one place worth
|
| 83 |
noting — instruction-following degrades slightly, which is a common cost of verifier-driven RL.
|
| 84 |
|
| 85 |
+
### Comparison against other open models
|
| 86 |
+
|
| 87 |
+
All arms below were run through the same harness, prompts and decoding settings described under
|
| 88 |
+
[Evaluation protocol](#evaluation-protocol). Throughput rows are reported because in-domain score
|
| 89 |
+
alone is misleading for a 3B model: `ans/s` is defined throughout as `tok/s ÷ mean generation
|
| 90 |
+
length`, so it measures completed answers rather than raw decode rate.
|
| 91 |
+
|
| 92 |
+
#### Track A — in-domain formal logic
|
| 93 |
+
|
| 94 |
+
| lane / metric | TwIL-LM3 | SmolLM3-3B base | Llama-3.2-3B | LFM2-2.6B | LFM2.5-8B-A1B | Qwen3-8B |
|
| 95 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 96 |
+
| lean_formalize token_f1 | **0.5869** | 0.4347 | 0.3690 | 0.1321 | 0.4655 | 0.4022 |
|
| 97 |
+
| rule_induction derivation | 0.3192 | 0.1029 | 0.0825 | 0.0615 | 0.1936 | **0.3680** |
|
| 98 |
+
| entailment_label accuracy | 0.5750 | 0.3750 | 0.3300 | 0.4700 | 0.5400 | **0.5800** |
|
| 99 |
+
| mcq_answer accuracy | **0.1100** | 0.0000 | 0.0000 | 0.0150 | 0.0750 | 0.0000 |
|
| 100 |
+
| semantic_parse token_f1 | **0.4416** | 0.4149 | 0.3102 | 0.3665 | 0.3778 | 0.4257 |
|
| 101 |
+
| lean_critic accuracy | 0.6600 | 0.6500 | 0.5300 | 0.5900 | 0.5500 | **0.7950** |
|
| 102 |
+
| lean_formalize exact_match | 0.0050 | 0.0050 | 0.0000 | 0.0000 | 0.0000 | 0.0050 |
|
| 103 |
+
| fol_translation exact_match | 0.0000 | 0.0050 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
|
| 104 |
+
| semantic_parse exact_match | 0.0000 | 0.0050 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
|
| 105 |
+
| procedural accuracy | 0.0300 | 0.0050 | 0.0000 | 0.0300 | 0.0350 | **0.0850** |
|
| 106 |
+
| procedural loose_match | 0.1100 | 0.1050 | 0.1050 | 0.1150 | 0.1400 | **0.1800** |
|
| 107 |
+
| mcq_answer loose_match | 0.4450 | 0.5000 | 0.4150 | 0.5000 | 0.4550 | **0.7450** |
|
| 108 |
+
| lm_corpus perplexity ↓ | 2.8972 | 3.1818 | 2.8478 | 4.3815 | 4.9472 | **2.5440** |
|
| 109 |
+
| math_corpus perplexity ↓ | **3.8229** | 4.0685 | 4.7531 | 6.7472 | 8.3323 | 4.0083 |
|
| 110 |
+
| **macro gate** | 0.4218 | 0.3466 † | 0.2925 | 0.3473 | 0.3757 | **0.5336** |
|
| 111 |
+
| **strict-7** | 0.1971 | 0.1493 | 0.1229 | 0.1579 | 0.1714 | **0.2093** |
|
| 112 |
+
| tok/s | 15880 | 15564 | 16160 | 25000 | 22000 | not measured |
|
| 113 |
+
| mean gen length | **564** | 999 | 696 | 2296 | 1830 | 2094 |
|
| 114 |
+
| **ans/s** | **28.1** | 15.6 | 23.2 | 10.9 | 12.0 | not measured |
|
| 115 |
+
|
| 116 |
+
† The base column here comes from the external-comparison run rather than the paired run used
|
| 117 |
+
for the Δ table above, hence 0.3466 against 0.3356 — run-to-run variation of the same
|
| 118 |
+
checkpoint. The paired run is the correct basis for the improvement claim.
|
| 119 |
+
|
| 120 |
+
`strict-7` is the mean of seven lanes scored under strict metrics only (`fol_translation`,
|
| 121 |
+
`entailment_label`, `mcq_answer`, `semantic_parse` and `lean_formalize` exact match,
|
| 122 |
+
`lean_critic` and `procedural` accuracy), with no loose-match credit anywhere.
|
| 123 |
+
|
| 124 |
+
Qwen3-8B takes the macro gate at roughly 2.7x the parameter count, driven by the classification
|
| 125 |
+
lanes — `lean_critic` 0.7950 and loose MCQ 0.7450. TwIL-LM3 holds the two lanes this pipeline
|
| 126 |
+
targets most directly, `lean_formalize` token-F1 (0.5869 against 0.4022) and strict MCQ accuracy
|
| 127 |
+
(0.1100, the only non-trivial value in that row), and it is the most efficient arm in the table
|
| 128 |
+
by a wide margin: 28.1 answers/sec, from generations averaging 564 tokens where every other arm
|
| 129 |
+
except Llama runs past 690.
|
| 130 |
+
|
| 131 |
+
#### Track B — held-out benchmarks
|
| 132 |
+
|
| 133 |
+
| dataset | TwIL-LM3 | SmolLM3-3B base | Llama-3.2-3B | LFM2-2.6B | LFM2.5-8B-A1B | Qwen3-8B | gpt-oss-120b ‡ |
|
| 134 |
+
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 135 |
+
| gsm8k | 0.8733 | 0.8833 | 0.8300 | 0.8767 | 0.9133 | 0.9567 | **0.9767** |
|
| 136 |
+
| svamp | 0.8500 | 0.8567 | 0.8200 | 0.9000 | 0.9133 | **0.9400** | **0.9400** |
|
| 137 |
+
| gsm_symbolic | 0.7567 | 0.7633 | 0.8067 | **0.9767** | 0.9267 | 0.8133 | 0.8467 |
|
| 138 |
+
| arc_cot | 0.8467 | 0.8400 | 0.7967 | 0.8667 | 0.9033 | 0.9633 | **0.9667** |
|
| 139 |
+
| logicbench | 0.7167 | 0.6467 | 0.5733 | 0.6267 | 0.7200 | **0.8567** | 0.8533 |
|
| 140 |
+
| strategyqa | 0.6500 | 0.6333 | 0.6533 | 0.6433 | 0.6667 | 0.7400 | **0.7867** |
|
| 141 |
+
| drop | 0.7467 | 0.7000 | 0.6733 | 0.6900 | 0.6633 | **0.8833** | 0.8500 |
|
| 142 |
+
| csqa | 0.7367 | 0.7067 | 0.7500 | 0.7433 | 0.7700 | **0.8633** | 0.8367 |
|
| 143 |
+
| musr | 0.4957 | 0.4997 | 0.4932 | 0.4867 | 0.5703 | 0.6301 | **0.6852** |
|
| 144 |
+
| mmlu_redux | 0.6667 | 0.6633 | 0.6000 | 0.7133 | 0.8367 | 0.8500 | **0.9467** |
|
| 145 |
+
| ifeval | 0.6433 | 0.6767 | 0.7167 | 0.7300 | **0.8900** | 0.8400 | 0.7900 |
|
| 146 |
+
| rudas_ood | 0.0365 | 0.0209 | **0.0733** | 0.0017 | 0.0061 | 0.0468 | 0.0000 § |
|
| 147 |
+
| bbh_logic | 0.6633 | 0.6667 | 0.5333 | 0.5713 | 0.7700 | 0.6367 | **0.9980** |
|
| 148 |
+
| math500 | 0.6900 | 0.7000 | 0.4233 | 0.7133 | 0.7800 | 0.6100 | **0.8433** |
|
| 149 |
+
| **macro (10 CoT datasets)** | 0.7339 | 0.7193 | 0.6997 | 0.7523 | 0.7884 | 0.8493 | **0.8689** |
|
| 150 |
+
| **macro (all 14)** | 0.6694 | 0.6612 | 0.6245 | 0.6814 | 0.7378 | 0.7591 | **0.8086** |
|
| 151 |
+
| tok/s | 15880 | 15564 | 16160 | 25000 | 22000 | not measured | 3374 |
|
| 152 |
+
| mean gen length | **482** | 626 | 510 | ≈796 | ≈1327 | ≈1931 | 801 |
|
| 153 |
+
| **ans/s** | **32.9** | 24.9 | 31.7 | ≈31.4 | ≈16.6 | not measured | 4.2 |
|
| 154 |
+
|
| 155 |
+
‡ MXFP4 weights, tensor-parallel 2 — quantized and multi-GPU, so not directly comparable to the
|
| 156 |
+
single-GPU BF16 rows. § 74% of its `rudas_ood` generations hit the length cap, so that cell is a
|
| 157 |
+
truncation artefact rather than a measured score; excluding the row, its 13-dataset macro is
|
| 158 |
+
0.8708.
|
| 159 |
+
|
| 160 |
+
Lengths marked ≈ are derived from stored generations using each model's characters-per-token
|
| 161 |
+
ratio rather than re-tokenized directly; the method reproduces the three directly measured
|
| 162 |
+
lengths to within 3.5%.
|
| 163 |
+
|
| 164 |
+
The honest summary of this table is that TwIL-LM3 does not lead it. Larger models score higher,
|
| 165 |
+
in order of size, and the 120B leads nine of fourteen rows. Two things are worth extracting
|
| 166 |
+
anyway. First, TwIL-LM3 improves on its own base while sitting mid-table (0.7339 against 0.7193
|
| 167 |
+
on the 10-dataset macro), which is the point of the WiSE-FT stage — in-domain gains without
|
| 168 |
+
transfer collapse. Second, it produces the shortest generations of any arm here at 482 tokens
|
| 169 |
+
and consequently the most answers per second at 32.9, roughly eight times the 120B's rate.
|
| 170 |
+
|
| 171 |
## Usage
|
| 172 |
|
| 173 |
```python
|
| 174 |
import torch
|
| 175 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 176 |
|
| 177 |
+
model_id = "webAI-Official/TwIL-LM3"
|
| 178 |
tok = AutoTokenizer.from_pretrained(model_id)
|
| 179 |
model = AutoModelForCausalLM.from_pretrained(
|
| 180 |
model_id, torch_dtype=torch.bfloat16, device_map="auto"
|
|
|
|
| 201 |
explicitly to reproduce the evaluation. The model opens a `<think>...</think>` reasoning block
|
| 202 |
before answering, so a short generation budget truncates reasoning and scores far worse.
|
| 203 |
|
| 204 |
+
### GGUF / llama.cpp
|
| 205 |
+
|
| 206 |
+
Quantized GGUF builds ship in this repository alongside the safetensors weights. The `smollm3`
|
| 207 |
+
architecture is supported by llama.cpp, and the chat template, `<|im_end|>` EOS and BOS are
|
| 208 |
+
carried into the GGUF metadata, so chat mode works without extra flags.
|
| 209 |
+
|
| 210 |
+
| file | quant | size | bits/weight | notes |
|
| 211 |
+
|---|---|---:|---:|---|
|
| 212 |
+
| `TwIL-LM3-Q4_K_M.gguf` | Q4_K_M | 1.78 GiB | 4.96 | recommended default; runs on CPU or 4 GB of VRAM |
|
| 213 |
+
| `TwIL-LM3-Q8_0.gguf` | Q8_0 | 3.05 GiB | 8.50 | near-lossless, for quality-sensitive use |
|
| 214 |
+
|
| 215 |
+
```bash
|
| 216 |
+
llama-cli -m TwIL-LM3-Q4_K_M.gguf -cnv --temp 0 -n 2048
|
| 217 |
+
```
|
| 218 |
+
|
| 219 |
+
Two things matter for reproducing the scores above under llama.cpp. Pass `--temp 0`, because the
|
| 220 |
+
evaluation is greedy while the packaged sampling defaults are not. And leave the generation
|
| 221 |
+
budget large — 2048 tokens or more — since the model emits a `<think>` block before answering
|
| 222 |
+
and a short budget truncates it, which costs far more accuracy than the quantization does.
|
| 223 |
+
|
| 224 |
+
Q8_0 was produced directly by `convert_hf_to_gguf.py` from the released bf16 weights; Q4_K_M was
|
| 225 |
+
produced from an F16 conversion with `llama-quantize`, without an importance matrix. Both builds
|
| 226 |
+
were smoke-tested for load and generation on CPU. The published Track A and Track B numbers were
|
| 227 |
+
measured on the **bf16** weights through vLLM, not on these GGUF builds, so expect small
|
| 228 |
+
deviations at Q4_K_M that have not been quantified here.
|
| 229 |
+
|
| 230 |
## How it was built
|
| 231 |
|
| 232 |
Four stages on top of the base model:
|