Text Generation
Transformers
Safetensors
English
klm
custom_code
small-language-model
base
pretrained
hybrid
gated-deltanet
Instructions to use MinimaLabs/KLM-1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MinimaLabs/KLM-1.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MinimaLabs/KLM-1.5", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("MinimaLabs/KLM-1.5", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MinimaLabs/KLM-1.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MinimaLabs/KLM-1.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinimaLabs/KLM-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MinimaLabs/KLM-1.5
- SGLang
How to use MinimaLabs/KLM-1.5 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 "MinimaLabs/KLM-1.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinimaLabs/KLM-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "MinimaLabs/KLM-1.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MinimaLabs/KLM-1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MinimaLabs/KLM-1.5 with Docker Model Runner:
docker model run hf.co/MinimaLabs/KLM-1.5
Simplify model card
Browse files- README.md +36 -88
- charts/benchmarks.svg +55 -67
- charts/training.svg +0 -128
README.md
CHANGED
|
@@ -12,7 +12,6 @@ tags:
|
|
| 12 |
- pretrained
|
| 13 |
- hybrid
|
| 14 |
- gated-deltanet
|
| 15 |
-
- sub-100m
|
| 16 |
datasets:
|
| 17 |
- nvidia/Nemotron-ClimbMix
|
| 18 |
- IFM/TxT360-v2
|
|
@@ -31,111 +30,64 @@ datasets:
|
|
| 31 |
|
| 32 |
# KLM 1.5
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
-
## What's new
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
-
|
| 43 |
-
- **Block Attention Residuals** ([Kimi Team, 2026](https://arxiv.org/abs/2603.15031)). Each layer's input is a learned, input-dependent mix of the token embedding, the n-gram memory and the output of every earlier layer, in place of one running residual sum.
|
| 44 |
-
- **Exact n-gram memory.** The 125,000 most frequent bigrams and 38,000 most frequent trigrams in the training data each get their own learned 32-number row, found by exact lookup with no hashing. The memory holds 5.4M parameters and feeds the network as one more residual source.
|
| 45 |
-
- **A 4,100-token tokenizer**, min-spark's 4,096 tokens plus `<|im_start|>`, `<|im_end|>`, `<think>` and `</think>`. It splits every number into single digits. Embeddings are tied and take 2.1M parameters, so the parameters KLM 1.1 spent on its vocabulary go to the layers instead.
|
| 46 |
-
- **Training from scratch** on 100B tokens of a new mix, after a superposition warm-up over 128B tokens, with the MuonEq-R optimizer.
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
All scores are zero-shot and length-normalized. ARC, HellaSwag and PIQA use lm-eval 0.4.12; ArithMark-3 uses the official [ArithMark-3.0](https://huggingface.co/datasets/AxiomicLabs/ArithMark-3.0) script. Peer scores are from the leaderboard on 2026-10-22.
|
| 51 |
-
|
| 52 |
-

|
| 53 |
|
| 54 |
| Model | Params | ARC-Easy | ARC-Challenge | HellaSwag | PIQA | ArithMark-3 |
|
| 55 |
|-------|--------|----------|---------------|-----------|------|-------------|
|
| 56 |
| **KLM 1.5** | 99.0M | 59.68% | 32.68% | 43.74% | 68.55% | 48.20% |
|
| 57 |
-
| [GPT-X3-150M](https://huggingface.co/AxiomicLabs/GPT-X3-150M) | 149M | 59.64% | 31.31% |
|
| 58 |
-
| [Boris-2-Preview-1](https://huggingface.co/opencerebral/Boris-2-Preview-1) | 144M | 58.38% | 29.95% | 45.23% | 69.21% | 37.60% |
|
| 59 |
-
| [cagliostro-v3.5](https://huggingface.co/bench-labs/cagliostro-v3.5) | 146M | 53.75% | 29.35% | 43.41% | 68.06% | 45.30% |
|
| 60 |
| [SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M) | 135M | 58.63% | 29.69% | 43.22% | 68.44% | 39.20% |
|
| 61 |
-
| [LFM-2.5-230M-Base](https://huggingface.co/LiquidAI/LFM2.5-230M-Base) | 230M |
|
| 62 |
| [void.1](https://huggingface.co/dotlabs/void.1) | 90.1M | 47.31% | 28.16% | 38.68% | 67.46% | 44.80% |
|
| 63 |
| [KLM 1.1](https://huggingface.co/MinimaLabs/KLM-1.1) | 88.1M | 44.36% | 25.17% | 33.65% | 64.80% | 35.80% |
|
| 64 |
|
| 65 |
## Training
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
| Phase | Steps | Text read | What the model learns |
|
| 70 |
-
|---|---|---|---|
|
| 71 |
-
| Superposition warm-up | 70,000 | 128B tokens of ClimbMix | Predicting the next group of 7 tokens |
|
| 72 |
-
| Stable | 304,000 | 79.7B tokens | Next-token prediction at full learning rate |
|
| 73 |
-
| Decay | 76,000 | 19.9B tokens | Next-token prediction while the learning rate falls to zero |
|
| 74 |
-
|
| 75 |
-
### Superposition warm-up
|
| 76 |
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
|
| 79 |
-
|
| 80 |
|
| 81 |
-
|
|
| 82 |
-
|---|---|---|---|
|
| 83 |
-
|
|
| 84 |
-
|
|
| 85 |
-
|
|
| 86 |
-
|
|
| 87 |
-
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
| Field | Value |
|
| 92 |
-
|---|---|
|
| 93 |
-
| Steps | 450,000 at 128 sequences × 2,048 tokens |
|
| 94 |
-
| Precision | bf16 autocast |
|
| 95 |
-
| Optimizer | MuonEq-R (matrices in the mixers and FFNs, learning rate 0.01, momentum 0.95, weight decay 0.01) + AdamW (embedding, norms, gates, convolutions, learning rate 3e-3; n-gram rows, learning rate 1.5e-2; no weight decay) |
|
| 96 |
-
| Learning-rate schedule | 2,000-step warmup, constant, then 1−√t decay to zero over the final 76,000 steps |
|
| 97 |
-
| Objective | Next-token loss, plus a penalty that is zero unless a Gated DeltaNet-2 decay channel saturates and stops keeping any memory |
|
| 98 |
-
| Gradient clipping | 1.0 |
|
| 99 |
-
| Attention masking | Intra-document, in the attention layers, the recurrent layers and the n-gram lookups |
|
| 100 |
-
|
| 101 |
-
### Data
|
| 102 |
-
|
| 103 |
-
| Source | Stable | Decay | License |
|
| 104 |
-
|---|---:|---:|---|
|
| 105 |
-
| [ClimbMix](https://huggingface.co/datasets/nvidia/Nemotron-ClimbMix) web text, read from the [OptimalScale copy](https://huggingface.co/datasets/OptimalScale/ClimbMix) (also the whole warm-up) | 43% | 21% | CC BY-NC 4.0 |
|
| 106 |
-
| [TxT360-v2](https://huggingface.co/datasets/IFM/TxT360-v2) web pages with reading-comprehension Q&A | 10% | 8% | CC BY 4.0 |
|
| 107 |
-
| TxT360-v2 web text | 6% | | CC BY 4.0 |
|
| 108 |
-
| [UltraX](https://huggingface.co/datasets/openbmb/UltraX-Preview) refined FineWeb-Edu | 7% | 5% | Apache-2.0 |
|
| 109 |
-
| [Cosmopedia v2](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus) synthetic textbooks | 12% | 12% | ODC-BY |
|
| 110 |
-
| [Cosmopedia](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia) WikiHow-style tutorials | | 2% | Apache-2.0 |
|
| 111 |
-
| Commonsense: [DCLM-baseline](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0) filtered for physical commonsense, plus ATOMIC 2020, ANLI, GLUCOSE, CREAK, SciQ and QASC | 3% | 8% | CC BY 4.0, CC BY-NC 4.0 (ANLI), CC BY-NC 3.0 (SciQ), MIT (CREAK) |
|
| 112 |
-
| [OpenMathInstruct-2](https://huggingface.co/datasets/nvidia/OpenMathInstruct-2) problems with solutions | 4% | 8% | CC BY 4.0 |
|
| 113 |
-
| [UltraData-Math](https://huggingface.co/datasets/openbmb/UltraData-Math) Q&A and textbook math | 3% | 3% | Apache-2.0 |
|
| 114 |
-
| [Math-Reasoning](https://huggingface.co/datasets/IFM/Math-Reasoning) worked problems with every digit operation written out (`math-thinking-oss`) | 2% | 4% | Apache-2.0 |
|
| 115 |
-
| Math-Reasoning textbook-style rewrites (`math-rewrite`) | 1% | 1% | Apache-2.0 |
|
| 116 |
-
| [Dolmino](https://huggingface.co/datasets/allenai/dolma3_dolmino_mix-100B-1025) grade-school math dialogues (`tinymath-mind`) | 1% | 4% | ODC-BY |
|
| 117 |
-
| Dolmino science web crawl | 3% | 8% | ODC-BY |
|
| 118 |
-
| Dolmino Q&A: passages with questions, synthetic Q&A and multiple-choice flashcards | 3% | 15% | ODC-BY |
|
| 119 |
-
| [Pretrain-Behaviors](https://huggingface.co/datasets/IFM/Pretrain-Behaviors) reasoning and format rewrites | 2% | 1% | Apache-2.0 |
|
| 120 |
-
|
| 121 |
-
Every source was checked against the five evaluation sets: any document sharing a 13-word sequence with an evaluation item was dropped.
|
| 122 |
|
| 123 |
## Architecture
|
| 124 |
|
| 125 |
| Field | Value |
|
| 126 |
|---|---|
|
| 127 |
-
| Parameters | 98,975,308
|
| 128 |
-
| Layers | 24
|
| 129 |
| Hidden size | 512 |
|
| 130 |
-
| Gated DeltaNet-2 | 4 heads × 128
|
| 131 |
-
| Attention | 8 query heads, 4 KV heads
|
| 132 |
| Feed-forward | SwiGLU, hidden size 1,408 |
|
| 133 |
-
| Residual stream | Block Attention Residuals, one block per layer |
|
| 134 |
-
| N-gram memory | 125,000 bigram + 38,000 trigram rows × 32, exact lookup |
|
| 135 |
-
| Position encoding | RoPE (theta 10,000) in the attention layers |
|
| 136 |
| Context length | 2,048 tokens |
|
| 137 |
-
| Vocabulary | 4,100
|
| 138 |
-
| Embeddings | Tied input and output |
|
| 139 |
|
| 140 |
## Usage
|
| 141 |
|
|
@@ -150,20 +102,16 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 150 |
).to("cuda")
|
| 151 |
|
| 152 |
inputs = tokenizer("The three primary colors are", return_tensors="pt").to("cuda")
|
| 153 |
-
outputs = model.generate(
|
| 154 |
-
**inputs, max_new_tokens=40, do_sample=True,
|
| 155 |
-
temperature=0.7, top_p=0.9, repetition_penalty=1.1,
|
| 156 |
-
)
|
| 157 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 158 |
```
|
| 159 |
|
| 160 |
## Limitations
|
| 161 |
|
| 162 |
-
-
|
| 163 |
-
-
|
| 164 |
-
- English only,
|
| 165 |
-
- No safety alignment. Add your own filtering before any user-facing use.
|
| 166 |
|
| 167 |
## License
|
| 168 |
|
| 169 |
-
Apache-2.0. See [LICENSE](LICENSE).
|
|
|
|
| 12 |
- pretrained
|
| 13 |
- hybrid
|
| 14 |
- gated-deltanet
|
|
|
|
| 15 |
datasets:
|
| 16 |
- nvidia/Nemotron-ClimbMix
|
| 17 |
- IFM/TxT360-v2
|
|
|
|
| 30 |
|
| 31 |
# KLM 1.5
|
| 32 |
|
| 33 |
+
KLM 1.5 is a 99M-parameter base language model, trained from scratch on 100B tokens. Most of its layers are recurrent Gated DeltaNet-2 layers, with full attention in every fourth layer.
|
| 34 |
|
| 35 |
+
## What's new
|
| 36 |
|
| 37 |
+
- **Hybrid layers.** 18 of the 24 layers are [Gated DeltaNet-2](https://github.com/fla-org/flash-linear-attention) layers, which carry a fixed-size memory through the sequence. The other 6 use full attention.
|
| 38 |
+
- **Block Attention Residuals** ([Kimi Team, 2026](https://arxiv.org/abs/2603.15031)). Each layer reads a learned mix of the embeddings and every earlier layer's output, instead of one running residual sum.
|
| 39 |
+
- **Exact n-gram memory.** The 125,000 most frequent bigrams and 38,000 most frequent trigrams each have a learned vector, looked up exactly and fed in next to the token embeddings. It holds 5.4M parameters.
|
| 40 |
+
- **A small tokenizer.** 4,100 tokens, with every number split into digits. Tied embeddings cost 2.1M parameters, so almost all of the model is layers.
|
| 41 |
|
| 42 |
+
## Benchmarks
|
| 43 |
|
| 44 |
+
Zero-shot, length-normalized accuracy. ARC, HellaSwag and PIQA use lm-eval 0.4.12; ArithMark-3 uses the official [ArithMark-3.0](https://huggingface.co/datasets/AxiomicLabs/ArithMark-3.0) script. On the [Open SLM leaderboard](https://huggingface.co/spaces/AxiomicLabs/Open_SLM_Leaderboard), these scores give KLM 1.5 an Intelligence Index of 30.26, first among models under 100M parameters and second under 150M. Peer scores are from the leaderboard on 2026-10-22.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+

|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
| Model | Params | ARC-Easy | ARC-Challenge | HellaSwag | PIQA | ArithMark-3 |
|
| 49 |
|-------|--------|----------|---------------|-----------|------|-------------|
|
| 50 |
| **KLM 1.5** | 99.0M | 59.68% | 32.68% | 43.74% | 68.55% | 48.20% |
|
| 51 |
+
| [GPT-X3-150M](https://huggingface.co/AxiomicLabs/GPT-X3-150M) | 149M | 59.64% | 31.31% | 46.16% | 71.33% | 50.90% |
|
|
|
|
|
|
|
| 52 |
| [SmolLM2-135M](https://huggingface.co/HuggingFaceTB/SmolLM2-135M) | 135M | 58.63% | 29.69% | 43.22% | 68.44% | 39.20% |
|
| 53 |
+
| [LFM-2.5-230M-Base](https://huggingface.co/LiquidAI/LFM2.5-230M-Base) | 230M | 59.72% | 34.98% | 39.29% | 63.38% | 36.60% |
|
| 54 |
| [void.1](https://huggingface.co/dotlabs/void.1) | 90.1M | 47.31% | 28.16% | 38.68% | 67.46% | 44.80% |
|
| 55 |
| [KLM 1.1](https://huggingface.co/MinimaLabs/KLM-1.1) | 88.1M | 44.36% | 25.17% | 33.65% | 64.80% | 35.80% |
|
| 56 |
|
| 57 |
## Training
|
| 58 |
|
| 59 |
+
Training used 2,048-token sequences, 128 per step, in three stages:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
+
1. **Superposition warm-up**, 70,000 steps ([Token-Superposition Training](https://arxiv.org/abs/2605.06546)). Each input position averages 7 consecutive tokens, and the model predicts the next 7 as an unordered group. This covers 128B tokens of ClimbMix for the compute of about 18B.
|
| 62 |
+
2. **Stable**, 80B tokens of next-token prediction at a constant learning rate.
|
| 63 |
+
3. **Decay**, 20B tokens on a mix with more math and Q&A, while the learning rate falls to zero (1−√t). Most of the benchmark gain came here: at 70B tokens the model scored 52.9% on ARC-Easy and 38.6% on HellaSwag.
|
| 64 |
|
| 65 |
+
Matrices in the layers use MuonEq-R (learning rate 0.01); everything else uses AdamW (3e-3). Precision is bf16, and attention, recurrence and n-gram lookups never cross document boundaries.
|
| 66 |
|
| 67 |
+
| Data | Sources | Stable | Decay |
|
| 68 |
+
|---|---|---:|---:|
|
| 69 |
+
| Web text | [ClimbMix](https://huggingface.co/datasets/nvidia/Nemotron-ClimbMix), [TxT360-v2](https://huggingface.co/datasets/IFM/TxT360-v2), [UltraX](https://huggingface.co/datasets/openbmb/UltraX-Preview) | 56% | 26% |
|
| 70 |
+
| Q&A | TxT360-v2 Q&A, [Dolmino](https://huggingface.co/datasets/allenai/dolma3_dolmino_mix-100B-1025) Q&A and flashcards | 13% | 23% |
|
| 71 |
+
| Textbooks | [Cosmopedia v2](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus), [Cosmopedia](https://huggingface.co/datasets/HuggingFaceTB/cosmopedia) WikiHow | 12% | 14% |
|
| 72 |
+
| Math | [OpenMathInstruct-2](https://huggingface.co/datasets/nvidia/OpenMathInstruct-2), [UltraData-Math](https://huggingface.co/datasets/openbmb/UltraData-Math), [Math-Reasoning](https://huggingface.co/datasets/IFM/Math-Reasoning), Dolmino TinyMATH | 11% | 20% |
|
| 73 |
+
| Science web | Dolmino | 3% | 8% |
|
| 74 |
+
| Commonsense | [DCLM-baseline](https://huggingface.co/datasets/mlfoundations/dclm-baseline-1.0) filtered for physical commonsense, ATOMIC 2020, ANLI, GLUCOSE, CREAK, SciQ, QASC | 3% | 8% |
|
| 75 |
+
| Reasoning rewrites | [Pretrain-Behaviors](https://huggingface.co/datasets/IFM/Pretrain-Behaviors) | 2% | 1% |
|
| 76 |
|
| 77 |
+
Any document sharing a 13-word sequence with an evaluation item was dropped. ClimbMix, ANLI and SciQ are licensed for non-commercial use only; the other sources are under CC BY, ODC-BY, Apache-2.0 or MIT.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
## Architecture
|
| 80 |
|
| 81 |
| Field | Value |
|
| 82 |
|---|---|
|
| 83 |
+
| Parameters | 98,975,308, of which 5,411,832 are the n-gram memory |
|
| 84 |
+
| Layers | 24: three Gated DeltaNet-2 layers, then one attention layer, six times |
|
| 85 |
| Hidden size | 512 |
|
| 86 |
+
| Gated DeltaNet-2 | 4 heads × 128 |
|
| 87 |
+
| Attention | 8 query heads, 4 KV heads, head size 64, RoPE, QK-norm, output gate |
|
| 88 |
| Feed-forward | SwiGLU, hidden size 1,408 |
|
|
|
|
|
|
|
|
|
|
| 89 |
| Context length | 2,048 tokens |
|
| 90 |
+
| Vocabulary | 4,100 tokens, tied embeddings |
|
|
|
|
| 91 |
|
| 92 |
## Usage
|
| 93 |
|
|
|
|
| 102 |
).to("cuda")
|
| 103 |
|
| 104 |
inputs = tokenizer("The three primary colors are", return_tensors="pt").to("cuda")
|
| 105 |
+
outputs = model.generate(**inputs, max_new_tokens=40, do_sample=True, temperature=0.7, top_p=0.9)
|
|
|
|
|
|
|
|
|
|
| 106 |
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 107 |
```
|
| 108 |
|
| 109 |
## Limitations
|
| 110 |
|
| 111 |
+
- A base model: it completes text and does not follow instructions or chat.
|
| 112 |
+
- Its knowledge is thin and its facts are often wrong.
|
| 113 |
+
- English only, 2,048-token context, no safety alignment.
|
|
|
|
| 114 |
|
| 115 |
## License
|
| 116 |
|
| 117 |
+
Apache-2.0. See [LICENSE](LICENSE).
|
charts/benchmarks.svg
CHANGED
|
|
|
|
charts/training.svg
DELETED