Text Generation
Transformers
Safetensors
English
llama
small-language-model
efficient
edge-deployment
speculative-decoding
tiny-model
12m-parameters
kaggle-trained
educational
research
low-resource
cpu-inference
mobile-deployment
stentor2
tokenmonster
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use StentorLabs/Stentor2-12M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use StentorLabs/Stentor2-12M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="StentorLabs/Stentor2-12M") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("StentorLabs/Stentor2-12M") model = AutoModelForCausalLM.from_pretrained("StentorLabs/Stentor2-12M", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use StentorLabs/Stentor2-12M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "StentorLabs/Stentor2-12M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "StentorLabs/Stentor2-12M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/StentorLabs/Stentor2-12M
- SGLang
How to use StentorLabs/Stentor2-12M 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 "StentorLabs/Stentor2-12M" \ --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": "StentorLabs/Stentor2-12M", "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 "StentorLabs/Stentor2-12M" \ --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": "StentorLabs/Stentor2-12M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use StentorLabs/Stentor2-12M with Docker Model Runner:
docker model run hf.co/StentorLabs/Stentor2-12M
Delete README.md
Browse files
README.md
DELETED
|
@@ -1,982 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
language:
|
| 3 |
-
- en
|
| 4 |
-
license: apache-2.0
|
| 5 |
-
library_name: transformers
|
| 6 |
-
tags:
|
| 7 |
-
- text-generation
|
| 8 |
-
- llama
|
| 9 |
-
- small-language-model
|
| 10 |
-
- efficient
|
| 11 |
-
- edge-deployment
|
| 12 |
-
- speculative-decoding
|
| 13 |
-
- tiny-model
|
| 14 |
-
- 12m-parameters
|
| 15 |
-
- kaggle-trained
|
| 16 |
-
- educational
|
| 17 |
-
- research
|
| 18 |
-
- low-resource
|
| 19 |
-
- cpu-inference
|
| 20 |
-
- mobile-deployment
|
| 21 |
-
- stentor2
|
| 22 |
-
- tokenmonster
|
| 23 |
-
pipeline_tag: text-generation
|
| 24 |
-
datasets:
|
| 25 |
-
- epfml/FineWeb-HQ
|
| 26 |
-
- StentorLabs/StenCore
|
| 27 |
-
thumbnail: https://huggingface.co/StentorLabs/Stentor2-12M/resolve/main/thumbnail.png
|
| 28 |
-
widget:
|
| 29 |
-
- text: Once upon a time
|
| 30 |
-
example_title: Story Generation
|
| 31 |
-
- text: Explain neural networks in simple terms.
|
| 32 |
-
example_title: Toy Explanation (Often Wrong)
|
| 33 |
-
- text: 'def fibonacci(n):'
|
| 34 |
-
example_title: Code Continuation
|
| 35 |
-
- text: The laws of thermodynamics describe
|
| 36 |
-
example_title: Science Continuation
|
| 37 |
-
model_card_authors:
|
| 38 |
-
- StentorLabs
|
| 39 |
-
model-index:
|
| 40 |
-
- name: Stentor2-12M
|
| 41 |
-
results:
|
| 42 |
-
- task:
|
| 43 |
-
type: text-generation
|
| 44 |
-
dataset:
|
| 45 |
-
name: FineWeb-HQ (validation split)
|
| 46 |
-
type: epfml/FineWeb-HQ
|
| 47 |
-
metrics:
|
| 48 |
-
- name: Best Validation Loss
|
| 49 |
-
type: loss
|
| 50 |
-
value: 3.2814
|
| 51 |
-
- name: Best Perplexity (at best checkpoint)
|
| 52 |
-
type: perplexity
|
| 53 |
-
value: 26.61
|
| 54 |
-
- name: Final Epoch Validation Loss
|
| 55 |
-
type: loss
|
| 56 |
-
value: 3.2565
|
| 57 |
-
- name: Final Epoch Perplexity
|
| 58 |
-
type: perplexity
|
| 59 |
-
value: 25.96
|
| 60 |
-
---
|
| 61 |
-
|
| 62 |
-
# Stentor2-12M
|
| 63 |
-
|
| 64 |
-

|
| 65 |
-

|
| 66 |
-

|
| 67 |
-

|
| 68 |
-

|
| 69 |
-

|
| 70 |
-
[](https://huggingface.co/StentorLabs)
|
| 71 |
-
|
| 72 |
-
> 🔬 **Research Artifact — Not a Production Model.** This model has no safety tuning and is not suitable for deployment in any user-facing application. See [Intended Uses](#use-cases--intended-uses) for details.
|
| 73 |
-
|
| 74 |
-
---
|
| 75 |
-
|
| 76 |
-
## Table of Contents
|
| 77 |
-
|
| 78 |
-
1. [What Is This?](#what-is-this)
|
| 79 |
-
2. [The Core Design Insight: Vocabulary Efficiency](#the-core-design-insight-vocabulary-efficiency)
|
| 80 |
-
3. [Head-to-Head: Stentor v1 vs Stentor2](#head-to-head-stentor-v1-vs-stentor2)
|
| 81 |
-
4. [Quick Start](#quick-start)
|
| 82 |
-
5. [Important Limitations](#important-limitations)
|
| 83 |
-
6. [Honest Notices](#-honest-notices)
|
| 84 |
-
7. [PDF Tokens & The Replacement Character](#pdf-tokens--the-replacement-character)
|
| 85 |
-
8. [Model Architecture — Full Specification](#model-architecture--full-specification)
|
| 86 |
-
9. [The Tokenizer: TokenMonster](#the-tokenizer-tokenmonster)
|
| 87 |
-
10. [Training Infrastructure](#training-infrastructure)
|
| 88 |
-
11. [Training Hyperparameters — Complete Reference](#training-hyperparameters--complete-reference)
|
| 89 |
-
12. [The T4 Mixed-Precision Recipe — Deep Dive](#the-t4-mixed-precision-recipe--deep-dive)
|
| 90 |
-
13. [Data Pipeline](#data-pipeline)
|
| 91 |
-
14. [Weight Initialization](#weight-initialization)
|
| 92 |
-
15. [Evaluation & Results](#evaluation--results)
|
| 93 |
-
16. [Training Dynamics](#training-dynamics)
|
| 94 |
-
17. [Use Cases & Intended Uses](#use-cases--intended-uses)
|
| 95 |
-
18. [Out-of-Scope Uses](#out-of-scope-uses)
|
| 96 |
-
19. [Ethical Considerations & Societal Impact](#ethical-considerations--societal-impact)
|
| 97 |
-
20. [Inference Guide](#inference-guide)
|
| 98 |
-
21. [Free Inference — Try It Now](#-free-inference--try-it-now)
|
| 99 |
-
22. [Real Model Responses](#real-model-responses)
|
| 100 |
-
23. [Quantization](#quantization)
|
| 101 |
-
24. [Format Conversion](#format-conversion)
|
| 102 |
-
25. [Speculative Decoding](#speculative-decoding)
|
| 103 |
-
26. [Bias, Risks & Limitations](#bias-risks--limitations)
|
| 104 |
-
27. [Related Work](#related-work)
|
| 105 |
-
28. [Environmental Impact](#environmental-impact)
|
| 106 |
-
29. [Citation](#citation)
|
| 107 |
-
|
| 108 |
-
---
|
| 109 |
-
|
| 110 |
-
## What Is This?
|
| 111 |
-
|
| 112 |
-
Stentor2-12M is the first production release from the **Stentor2** model family — a ground-up redesign of the original Stentor v1 line. At ~12.3M parameters, it is a compact base language model built entirely from scratch on free-tier Kaggle compute using two NVIDIA Tesla T4 GPUs.
|
| 113 |
-
|
| 114 |
-
Like all Stentor models, this is a **base next-token predictor**, not a chat assistant. It will not reliably follow instructions, has no safety tuning, and is best used for research, prototyping, speculative decoding, and edge-deployment experimentation. The value of this model is not its conversational capability — it's what it represents architecturally: a dramatic efficiency gain over v1 at the same scale, achieved by fixing the root cause of v1's underperformance.
|
| 115 |
-
|
| 116 |
-
---
|
| 117 |
-
|
| 118 |
-
## The Core Design Insight: Vocabulary Efficiency
|
| 119 |
-
|
| 120 |
-
The most consequential change in Stentor2 is the replacement of the standard Llama/Mistral 32,768-token vocabulary with a purpose-built **8,000-token English vocabulary** from the TokenMonster project (`english-8000-strict-nocapcode-v1`, padded to 8,064 for hardware alignment).
|
| 121 |
-
|
| 122 |
-
This is not a minor tweak — it is the entire architectural story of Stentor2.
|
| 123 |
-
|
| 124 |
-
### Why Vocabulary Size Matters So Much at This Scale
|
| 125 |
-
|
| 126 |
-
In a transformer language model, the embedding table has shape `[vocab_size × hidden_size]`. When you tie word embeddings (share the embedding and output projection weights, which Stentor does), this table appears once in the parameter count. At 12M total parameters, the fraction consumed by this table dictates how much "brain" is left over for the actual transformer layers.
|
| 127 |
-
|
| 128 |
-
**Stentor-12M (v1)** used a 32,768-token vocabulary. At a hidden size of 192:
|
| 129 |
-
|
| 130 |
-
```
|
| 131 |
-
embedding_params = 32,768 × 192 = 6,291,456
|
| 132 |
-
total_params = 12,047,040
|
| 133 |
-
embedding_share = 52.2%
|
| 134 |
-
```
|
| 135 |
-
|
| 136 |
-
Over half of the model was a lookup table. The transformer stack — the part that actually *learns language patterns* — had fewer than 6 million parameters to work with.
|
| 137 |
-
|
| 138 |
-
**Stentor2-12M** uses an 8,064-token vocabulary. At a hidden size of 256:
|
| 139 |
-
|
| 140 |
-
```
|
| 141 |
-
embedding_params = 8,064 × 256 = 2,064,384
|
| 142 |
-
total_params = 12,294,400
|
| 143 |
-
embedding_share = 16.8%
|
| 144 |
-
```
|
| 145 |
-
|
| 146 |
-
By shrinking the vocabulary, the embedding table was cut from 6.3M to 2.1M parameters — freeing up ~4.2M parameters redistributed into transformer depth (12 layers vs 9) and width (hidden size 256 vs 192), where they contribute directly to language modeling quality.
|
| 147 |
-
|
| 148 |
-
The result is a **~70.1% reduction in perplexity** (89.01 → ~26.6) compared to Stentor-12M v1.
|
| 149 |
-
|
| 150 |
-
---
|
| 151 |
-
|
| 152 |
-
## Head-to-Head: Stentor v1 vs Stentor2
|
| 153 |
-
|
| 154 |
-
| Property | Stentor-12M (v1) | Stentor2-12M |
|
| 155 |
-
|---|---|---|
|
| 156 |
-
| **Vocabulary** | 32,768 (Mistral BPE) | 8,064 (TokenMonster English) |
|
| 157 |
-
| **Hidden Size** | 192 | 256 |
|
| 158 |
-
| **Intermediate Size** | 576 | 768 |
|
| 159 |
-
| **Num Layers** | 9 | 12 |
|
| 160 |
-
| **Attention Heads** | 3 | 4 |
|
| 161 |
-
| **Head Dimension** | 64 | 64 |
|
| 162 |
-
| **Context Length** | 512 tokens | 1,024 tokens |
|
| 163 |
-
| **Total Parameters** | 12,047,040 | 12,294,400 |
|
| 164 |
-
| **Embedding Share** | 52.2% | 16.8% |
|
| 165 |
-
| **Non-Embedding Params** | ~5.76M | ~10.23M |
|
| 166 |
-
| **Source Token Budget** | 200M | 240M |
|
| 167 |
-
| **Total Token Budget** | ~200M | 480M |
|
| 168 |
-
| **Training Time** | ~1.3h | ~2.1h |
|
| 169 |
-
| **Training Processes** | 1 | 2 |
|
| 170 |
-
| **Best Perplexity** | 89.01 | **26.61** |
|
| 171 |
-
| **Perplexity Reduction** | — | **~70.1%** |
|
| 172 |
-
| **Tokenizer** | Mistral BPE | TokenMonster |
|
| 173 |
-
| **Architecture** | LlamaForCausalLM | LlamaForCausalLM |
|
| 174 |
-
| **Training Precision** | fp16 | fp16 + FP32 norms/critical layers |
|
| 175 |
-
|
| 176 |
-
---
|
| 177 |
-
|
| 178 |
-
## 🚀 Quick Start
|
| 179 |
-
|
| 180 |
-
### 1. Install Dependencies
|
| 181 |
-
|
| 182 |
-
```bash
|
| 183 |
-
pip install transformers torch safetensors huggingface_hub tokenmonster
|
| 184 |
-
```
|
| 185 |
-
|
| 186 |
-
### 2. Load the Model
|
| 187 |
-
|
| 188 |
-
```python
|
| 189 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 190 |
-
import torch
|
| 191 |
-
|
| 192 |
-
model = AutoModelForCausalLM.from_pretrained(
|
| 193 |
-
"StentorLabs/Stentor2-12M",
|
| 194 |
-
torch_dtype=torch.float16,
|
| 195 |
-
)
|
| 196 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
| 197 |
-
"StentorLabs/Stentor2-12M",
|
| 198 |
-
trust_remote_code=True,
|
| 199 |
-
)
|
| 200 |
-
```
|
| 201 |
-
|
| 202 |
-
### 3. Generate Text
|
| 203 |
-
|
| 204 |
-
```python
|
| 205 |
-
input_ids = torch.tensor([tokenizer.encode("The history of computing")], dtype=torch.long).to(next(model.parameters()).device)
|
| 206 |
-
attention_mask = torch.ones_like(input_ids)
|
| 207 |
-
|
| 208 |
-
with torch.inference_mode():
|
| 209 |
-
output = model.generate(
|
| 210 |
-
input_ids,
|
| 211 |
-
attention_mask=attention_mask,
|
| 212 |
-
max_new_tokens=80,
|
| 213 |
-
do_sample=True,
|
| 214 |
-
temperature=1.1,
|
| 215 |
-
top_p=0.55,
|
| 216 |
-
repetition_penalty=1.15,
|
| 217 |
-
pad_token_id=tokenizer.pad_token_id,
|
| 218 |
-
)
|
| 219 |
-
|
| 220 |
-
print(tokenizer.decode(output[0].tolist()))
|
| 221 |
-
```
|
| 222 |
-
|
| 223 |
-
> **Why `attention_mask`?** The model's pad token and EOS token are the same ID. Without an explicit attention mask, HuggingFace throws a warning because it can't tell which tokens are real vs padding. Passing `torch.ones_like(input_ids)` tells the model that every token in the input is real.
|
| 224 |
-
|
| 225 |
-
### 4. Recommended Generation Settings
|
| 226 |
-
|
| 227 |
-
| Parameter | Recommended Range | Personal Favorite | Notes |
|
| 228 |
-
|---|---|---|---|
|
| 229 |
-
| `temperature` | 0.6 – 0.9 | **0.8** | Below 0.6 causes heavy `<22>` (PDF token) output; above 0.9 gets chaotic |
|
| 230 |
-
| `top_p` | 0.6 – 0.8 | **0.7** | Below 0.6 also increases `<22>` tokens significantly |
|
| 231 |
-
| `repetition_penalty` | 1.1 – 1.4 | **1.2** | Without this the model will loop; 1.2–1.3 hits the sweet spot |
|
| 232 |
-
| `max_new_tokens` | 10 – 500 | — | Model stays mostly on topic but may drift at longer lengths |
|
| 233 |
-
|
| 234 |
-
> ⚠️ **Always use `repetition_penalty ≥ 1.1`.** Without it, this model will fall into repetitive loops. With it on, output quality is mostly stable.
|
| 235 |
-
|
| 236 |
-
> ⚠️ **Keep temperature and top_p above 0.6.** Going below this threshold causes the model to lean heavily on PDF-derived tokens that render as `<22>` (the Unicode replacement character). See [PDF Tokens](#pdf-tokens--the-replacement-character) for details.
|
| 237 |
-
|
| 238 |
-
---
|
| 239 |
-
|
| 240 |
-
## ⚠️ Important Limitations
|
| 241 |
-
|
| 242 |
-
- **Not Instruction-Tuned:** This is a base model. It will often ignore prompts, continue in unexpected directions, or respond off-topic.
|
| 243 |
-
- **No Safety Tuning:** No RLHF, no constitutional AI, no content filtering.
|
| 244 |
-
- **Limited World Knowledge:** ~12M parameters cannot store meaningful world knowledge.
|
| 245 |
-
- **Context Window:** Hard limit of 1,024 tokens.
|
| 246 |
-
- **English Only:** The TokenMonster vocabulary is English-specific.
|
| 247 |
-
- **TokenMonster Required:** Uses a TokenMonster adapter. Make sure `tokenmonster` is installed (`pip install tokenmonster`). You do not need a custom model loader — standard `AutoModelForCausalLM` works — but the tokenmonster package is still required for the tokenizer.
|
| 248 |
-
- **PDF Tokens (`<22>`):** The model was trained on data containing PDF-extracted text, and will sometimes generate tokens that render as `<22>` (the Unicode replacement character). See the [PDF Tokens](#pdf-tokens--the-replacement-character) section below.
|
| 249 |
-
- **Repetition Without Penalty:** Without `repetition_penalty`, the model will fall into loops. Always use `repetition_penalty ≥ 1.1`.
|
| 250 |
-
- **Shared Tensor Warning:** When saving or loading, you may see: `Removed shared tensor {'lm_head.weight'} while saving`. This is expected from tied word embeddings and is safe to ignore.
|
| 251 |
-
|
| 252 |
-
---
|
| 253 |
-
|
| 254 |
-
## 📋 Honest Notices
|
| 255 |
-
|
| 256 |
-
These are candid, first-hand observations about how this model actually behaves.
|
| 257 |
-
|
| 258 |
-
1. **Significantly more coherent than its predecessors.** Output quality is a clear step up from Stentor2-12M-Preview and Stentor-12M v1. It is competitive with — and in some runs slightly better than — Stentor-30M, despite being less than half the parameter count.
|
| 259 |
-
|
| 260 |
-
2. **Generates PDF tokens (`<22>`).** The model will sometimes output tokens that display as `<22>` — the Unicode replacement character. These are valid tokens from PDF-extracted training data that most systems cannot natively render, and that most language models never produce. They are not a decoding error. See [PDF Tokens](#pdf-tokens--the-replacement-character) for details.
|
| 261 |
-
|
| 262 |
-
3. **Prone to repetition without `repetition_penalty`.** Left unchecked, the model loops. With `repetition_penalty` set to 1.1–1.4, this is mostly resolved and output quality is stable.
|
| 263 |
-
|
| 264 |
-
4. **No custom model loader required. 🎉** Unlike Stentor2-12M-Preview, this model loads with standard `AutoModelForCausalLM.from_pretrained()`. No special loading code needed.
|
| 265 |
-
|
| 266 |
-
5. **You still need to install `tokenmonster`.** The tokenizer wraps TokenMonster and requires `pip install tokenmonster`. It's a one-line install and nothing like the complexity of a fully custom tokenizer, but it is a required dependency.
|
| 267 |
-
|
| 268 |
-
6. **The model talks about education and academics — a lot.** Trained on FineWeb-HQ (a high-quality filtered web corpus with significant PDF and educational content) and StenCore (100% PDFs), the model has a strong prior toward academic language, school systems, curriculum, research, and formal writing. Prompts unrelated to education will frequently be redirected toward educational framing anyway.
|
| 269 |
-
|
| 270 |
-
---
|
| 271 |
-
|
| 272 |
-
## PDF Tokens & The Replacement Character
|
| 273 |
-
|
| 274 |
-
Stentor2-12M was trained on FineWeb-HQ and StenCore, which includes a substantial amount of text extracted from PDF documents. PDFs often contain binary sequences or encoding artifacts that survive text extraction as raw bytes outside the standard UTF-8 range. These get tokenized and trained on as valid tokens.
|
| 275 |
-
|
| 276 |
-
As a result, the model has learned to generate these tokens — and will do so, especially at lower temperatures or lower top-p values. When decoded, they render as **`<22>`** (U+FFFD, the Unicode replacement character), because most systems substitute this symbol for unrepresentable byte sequences.
|
| 277 |
-
|
| 278 |
-
**What this looks like:**
|
| 279 |
-
|
| 280 |
-
```
|
| 281 |
-
Academics → <22><22><22><22><22><22><22><22><22><22><22><22><22><22>...
|
| 282 |
-
```
|
| 283 |
-
|
| 284 |
-
**How to reduce it:** Keep `temperature ≥ 0.6` and `top_p ≥ 0.6`. Below these thresholds, PDF token probability rises sharply. At well-tuned settings (temp 0.8, top_p 0.7), `<22>` tokens appear occasionally but do not dominate output.
|
| 285 |
-
|
| 286 |
-
**This is not a bug.** Most language models are trained on clean text and never encounter these sequences. Stentor2-12M is unusual in that it can generate them — a side effect of training on real-world PDF-extracted data.
|
| 287 |
-
|
| 288 |
-
---
|
| 289 |
-
|
| 290 |
-
## Model Architecture — Full Specification
|
| 291 |
-
|
| 292 |
-
Stentor2-12M is a `LlamaForCausalLM` model.
|
| 293 |
-
|
| 294 |
-
### Core Configuration
|
| 295 |
-
|
| 296 |
-
| Component | Value | Derivation |
|
| 297 |
-
|---|---|---|
|
| 298 |
-
| **Architecture** | `LlamaForCausalLM` | Hard-coded in training script |
|
| 299 |
-
| **Hidden Size** | 256 | embedding_params (2,064,384) ÷ vocab_size (8,064) = 256 ✓ |
|
| 300 |
-
| **Intermediate Size (FFN)** | 768 | Hidden × 3 (verified via total param count) |
|
| 301 |
-
| **Num Hidden Layers** | 12 | Verified via total param count formula |
|
| 302 |
-
| **Num Attention Heads** | 4 | Hidden ÷ head_dim = 256 ÷ 64 = 4 |
|
| 303 |
-
| **Num Key/Value Heads** | 4 | Full MHA (no GQA at this scale) |
|
| 304 |
-
| **Head Dimension** | 64 | Enforced by training script |
|
| 305 |
-
| **Vocab Size** | 8,064 | TokenMonster 8K base + 62 padding tokens (multiple of 128) |
|
| 306 |
-
| **Max Position Embeddings** | 1,024 | `block_size` default in training script |
|
| 307 |
-
| **Hidden Activation** | SiLU | LlamaForCausalLM default |
|
| 308 |
-
| **Positional Encoding** | RoPE | `rope_theta = 10,000.0` |
|
| 309 |
-
| **RMS Norm Epsilon** | 1e-5 | Default in training script |
|
| 310 |
-
| **Tie Word Embeddings** | True | Shared embedding / LM head weights |
|
| 311 |
-
| **Attention Implementation** | SDPA | PyTorch Scaled Dot Product Attention |
|
| 312 |
-
|
| 313 |
-
### Parameter Count Breakdown
|
| 314 |
-
|
| 315 |
-
```python
|
| 316 |
-
def estimate_llama_params(vocab_size, hidden_size, intermediate_size,
|
| 317 |
-
num_hidden_layers, num_attention_heads, num_key_value_heads):
|
| 318 |
-
kv_dim = int(hidden_size * num_key_value_heads / num_attention_heads)
|
| 319 |
-
attn = 2 * hidden_size * hidden_size + 2 * hidden_size * kv_dim
|
| 320 |
-
mlp = 3 * hidden_size * intermediate_size
|
| 321 |
-
norm = 2 * hidden_size
|
| 322 |
-
total = vocab_size * hidden_size + num_hidden_layers * (attn + mlp + norm) + hidden_size
|
| 323 |
-
return total
|
| 324 |
-
```
|
| 325 |
-
|
| 326 |
-
Plugging in Stentor2 values:
|
| 327 |
-
|
| 328 |
-
```
|
| 329 |
-
kv_dim = 256 * 4 / 4 = 256
|
| 330 |
-
attn = 2×256×256 + 2×256×256 = 262,144
|
| 331 |
-
mlp = 3×256×768 = 589,824
|
| 332 |
-
norm = 2×256 = 512
|
| 333 |
-
per_layer = 852,480
|
| 334 |
-
|
| 335 |
-
embedding = 8,064 × 256 = 2,064,384
|
| 336 |
-
layers = 12 × 852,480 = 10,229,760
|
| 337 |
-
final_norm = 256
|
| 338 |
-
|
| 339 |
-
total = 2,064,384 + 10,229,760 + 256 = 12,294,400 ✓
|
| 340 |
-
```
|
| 341 |
-
|
| 342 |
-
| Component | Parameters | % of Total |
|
| 343 |
-
|---|---|---|
|
| 344 |
-
| Embedding Table (tied with LM Head) | 2,064,384 | 16.8% |
|
| 345 |
-
| Transformer Layers × 12 | 10,229,760 | 83.2% |
|
| 346 |
-
| — Attention (per layer × 12) | 3,145,728 | 25.6% |
|
| 347 |
-
| — FFN/MLP (per layer × 12) | 7,077,888 | 57.5% |
|
| 348 |
-
| — Layer Norms (per layer × 12) | 6,144 | 0.05% |
|
| 349 |
-
| Final RMS Norm | 256 | 0.002% |
|
| 350 |
-
| **Total** | **12,294,400** | **100%** |
|
| 351 |
-
|
| 352 |
-
---
|
| 353 |
-
|
| 354 |
-
## The Tokenizer: TokenMonster
|
| 355 |
-
|
| 356 |
-
Stentor2 uses a custom tokenizer adapter wrapping the **TokenMonster** `english-8000-strict-nocapcode-v1` vocabulary.
|
| 357 |
-
|
| 358 |
-
### What Is TokenMonster?
|
| 359 |
-
|
| 360 |
-
TokenMonster ([alasdairforsythe/tokenmonster](https://huggingface.co/alasdairforsythe/tokenmonster)) is an alternative tokenization approach optimized for compact English vocabulary sizes.
|
| 361 |
-
|
| 362 |
-
### Tokenizer Efficiency vs. v1
|
| 363 |
-
|
| 364 |
-
This tokenizer produces **more tokens per word** compared to Stentor v1. This is expected — smaller vocabulary means more tokens per word on average. The ~70.1% perplexity improvement shows the tradeoff was worth it.
|
| 365 |
-
|
| 366 |
-
### Vocabulary Construction
|
| 367 |
-
|
| 368 |
-
1. Base vocabulary loaded from `alasdairforsythe/tokenmonster` → `vocabs/english-8000-strict-nocapcode-v1.vocab`
|
| 369 |
-
2. Special tokens added: `</s>` (EOS), `<s>` (BOS), `<pad>` (set equal to EOS)
|
| 370 |
-
3. A default chat template injected for structural compatibility
|
| 371 |
-
4. Vocabulary padded to the nearest multiple of 128 → **8,064 tokens**
|
| 372 |
-
|
| 373 |
-
### Tokenizer Configuration
|
| 374 |
-
|
| 375 |
-
```json
|
| 376 |
-
{
|
| 377 |
-
"tokenizer_type": "tokenmonster",
|
| 378 |
-
"vocab_file": "tokenmonster.vocab",
|
| 379 |
-
"model_max_length": 1024,
|
| 380 |
-
"eos_token": "</s>",
|
| 381 |
-
"bos_token": "<s>",
|
| 382 |
-
"pad_token": "</s>",
|
| 383 |
-
"vocab_size": 8064
|
| 384 |
-
}
|
| 385 |
-
```
|
| 386 |
-
|
| 387 |
-
### Chat Template
|
| 388 |
-
|
| 389 |
-
```jinja
|
| 390 |
-
{% for message in messages %}
|
| 391 |
-
<|{{ message['role'] }}|>
|
| 392 |
-
{{ message['content'] }}
|
| 393 |
-
{% endfor %}
|
| 394 |
-
{% if add_generation_prompt %}<|assistant|>
|
| 395 |
-
{% endif %}
|
| 396 |
-
```
|
| 397 |
-
|
| 398 |
-
---
|
| 399 |
-
|
| 400 |
-
## Training Infrastructure
|
| 401 |
-
|
| 402 |
-
### Hardware
|
| 403 |
-
|
| 404 |
-
| Component | Specification |
|
| 405 |
-
|---|---|
|
| 406 |
-
| GPU Count | 2× NVIDIA Tesla T4 |
|
| 407 |
-
| VRAM per GPU | 15.64 GB |
|
| 408 |
-
| Total VRAM | ~31.3 GB |
|
| 409 |
-
| Active Training Processes | **2** (dual-process via HuggingFace Accelerate) |
|
| 410 |
-
| Platform | Kaggle Notebooks (free tier) |
|
| 411 |
-
| Accelerator Library | HuggingFace Accelerate |
|
| 412 |
-
|
| 413 |
-
### Software Stack
|
| 414 |
-
|
| 415 |
-
| Package | Role |
|
| 416 |
-
|---|---|
|
| 417 |
-
| PyTorch | Core tensor operations and autograd |
|
| 418 |
-
| HuggingFace Transformers | Model architecture (LlamaForCausalLM) |
|
| 419 |
-
| HuggingFace Accelerate | Training loop and device management |
|
| 420 |
-
| HuggingFace Datasets | Data loading |
|
| 421 |
-
| bitsandbytes | Dual-GPU optimization |
|
| 422 |
-
| tokenmonster | Custom vocabulary |
|
| 423 |
-
| safetensors | Model serialization |
|
| 424 |
-
|
| 425 |
-
---
|
| 426 |
-
|
| 427 |
-
## Training Hyperparameters — Complete Reference
|
| 428 |
-
|
| 429 |
-
### Core Training Parameters
|
| 430 |
-
|
| 431 |
-
| Hyperparameter | Value | Notes |
|
| 432 |
-
|---|---|---|
|
| 433 |
-
| `learning_rate` | 8e-4 | AdamW LR (script default) |
|
| 434 |
-
| `weight_decay` | 0.01 | Applied to non-embedding, non-norm, non-bias params |
|
| 435 |
-
| `max_grad_norm` | 1.0 | Gradient clipping threshold |
|
| 436 |
-
| `optimizer` | AdamW | With `betas=(0.9, 0.95)`, `eps=1e-8` |
|
| 437 |
-
| `scheduler` | Cosine | Cosine decay with linear warmup |
|
| 438 |
-
| `warmup_ratio` | 0.05 | → **477 warmup steps** |
|
| 439 |
-
| `stable_ratio` | 0.80 | → **7,641 stable steps** |
|
| 440 |
-
| `source_token_budget` | 240,000,000 | Source data token cap |
|
| 441 |
-
| `token_budget` | 480,000,000 | Total training tokens; **hit at ~3,662 steps** |
|
| 442 |
-
| `max_train_steps` | 9,552 | Configured limit; token budget hit first |
|
| 443 |
-
| `seed` | 42 | Reproducibility seed |
|
| 444 |
-
| `mixed_precision` | fp16 | All activations/gradients in FP16 |
|
| 445 |
-
|
| 446 |
-
### Batch & Sequence Parameters
|
| 447 |
-
|
| 448 |
-
| Hyperparameter | Value | Notes |
|
| 449 |
-
|---|---|---|
|
| 450 |
-
| `per_device_train_batch_size` | **32** | Per GPU per gradient accumulation step |
|
| 451 |
-
| `per_device_eval_batch_size` | 16 | Evaluation batch size |
|
| 452 |
-
| `gradient_accumulation_steps` | **2** | Effective optimizer steps every 2 forward passes |
|
| 453 |
-
| `total_batch_size` | **128** | `per_device × processes × grad_accum = 32×2×2` |
|
| 454 |
-
| `block_size` | 1,024 | Sequence length; training packed to this size |
|
| 455 |
-
| `tokens_per_optimizer_step` | **131,072** | `total_batch_size × block_size = 128×1024` |
|
| 456 |
-
| `num_train_epochs` | 2 | Both epochs completed before token budget |
|
| 457 |
-
|
| 458 |
-
### Evaluation & Checkpointing
|
| 459 |
-
|
| 460 |
-
| Hyperparameter | Value |
|
| 461 |
-
|---|---|
|
| 462 |
-
| `eval_steps` | **900** |
|
| 463 |
-
| `best_eval_steps` | 900 |
|
| 464 |
-
| `best_eval_start_step` | 1,500 |
|
| 465 |
-
| `save_every_minutes` | 30 |
|
| 466 |
-
| `save_total_limit` | 2 |
|
| 467 |
-
| `logging_steps` | **300** |
|
| 468 |
-
| `max_eval_samples` | 5,000 |
|
| 469 |
-
|
| 470 |
-
### AdamW Optimizer — Detailed
|
| 471 |
-
|
| 472 |
-
- **Decay group:** All `nn.Linear` weight matrices → `weight_decay = 0.01`
|
| 473 |
-
- **No-decay group:** Bias terms, normalization parameters, embedding parameters → `weight_decay = 0.0`
|
| 474 |
-
- **Betas:** `(0.9, 0.95)`
|
| 475 |
-
- **Epsilon:** `1e-8`
|
| 476 |
-
- **Fused kernel:** Enabled when CUDA is available
|
| 477 |
-
|
| 478 |
-
### Learning Rate Schedule
|
| 479 |
-
|
| 480 |
-
```
|
| 481 |
-
Phase 1 — Warmup (steps 0–477):
|
| 482 |
-
LR ramps linearly from 0 → 8e-4
|
| 483 |
-
|
| 484 |
-
Phase 2 — Cosine Decay (steps 477–9,552):
|
| 485 |
-
LR follows cosine curve from 8e-4 → 0
|
| 486 |
-
(Training ended early at ~3,662 steps due to token budget)
|
| 487 |
-
```
|
| 488 |
-
|
| 489 |
-
---
|
| 490 |
-
|
| 491 |
-
## The T4 Mixed-Precision Recipe — Deep Dive
|
| 492 |
-
|
| 493 |
-
The training pipeline uses a custom **T4 Mixed-Precision Recipe** designed for stable fp16 training on NVIDIA Tesla T4 GPUs.
|
| 494 |
-
|
| 495 |
-
### 1. FP32 Normalization Layers (25 modules)
|
| 496 |
-
|
| 497 |
-
All RMSNorm modules are monkey-patched to run in FP32 regardless of input dtype:
|
| 498 |
-
|
| 499 |
-
```python
|
| 500 |
-
def _fp32_norm_forward(hidden_states, *args, **kwargs):
|
| 501 |
-
input_dtype = hidden_states.dtype
|
| 502 |
-
output = original_forward(hidden_states.float().contiguous(), *args, **kwargs)
|
| 503 |
-
return output.clone().to(input_dtype)
|
| 504 |
-
```
|
| 505 |
-
|
| 506 |
-
The `.clone()` call prevents returning graph-managed buffers that can be overwritten. The `.contiguous()` prevents strided-tensor issues in FP32 norm ops.
|
| 507 |
-
|
| 508 |
-
**Count:** 12 layers × 2 norms each (input + post-attention) + 1 final norm = **25 modules total**.
|
| 509 |
-
|
| 510 |
-
### 2. FP32 Critical Layers (2 layers)
|
| 511 |
-
|
| 512 |
-
The **first 2 transformer layers** are designated as critical and run entirely in FP32:
|
| 513 |
-
|
| 514 |
-
- Weights cast to `.float()` at setup time
|
| 515 |
-
- `forward()` monkey-patched to cast all inputs to FP32 and outputs back to original dtype
|
| 516 |
-
- `torch.amp.autocast("cuda", enabled=False)` prevents re-downcasting inside the layer
|
| 517 |
-
|
| 518 |
-
**Rationale:** The first layers handle embedding projection and initial feature extraction. Instability here corrupts the entire forward pass. Running these in FP32 provides a stability floor at minimal compute cost.
|
| 519 |
-
|
| 520 |
-
### 3. FP32 Attention Softmax — Skipped
|
| 521 |
-
|
| 522 |
-
The FP32 softmax wrapper was **not applied** (0 modules). As logged during training:
|
| 523 |
-
|
| 524 |
-
```
|
| 525 |
-
Stability tricks: skipping FP32 softmax wrapper because
|
| 526 |
-
SDPA/FlashAttention kernels require fp16/bf16 inputs for fast paths.
|
| 527 |
-
```
|
| 528 |
-
|
| 529 |
-
PyTorch's SDPA implementation handles numerical stability internally and requires fp16/bf16 inputs for its optimized code paths. Wrapping softmax in FP32 would bypass these fast kernels.
|
| 530 |
-
|
| 531 |
-
### T4 Recipe Summary
|
| 532 |
-
|
| 533 |
-
| Technique | Count | Scope |
|
| 534 |
-
|---|---|---|
|
| 535 |
-
| FP32 norm modules | **25** | All RMSNorm layers |
|
| 536 |
-
| FP32 critical layers | **2** | First 2 transformer layers |
|
| 537 |
-
| FP32 softmax modules | **0** | Skipped — SDPA incompatible |
|
| 538 |
-
|
| 539 |
-
---
|
| 540 |
-
|
| 541 |
-
## Data Pipeline
|
| 542 |
-
|
| 543 |
-
### Dataset
|
| 544 |
-
|
| 545 |
-
The model was trained on **FineWeb-HQ and StenCore** ([epfml/FineWeb-HQ](https://huggingface.co/datasets/epfml/FineWeb-HQ)) and ([StentorLabs/StenCore](https://huggingface.co/datasets/StentorLabs/StenCore))— high-quality filtered web and PDF corpuses.
|
| 546 |
-
|
| 547 |
-
**Total tokens processed:** 480,116,736 (~480M, budget-limited run)
|
| 548 |
-
**Source tokens (raw data):** 240,000,000 (240M source token budget)
|
| 549 |
-
|
| 550 |
-
### Text Preprocessing
|
| 551 |
-
|
| 552 |
-
```python
|
| 553 |
-
def clean_text(text: str) -> str:
|
| 554 |
-
text = unicodedata.normalize("NFKC", text)
|
| 555 |
-
lines = [line.strip() for line in text.splitlines() if line.strip()]
|
| 556 |
-
text = " ".join(lines)
|
| 557 |
-
text = " ".join(text.split())
|
| 558 |
-
return text
|
| 559 |
-
```
|
| 560 |
-
|
| 561 |
-
- **NFKC normalization** maps visually equivalent Unicode characters to canonical form
|
| 562 |
-
- **Whitespace collapse** ensures consistent tokenization
|
| 563 |
-
|
| 564 |
-
### Sequence Packing
|
| 565 |
-
|
| 566 |
-
After tokenization, samples are packed into fixed 1,024-token blocks. Labels for packed sequences are identical to `input_ids` (causal LM). No special boundary masking between packed samples.
|
| 567 |
-
|
| 568 |
-
---
|
| 569 |
-
|
| 570 |
-
## Weight Initialization
|
| 571 |
-
|
| 572 |
-
```python
|
| 573 |
-
def initialize_weights(model, std=0.02):
|
| 574 |
-
for module in model.modules():
|
| 575 |
-
if isinstance(module, (nn.Linear, nn.Embedding)):
|
| 576 |
-
module.weight.data.normal_(mean=0.0, std=std)
|
| 577 |
-
if module.bias is not None:
|
| 578 |
-
module.bias.data.zero_()
|
| 579 |
-
elif "rmsnorm" in type(module).__name__.lower():
|
| 580 |
-
if module.weight is not None:
|
| 581 |
-
module.weight.data.fill_(1.0)
|
| 582 |
-
if module.bias is not None:
|
| 583 |
-
module.bias.data.zero_()
|
| 584 |
-
```
|
| 585 |
-
|
| 586 |
-
- Linear/Embedding layers: normal(0, 0.02)
|
| 587 |
-
- RMSNorm scale weights: 1.0 (identity at start)
|
| 588 |
-
- Biases: zero
|
| 589 |
-
|
| 590 |
-
---
|
| 591 |
-
|
| 592 |
-
## Evaluation & Results
|
| 593 |
-
|
| 594 |
-
### Results Summary
|
| 595 |
-
|
| 596 |
-
| Checkpoint | Step | Eval Loss | Perplexity |
|
| 597 |
-
|---|---|---|---|
|
| 598 |
-
| Early | 900 | — | — |
|
| 599 |
-
| First best | 1,500 | 3.5410 | 34.50 |
|
| 600 |
-
| Second best | 2,400 | 3.3743 | 29.20 |
|
| 601 |
-
| Epoch 0 end | ~2,350 | 3.3776 | 29.30 |
|
| 602 |
-
| **Best Checkpoint** | **3,300** | **3.2814** | **26.61** |
|
| 603 |
-
| Epoch 1 end (final) | ~3,662 | 3.2565 | 25.96 |
|
| 604 |
-
|
| 605 |
-
### Comparison to Stentor v1
|
| 606 |
-
|
| 607 |
-
| Model | Best Eval Loss | Best Perplexity | Improvement |
|
| 608 |
-
|---|---|---|---|
|
| 609 |
-
| Stentor-12M (v1) | 4.4887 | 89.01 | — |
|
| 610 |
-
| **Stentor2-12M** | **3.2814** | **26.61** | **↓70.1% perplexity** |
|
| 611 |
-
|
| 612 |
-
> **Note:** The comparison is close but not perfectly controlled — v1 trained on a mix of FineWeb-Edu and Cosmopedia v2, while Stentor2 trained on FineWeb-HQ and StenCore. Both use educational-quality text at the same parameter count.
|
| 613 |
-
|
| 614 |
-
---
|
| 615 |
-
|
| 616 |
-
## Training Dynamics
|
| 617 |
-
|
| 618 |
-
The training run processed **480,116,736 tokens** across **2 epochs**, stopping when the token budget was reached at approximately **step 3,662** (well before the configured `max_train_steps` of 9,552).
|
| 619 |
-
|
| 620 |
-
**Epoch 0 (~2,350 steps, 3,497s):** Loss dropped rapidly from ~5.0 to ~3.2. Best checkpoint checkpoints updated at steps 1,500 (3.5410) and 2,400 (3.3743). Epoch-end eval: loss 3.3776, ppl 29.30.
|
| 621 |
-
|
| 622 |
-
**Epoch 1 (~1,310 additional steps, 1,906s):** Continued improvement. New best at step 3,300 (loss 3.2814). Token budget hit shortly after step 3,600. Epoch-end eval: loss 3.2565, ppl 25.96.
|
| 623 |
-
|
| 624 |
-
**Throughput:** ~91,600–92,000 tokens/sec average throughout training.
|
| 625 |
-
|
| 626 |
-
---
|
| 627 |
-
|
| 628 |
-
## Use Cases & Intended Uses
|
| 629 |
-
|
| 630 |
-
| Use Case | Suitability | Notes |
|
| 631 |
-
|---|---|---|
|
| 632 |
-
| Studying transformer training dynamics | ✅ High | Small enough to train/fine-tune on free compute |
|
| 633 |
-
| Tokenization efficiency research | ✅ High | 8K vs 32K vocab tradeoff directly observable |
|
| 634 |
-
| Speculative decoding experiments | ✅ High | Fast enough to serve as a draft model |
|
| 635 |
-
| Benchmarking CPU/edge inference latency | ✅ High | ~12MB in FP16, runs on any hardware |
|
| 636 |
-
| Testing quantization/conversion pipelines | ✅ High | GGUF, ONNX, INT8 pipeline validation |
|
| 637 |
-
| Teaching material for LLM courses | ✅ High | Architecture simple enough to trace by hand |
|
| 638 |
-
| Text continuation / creative prompting | ✅ High | Works well enough for basic continuation |
|
| 639 |
-
| Domain-specific fine-tuning research | ✅ High | Small enough to iterate rapidly |
|
| 640 |
-
| Factual Q&A | ❌ Not suitable | No reliable world knowledge |
|
| 641 |
-
| Production deployment | ❌ Not suitable | No safety tuning |
|
| 642 |
-
| Non-English text | ❌ Not suitable | TokenMonster vocab is English-only |
|
| 643 |
-
| Long-document tasks (Only 1k context) | ❌ Not suitable | Context too small |
|
| 644 |
-
|
| 645 |
-
---
|
| 646 |
-
|
| 647 |
-
## Out-of-Scope Uses
|
| 648 |
-
|
| 649 |
-
- **User-facing applications of any kind** — No safety filtering, no alignment, no factual reliability.
|
| 650 |
-
- **Medical, legal, or financial advice** — 12M parameters cannot store or reason over specialized knowledge.
|
| 651 |
-
- **Generating content about real people** — Outputs mentioning real people are likely to be fabricated.
|
| 652 |
-
- **Automated content pipelines** — Output quality is insufficient for unreviewed publication.
|
| 653 |
-
- **Non-English use** — Vocabulary is English-only.
|
| 654 |
-
- **Instruction following** — This is a base model.
|
| 655 |
-
|
| 656 |
-
---
|
| 657 |
-
|
| 658 |
-
## Ethical Considerations & Societal Impact
|
| 659 |
-
|
| 660 |
-
### Inherited Data Biases
|
| 661 |
-
|
| 662 |
-
Trained on FineWeb-HQ and StenCore, a filtered subset of Common Crawls on the web and PDFs. Inherits:
|
| 663 |
-
|
| 664 |
-
- **Western-centric perspective** — Educational content skews toward Western viewpoints.
|
| 665 |
-
- **English monolingualism** — Training data and vocabulary are English-only.
|
| 666 |
-
- **Demographic underrepresentation** — Groups underrepresented in English educational web content will be underrepresented in outputs.
|
| 667 |
-
|
| 668 |
-
### No Safety Tuning
|
| 669 |
-
|
| 670 |
-
No RLHF, no DPO, no constitutional AI, no content filtering.
|
| 671 |
-
|
| 672 |
-
### Positive Aspects
|
| 673 |
-
|
| 674 |
-
- **Democratizing AI research** — Trained entirely on free-tier Kaggle compute.
|
| 675 |
-
- **Transparency** — Full training hyperparameters, architecture details, and deep details published.
|
| 676 |
-
- **Minimal environmental footprint** — ~2.1 hours of dual-GPU compute.
|
| 677 |
-
|
| 678 |
-
---
|
| 679 |
-
|
| 680 |
-
## Inference Guide
|
| 681 |
-
|
| 682 |
-
### Basic Generation
|
| 683 |
-
|
| 684 |
-
```python
|
| 685 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 686 |
-
import torch
|
| 687 |
-
|
| 688 |
-
model = AutoModelForCausalLM.from_pretrained("StentorLabs/Stentor2-12M", torch_dtype=torch.float16)
|
| 689 |
-
tokenizer = AutoTokenizer.from_pretrained("StentorLabs/Stentor2-12M", trust_remote_code=True)
|
| 690 |
-
model = model.to("cuda").eval()
|
| 691 |
-
|
| 692 |
-
def generate(prompt, max_new_tokens=50, temperature=0.9, top_p=0.65):
|
| 693 |
-
input_ids = torch.tensor([tokenizer.encode(prompt)], dtype=torch.long).to(model.device)
|
| 694 |
-
attention_mask = torch.ones_like(input_ids)
|
| 695 |
-
with torch.inference_mode():
|
| 696 |
-
output = model.generate(
|
| 697 |
-
input_ids,
|
| 698 |
-
attention_mask=attention_mask,
|
| 699 |
-
max_new_tokens=max_new_tokens,
|
| 700 |
-
do_sample=True,
|
| 701 |
-
temperature=temperature,
|
| 702 |
-
top_p=top_p,
|
| 703 |
-
repetition_penalty=1.15,
|
| 704 |
-
pad_token_id=tokenizer.pad_token_id,
|
| 705 |
-
)
|
| 706 |
-
new_ids = output[0][input_ids.shape[1]:].tolist()
|
| 707 |
-
return tokenizer.decode(new_ids).strip()
|
| 708 |
-
|
| 709 |
-
print(generate("The history of computing began"))
|
| 710 |
-
```
|
| 711 |
-
|
| 712 |
-
---
|
| 713 |
-
|
| 714 |
-
## 🚀 Free Inference — Try It Now
|
| 715 |
-
|
| 716 |
-
**No GPU, no setup, no API key required.**
|
| 717 |
-
|
| 718 |
-
StentorLabs hosts a free, unlimited inference demo for all Stentor models at:
|
| 719 |
-
|
| 720 |
-
> 🔗 **[https://huggingface.co/spaces/StentorLabs/StentorLabs-demo_space](https://huggingface.co/spaces/StentorLabs/StentorLabs-demo_space)**
|
| 721 |
-
|
| 722 |
-
### Features
|
| 723 |
-
|
| 724 |
-
| Mode | Description |
|
| 725 |
-
|---|---|
|
| 726 |
-
| **Normal Generation** | Standard text completion with adjustable temp, top-p, repetition penalty, and max tokens |
|
| 727 |
-
| **Token Probability Explorer** | Inspect per-token probability distributions as the model generates |
|
| 728 |
-
| **Temperature Sweep** | Generate the same prompt across multiple temperatures simultaneously to compare behavior |
|
| 729 |
-
| **Head-to-Head Comparison** | Run two Stentor models side-by-side on the same prompt |
|
| 730 |
-
|
| 731 |
-
All parameters (temperature, top-p, repetition penalty, max tokens) are fully customizable. Inference is free and unlimited.
|
| 732 |
-
|
| 733 |
-
---
|
| 734 |
-
|
| 735 |
-
## Real Model Responses
|
| 736 |
-
|
| 737 |
-
The following are unfiltered outputs from Stentor2-12M. The first three are the very first generations run (no cherry-picking), the fourth is a deliberately bad example, and the fifth is a deliberately good one.
|
| 738 |
-
|
| 739 |
-
---
|
| 740 |
-
|
| 741 |
-
**Sample 1** — `temp=0.8, top_p=0.7, rep_penalty=1.2, max_tokens=140`
|
| 742 |
-
**Prompt:** `5 Tips and Tricks for Difficult Homework.`
|
| 743 |
-
|
| 744 |
-
```
|
| 745 |
-
SPECIAL STUDY SUBJECT: The Earth's Fall Times <22><22><22> Review the article with reference to
|
| 746 |
-
"A Tyre" <22><22><22> Revise your answers carefully and read it carefully. Write down what you
|
| 747 |
-
think you did and what you think it had to do with your answer. <22><22><22> Review your notes.
|
| 748 |
-
Read a book from the book, and review your answers. What would you do? <22><22><22> Do some
|
| 749 |
-
research findings on your own reading. <22><22><22> Invite students to read them. <22><22><22>
|
| 750 |
-
Try to learn the text by using different sources. <22>
|
| 751 |
-
```
|
| 752 |
-
|
| 753 |
-
> The model completely ignores the prompt and defaults to academic/educational framing. PDF tokens (`<22>`) appear throughout as list separators — a characteristic artifact of the training data.
|
| 754 |
-
|
| 755 |
-
---
|
| 756 |
-
|
| 757 |
-
**Sample 2** — `temp=0.8, top_p=0.7, rep_penalty=1.3, max_tokens=140`
|
| 758 |
-
**Prompt:** `How to Properly Cite Sources`
|
| 759 |
-
|
| 760 |
-
```
|
| 761 |
-
The Yellowstone Elementary School (CFP) is committed to providing an integrated and well-rounded
|
| 762 |
-
education system for students of all ages. The curriculum is designed to promote academic
|
| 763 |
-
achievement, instructional opportunities and a wider range of subject areas of study and practice
|
| 764 |
-
as well as teaching the student through its own learning style. This program is an important part
|
| 765 |
-
of the school's success in school and homework are set out in the district. We believe that all
|
| 766 |
-
pupils who receive a free school year will be able to attend classroom lessons from grade level
|
| 767 |
-
levels and will be required to complete their classes at any time during their summer break. We
|
| 768 |
-
are pleased that our current PSHCE
|
| 769 |
-
```
|
| 770 |
-
|
| 771 |
-
> Coherent, grammatically sound institutional prose — but completely unrelated to citing sources. Classic Stentor2 behavior: latches onto educational register and produces confident, fluent non-sequitur.
|
| 772 |
-
|
| 773 |
-
---
|
| 774 |
-
|
| 775 |
-
**Sample 3** — `temp=0.6, top_p=0.75, rep_penalty=1.3, max_tokens=120`
|
| 776 |
-
**Prompt:** `How to Lose Weight Fast`
|
| 777 |
-
|
| 778 |
-
```
|
| 779 |
-
The U.S. Department of Agriculture (USDA) is committed to providing the necessary services to
|
| 780 |
-
the economy and professions of urban development, as well as support for the protection of the
|
| 781 |
-
environment and the preservation of all living things within the community. The U.S. Government
|
| 782 |
-
provides a framework for developing this information in partnership with local organizations that
|
| 783 |
-
provide education, health care, and employment opportunities for all people affected by the
|
| 784 |
-
COVID-19 pandemic. We aim to ensure that the government's commitment to sustainable housing
|
| 785 |
-
through increased infrastructure and public transportation systems; therefore, we seek to
|
| 786 |
-
```
|
| 787 |
-
|
| 788 |
-
> No connection to weight loss. Government/policy language — another common register for this model. Fluent, well-structured, completely off-topic.
|
| 789 |
-
|
| 790 |
-
---
|
| 791 |
-
|
| 792 |
-
**Sample 4 (Hand-Picked Bad)** — `temp=0.8, top_p=0.5, rep_penalty=1.0, max_tokens=40`
|
| 793 |
-
**Prompt:** `Academics`
|
| 794 |
-
|
| 795 |
-
```
|
| 796 |
-
<22><22><22><22><22><22><22><22><22><22><22><22><22><22><22><22><22><22><22><22><22><22><22>
|
| 797 |
-
<22><22><22><22><22><22><22><22><22><22><22><22><22><22>
|
| 798 |
-
```
|
| 799 |
-
|
| 800 |
-
> Pure PDF token collapse. This is what happens with `rep_penalty=1.0` (off), `top_p=0.5` (too low), and a one-word prompt. All three conditions together push the model into its PDF-token attractor state. Do not use these settings.
|
| 801 |
-
|
| 802 |
-
---
|
| 803 |
-
|
| 804 |
-
**Sample 5 (Hand-Picked Good)** — `temp=1.0, top_p=0.7, rep_penalty=1.4, max_tokens=45`
|
| 805 |
-
**Prompt:** `How to do Homework Assignments`
|
| 806 |
-
|
| 807 |
-
```
|
| 808 |
-
Reasoning and Decision Making This Project is a great way to help students to succeed in school.
|
| 809 |
-
The project helps the student achieve better, the more they need to grow their faiths and to
|
| 810 |
-
support them in success as they become
|
| 811 |
-
```
|
| 812 |
-
|
| 813 |
-
> Clean, readable, no PDF tokens, no repetition. Not exactly on-topic (pivot to "project" framing is typical), but this is what good Stentor2 output looks like: coherent educational prose, correct grammar, sensible continuation.
|
| 814 |
-
|
| 815 |
-
---
|
| 816 |
-
|
| 817 |
-
## Quantization
|
| 818 |
-
|
| 819 |
-
### FP16
|
| 820 |
-
|
| 821 |
-
```python
|
| 822 |
-
model = AutoModelForCausalLM.from_pretrained("StentorLabs/Stentor2-12M", torch_dtype=torch.float16)
|
| 823 |
-
model = model.to("cuda")
|
| 824 |
-
```
|
| 825 |
-
|
| 826 |
-
### Dynamic INT8 (CPU)
|
| 827 |
-
|
| 828 |
-
```python
|
| 829 |
-
import torch
|
| 830 |
-
model_int8 = torch.quantization.quantize_dynamic(
|
| 831 |
-
model.to("cpu"),
|
| 832 |
-
{torch.nn.Linear},
|
| 833 |
-
dtype=torch.qint8,
|
| 834 |
-
)
|
| 835 |
-
```
|
| 836 |
-
|
| 837 |
-
---
|
| 838 |
-
|
| 839 |
-
## Format Conversion
|
| 840 |
-
|
| 841 |
-
### Convert to GGUF (for llama.cpp)
|
| 842 |
-
|
| 843 |
-
```bash
|
| 844 |
-
git clone https://github.com/ggerganov/llama.cpp
|
| 845 |
-
cd llama.cpp && pip install -r requirements.txt
|
| 846 |
-
|
| 847 |
-
huggingface-cli download StentorLabs/Stentor2-12M --local-dir stentor2-12m
|
| 848 |
-
|
| 849 |
-
python convert_hf_to_gguf.py stentor2-12m/ \
|
| 850 |
-
--outfile stentor2-12m.gguf \
|
| 851 |
-
--outtype f16
|
| 852 |
-
|
| 853 |
-
./llama-quantize stentor2-12m.gguf stentor2-12m-q4_0.gguf q4_0
|
| 854 |
-
./llama-cli -m stentor2-12m-q4_0.gguf -p "The science of" -n 50
|
| 855 |
-
```
|
| 856 |
-
|
| 857 |
-
### Convert to ONNX
|
| 858 |
-
|
| 859 |
-
```bash
|
| 860 |
-
pip install optimum[exporters]
|
| 861 |
-
optimum-cli export onnx \
|
| 862 |
-
--model StentorLabs/Stentor2-12M \
|
| 863 |
-
--task text-generation-with-past \
|
| 864 |
-
stentor2-12m-onnx/
|
| 865 |
-
```
|
| 866 |
-
|
| 867 |
-
---
|
| 868 |
-
|
| 869 |
-
## Speculative Decoding
|
| 870 |
-
|
| 871 |
-
Stentor2-12M can serve as a fast **draft model** to accelerate inference from larger Llama-family target models.
|
| 872 |
-
|
| 873 |
-
```python
|
| 874 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 875 |
-
import torch
|
| 876 |
-
|
| 877 |
-
draft_model = AutoModelForCausalLM.from_pretrained(
|
| 878 |
-
"StentorLabs/Stentor2-12M", torch_dtype=torch.float16
|
| 879 |
-
).to("cuda")
|
| 880 |
-
|
| 881 |
-
target_model = AutoModelForCausalLM.from_pretrained(
|
| 882 |
-
"meta-llama/Llama-3.2-1B",
|
| 883 |
-
torch_dtype=torch.float16,
|
| 884 |
-
device_map="auto"
|
| 885 |
-
)
|
| 886 |
-
target_tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")
|
| 887 |
-
|
| 888 |
-
inputs = target_tokenizer("Explain the concept of recursion", return_tensors="pt")
|
| 889 |
-
outputs = target_model.generate(
|
| 890 |
-
**inputs,
|
| 891 |
-
assistant_model=draft_model,
|
| 892 |
-
do_sample=True,
|
| 893 |
-
max_new_tokens=100
|
| 894 |
-
)
|
| 895 |
-
print(target_tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 896 |
-
```
|
| 897 |
-
|
| 898 |
-
**Important caveat:** Stentor2 uses a different vocabulary (8,064-token TokenMonster) than standard Llama models (32,000-token BPE). This vocabulary mismatch means the target model's acceptance rate may be lower than with a vocabulary-compatible draft model.
|
| 899 |
-
|
| 900 |
-
---
|
| 901 |
-
|
| 902 |
-
## Bias, Risks & Limitations
|
| 903 |
-
|
| 904 |
-
- **Prompt Relevance:** Outputs frequently off-topic for complex prompts.
|
| 905 |
-
- **Factual Accuracy:** All factual claims should be treated as unreliable.
|
| 906 |
-
- **Context Boundary:** Hard limit of 1,024 tokens.
|
| 907 |
-
- **English Bias:** TokenMonster English vocabulary; other languages tokenize poorly.
|
| 908 |
-
- **Training Data Bias:** Inherits biases in English-language educational web and PDF text.
|
| 909 |
-
- **Hallucination:** May produce confident but fabricated content.
|
| 910 |
-
- **No Alignment:** No RLHF, no DPO, no constitutional training.
|
| 911 |
-
- **Tokenizer Efficiency:** 8K TokenMonster vocabulary produces more tokens per word than standard 32K BPE. This is expected and not a bug.
|
| 912 |
-
- **Shared Tensor Warning:** `Removed shared tensor {'lm_head.weight'}` is expected behavior from tied word embeddings. Safe to ignore.
|
| 913 |
-
|
| 914 |
-
---
|
| 915 |
-
|
| 916 |
-
## Related Work
|
| 917 |
-
|
| 918 |
-
### Comparable Sub-50M Models
|
| 919 |
-
|
| 920 |
-
| Model | Parameters | Best Perplexity | Training Data | Notes |
|
| 921 |
-
|---|---|---|---|---|
|
| 922 |
-
| **Stentor2-12M** (this model) | 12.3M | **26.61** | FineWeb-HQ 480M tokens | Base model, TokenMonster vocab |
|
| 923 |
-
| Stentor-12M (v1) | 12.0M | 89.01 | FineWeb-Edu + Cosmopedia 200M | Baseline this model improves on |
|
| 924 |
-
| Stentor-30M (v1) | 30.4M | 33.02 | FineWeb-Edu + Cosmopedia 600M | Larger v1 model |
|
| 925 |
-
| TinyStories-33M | ~33M | varies | TinyStories (synthetic) | Story generation focused |
|
| 926 |
-
| Pythia-14M | 14M | varies (Pile) | The Pile 300B tokens | EleutherAI scaling baseline |
|
| 927 |
-
|
| 928 |
-
> **Comparison caveats:** Perplexity numbers are not directly comparable across models — different validation sets, vocabularies, and tokenizers all affect the number.
|
| 929 |
-
|
| 930 |
-
### Related Research Papers
|
| 931 |
-
|
| 932 |
-
| Paper | Relevance |
|
| 933 |
-
|---|---|
|
| 934 |
-
| [TinyStories](https://arxiv.org/abs/2305.07759) — Eldan & Li, 2023 | Demonstrates meaningful generation from 1M–33M parameter models |
|
| 935 |
-
| [Pythia](https://arxiv.org/abs/2304.01373) — Biderman et al., 2023 | Systematic study of small model scaling |
|
| 936 |
-
| [Scaling Laws](https://arxiv.org/abs/2001.08361) — Kaplan et al., 2020 | Informs token budget decisions |
|
| 937 |
-
| [Chinchilla](https://arxiv.org/abs/2203.15556) — Hoffmann et al., 2022 | ~480M tokens for 12M params is compute-optimal under this analysis |
|
| 938 |
-
| [RoPE](https://arxiv.org/abs/2104.09864) — Su et al., 2021 | Positional encoding used in this model |
|
| 939 |
-
| [Speculative Decoding](https://arxiv.org/abs/2211.17192) — Leviathan et al., 2023 | Primary use case for a fast draft model |
|
| 940 |
-
| [T5](https://arxiv.org/abs/1910.10683) — Raffel et al., 2020 | Source of NFKC text normalization approach |
|
| 941 |
-
|
| 942 |
-
---
|
| 943 |
-
|
| 944 |
-
## Environmental Impact
|
| 945 |
-
|
| 946 |
-
| Factor | Value |
|
| 947 |
-
|---|---|
|
| 948 |
-
| Hardware | 2× NVIDIA Tesla T4 |
|
| 949 |
-
| Active Training Duration | **~2.1 hours** |
|
| 950 |
-
| Cloud Provider | Kaggle (free tier) |
|
| 951 |
-
| Compute Region | Western USA |
|
| 952 |
-
| Estimated Carbon | Minimal (< 0.3 kg CO₂e estimated) |
|
| 953 |
-
|
| 954 |
-
---
|
| 955 |
-
|
| 956 |
-
## Citation
|
| 957 |
-
|
| 958 |
-
```bibtex
|
| 959 |
-
@misc{izumoto2026stentor2_12m,
|
| 960 |
-
title = {Stentor2-12M},
|
| 961 |
-
author = {Kai Izumoto},
|
| 962 |
-
year = {2026},
|
| 963 |
-
publisher = {StentorLabs},
|
| 964 |
-
howpublished = {\url{https://huggingface.co/StentorLabs/Stentor2-12M}},
|
| 965 |
-
note = {12.3M parameter LlamaForCausalLM base model trained on
|
| 966 |
-
FineWeb-HQ and StenCore with a TokenMonster 8K vocabulary.
|
| 967 |
-
Trained on 2x Tesla T4 GPUs. Apache 2.0 license.}
|
| 968 |
-
}
|
| 969 |
-
```
|
| 970 |
-
|
| 971 |
-
---
|
| 972 |
-
|
| 973 |
-
## Model Card Contact
|
| 974 |
-
|
| 975 |
-
Questions, benchmarks, or feedback: [StentorLabs@gmail.com](mailto:StentorLabs@gmail.com) or open a [discussion](https://huggingface.co/StentorLabs/Stentor2-12M/discussions).
|
| 976 |
-
|
| 977 |
-
---
|
| 978 |
-
|
| 979 |
-
<p align="center">
|
| 980 |
-
Made with ❤️ by <a href="https://huggingface.co/StentorLabs">StentorLabs</a><br>
|
| 981 |
-
<i>Democratizing AI through accessible, efficient models</i>
|
| 982 |
-
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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