Eclipse-Senpai commited on
Commit
c9188d0
·
verified ·
1 Parent(s): 4811828

Refine model card; finalize KeyLM75M config, modeling code, and tokenizer decoder

Browse files
Files changed (1) hide show
  1. README.md +85 -116
README.md CHANGED
@@ -13,116 +13,54 @@ tags:
13
  - swiglu
14
  - qk-norm
15
  - custom_code
16
- model-index:
17
- - name: KeyLM-75M-Instruct
18
- results:
19
- - task:
20
- type: text-generation
21
- name: Instruction Following
22
- dataset:
23
- name: IFEval
24
- type: google/IFEval
25
- metrics:
26
- - type: acc
27
- name: IFEval (4-metric average)
28
- value: 17.85
29
- - type: acc
30
- name: IFEval instruction-level (strict)
31
- value: 22.42
32
- - type: acc
33
- name: IFEval prompt-level (strict)
34
- value: 12.75
35
- - task:
36
- type: text-generation
37
- name: Multiple Choice
38
- dataset:
39
- name: MMLU
40
- type: cais/mmlu
41
- metrics:
42
- - type: acc
43
- name: MMLU (0-shot)
44
- value: 23.0
45
- - task:
46
- type: text-generation
47
- name: Multiple Choice
48
- dataset:
49
- name: ARC-Challenge
50
- type: allenai/ai2_arc
51
- metrics:
52
- - type: acc_norm
53
- name: ARC-Challenge (0-shot)
54
- value: 25.5
55
- - task:
56
- type: text-generation
57
- name: Multiple Choice
58
- dataset:
59
- name: ARC-Easy
60
- type: allenai/ai2_arc
61
- metrics:
62
- - type: acc_norm
63
- name: ARC-Easy (0-shot)
64
- value: 26.6
65
- - task:
66
- type: text-generation
67
- name: Multiple Choice
68
- dataset:
69
- name: HellaSwag
70
- type: Rowan/hellaswag
71
- metrics:
72
- - type: acc_norm
73
- name: HellaSwag (0-shot)
74
- value: 26.7
75
- - task:
76
- type: text-generation
77
- name: Multiple Choice
78
- dataset:
79
- name: PIQA
80
- type: ybisk/piqa
81
- metrics:
82
- - type: acc
83
- name: PIQA (0-shot)
84
- value: 53.1
85
- - task:
86
- type: text-generation
87
- name: Multiple Choice
88
- dataset:
89
- name: WinoGrande
90
- type: allenai/winogrande
91
- metrics:
92
- - type: acc
93
- name: WinoGrande (0-shot)
94
- value: 48.9
95
- - task:
96
- type: text-generation
97
- name: Multiple Choice
98
- dataset:
99
- name: OpenBookQA
100
- type: allenai/openbookqa
101
- metrics:
102
- - type: acc_norm
103
- name: OpenBookQA (0-shot)
104
- value: 18.4
105
  ---
106
 
107
  # KeyLM-75M-Instruct
108
 
109
- KeyLM-75M-Instruct is a 75M parameter instruction-tuned language model trained from scratch on approximately 18 billion tokens. That training budget is a small fraction of what comparable small models use. Despite this, it is competitive on instruction following, outperforming SmolLM-135M-Instruct on IFEval while using about half the parameters and a fraction of the training tokens.
110
 
111
- ## Results
112
 
113
- IFEval, evaluated with `lm_eval` (541 prompts, greedy decoding).
 
 
 
 
 
 
114
 
115
- | Model | Params | Train tokens | IFEval (4-metric avg) |
116
- |---|---|---|---|
117
- | **KeyLM-75M-Instruct** | **75M** | **~18B** | **17.85** |
118
- | SmolLM-135M-Instruct | 135M | ~600B | 17.15 |
119
- | SmolLM2-135M-Instruct | 135M | ~2T | 26.98 |
120
 
121
- Full benchmark results (MMLU, ARC, HellaSwag, PIQA, WinoGrande, OpenBookQA) appear in the evaluation panel above. On those multiple-choice knowledge and reasoning tasks the model scores near random chance, which is expected at this parameter and token budget. Its usable behavior comes from instruction tuning rather than parametric knowledge.
122
 
123
- ## Usage
 
 
 
 
 
 
 
 
 
124
 
125
- KeyLM ships its own modeling code, so load it with `trust_remote_code=True` (requires `transformers>=4.51`).
 
 
 
 
126
 
127
  ```python
128
  import torch
@@ -145,33 +83,64 @@ outputs = model.generate(
145
  print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
146
  ```
147
 
148
- GGUF builds for `llama.cpp`, LM Studio, and Ollama are available at [KeyLM-75M-Instruct-GGUF](https://huggingface.co/Eclipse-Senpai/KeyLM-75M-Instruct-GGUF).
149
 
150
- ## Model details
151
 
152
- | Field | Value |
153
- |---|---|
154
- | Parameters | 75,251,200 |
155
- | Architecture | Grouped-query attention, RoPE, SwiGLU, QK-RMSNorm |
156
- | Hidden size | 512 |
157
- | Layers | 24 |
158
- | Attention heads | 8 (2 KV heads) |
159
- | Context length | 2048 |
160
- | Vocabulary | 12,020 (ByteLevel BPE) |
161
- | Precision | float16 |
162
- | Chat format | `User:` / `Assistant:`, assistant turns end with `</s>` |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
 
164
- The architecture follows the standard small decoder recipe used by Llama and Qwen3. Weights are trained from random initialization. Instruction tuning uses `smol-smoltalk`, `ultrachat_200k`, and several `smoltalk2` splits with assistant-only loss masking, followed by a personality tuning pass.
165
 
166
  ## Limitations
167
 
168
  - Minimal world knowledge. Not suitable for factual question answering, reasoning, math, or code.
169
  - English only.
170
- - No dedicated safety alignment was performed.
171
 
172
  ## License
173
 
174
- Apache 2.0. Weights are trained from scratch and free to use, modify, and redistribute.
175
 
176
  ## Citation
177
 
 
13
  - swiglu
14
  - qk-norm
15
  - custom_code
16
+ datasets:
17
+ - HuggingFaceFW/fineweb-edu-score-2
18
+ - wikimedia/wikipedia
19
+ - HuggingFaceGECLM/REDDIT_comments
20
+ - marin-community/stackexchange-markdown
21
+ - allenai/WildChat-1M
22
+ - HuggingFaceH4/ultrachat_200k
23
+ - lmsys/lmsys-chat-1m
24
+ - OpenAssistant/oasst2
25
+ - HuggingFaceTB/cosmopedia-100k
26
+ - HuggingFaceTB/smol-smoltalk
27
+ - HuggingFaceTB/smoltalk2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  ---
29
 
30
  # KeyLM-75M-Instruct
31
 
32
+ KeyLM-75M-Instruct is a 75M parameter instruction-tuned language model trained from scratch on approximately 18 billion tokens. That training budget is a small fraction of what comparable small models use (SmolLM-135M was trained on roughly 600B tokens, SmolLM2-135M on roughly 2T). Despite this, it is competitive on instruction following, outperforming SmolLM-135M-Instruct on IFEval while using about half the parameters and a fraction of the data.
33
 
34
+ ## Table of Contents
35
 
36
+ 1. [Model Summary](#model-summary)
37
+ 2. [How to Use](#how-to-use)
38
+ 3. [Evaluation](#evaluation)
39
+ 4. [Training](#training)
40
+ 5. [Limitations](#limitations)
41
+ 6. [License](#license)
42
+ 7. [Citation](#citation)
43
 
44
+ ## Model Summary
 
 
 
 
45
 
46
+ KeyLM is a compact decoder-only transformer built on the standard small-model recipe used by Llama and Qwen3: grouped-query attention, rotary position embeddings (RoPE), SwiGLU feed-forward layers, and per-head QK-RMSNorm. It is designed for lightweight, low-latency English chat and instruction following.
47
 
48
+ | Field | Value |
49
+ |---|---|
50
+ | Parameters | 75,251,200 |
51
+ | Layers | 24 |
52
+ | Hidden size | 512 |
53
+ | Attention heads | 8 (2 KV heads, GQA) |
54
+ | Context length | 2048 |
55
+ | Vocabulary | 12,020 (ByteLevel BPE) |
56
+ | Precision | float16 |
57
+ | Training tokens | ~18B |
58
 
59
+ GGUF builds for `llama.cpp`, LM Studio, and Ollama are available at [KeyLM-75M-Instruct-GGUF](https://huggingface.co/Eclipse-Senpai/KeyLM-75M-Instruct-GGUF).
60
+
61
+ ## How to Use
62
+
63
+ KeyLM ships its own modeling code, so load it with `trust_remote_code=True`. It requires `transformers>=4.51`.
64
 
65
  ```python
66
  import torch
 
83
  print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
84
  ```
85
 
86
+ The model uses a plain `User:` / `Assistant:` chat format, applied automatically by `apply_chat_template`. Assistant turns end with `</s>`.
87
 
88
+ ## Evaluation
89
 
90
+ ### Instruction following (IFEval)
91
+
92
+ This is where KeyLM is competitive. All rows are evaluated with `lm_eval` (`ifeval`, 541 prompts, greedy decoding).
93
+
94
+ | Model | Params | Train tokens | inst (strict) | prompt (strict) | 4-metric avg |
95
+ |---|---|---|---|---|---|
96
+ | **KeyLM-75M-Instruct** | **75M** | **~18B** | **22.42** | **12.75** | **17.85** |
97
+ | SmolLM-135M-Instruct | 135M | ~600B | 21.58 | 9.98 | 17.15 |
98
+ | SmolLM2-135M-Instruct | 135M | ~2T | 32.37 | 18.85 | 26.98 |
99
+
100
+ KeyLM beats the original SmolLM-135M-Instruct at roughly half the size and a fraction of the training data. SmolLM2-135M-Instruct, a far more heavily trained model, remains ahead.
101
+
102
+ ### Knowledge and reasoning
103
+
104
+ On standard multiple-choice benchmarks KeyLM performs at or near random chance. This is the expected trade-off at 75M parameters and 18B tokens: the model has little parametric knowledge, and its useful behavior comes from instruction tuning rather than recall. All KeyLM scores are zero-shot via `lm_eval` (accuracy; ARC and HellaSwag use length-normalized accuracy).
105
+
106
+ | Model | Params | MMLU | ARC (avg) | HellaSwag | PIQA | WinoGrande | OpenBookQA |
107
+ |---|---|---|---|---|---|---|---|
108
+ | **KeyLM-75M-Instruct** | **75M** | **23.0** | **26.1** | **26.7** | **53.1** | **48.9** | **18.4** |
109
+ | Random baseline | n/a | 25.0 | 25.0 | 25.0 | 50.0 | 50.0 | 25.0 |
110
+ | GPT-2 (137M) | 137M | 26.3 | 31.1 | 29.8 | 62.5 | 49.7 | 29.4 |
111
+ | Pythia-160M | 160M | 26.7 | 31.9 | 29.6 | 61.6 | 49.5 | 27.8 |
112
+ | MobileLLM-125M | 125M | n/a | 35.5 | 38.9 | 65.3 | 53.1 | 39.5 |
113
+ | SmolLM-135M | 135M | 30.2 | 44.0 | 42.3 | 69.6 | 52.7 | 33.6 |
114
+
115
+ Figures for the comparison models are as reported in the SmolLM technical report and are included for rough context only; they may use different evaluation setups than the KeyLM rows.
116
+
117
+ ## Training
118
+
119
+ ### Pretraining
120
+
121
+ KeyLM was pretrained from random initialization on approximately 18B tokens, drawn from a weighted mixture of public datasets and streamed through a deterministic curriculum.
122
+
123
+ | Category | Share | Sources |
124
+ |---|---|---|
125
+ | Formal / quality | ~30% | FineWeb-Edu, Wikipedia |
126
+ | Casual / social | ~30% | Reddit comments, StackExchange |
127
+ | Conversational | ~25% | WildChat, UltraChat, LMSYS-Chat, OASST2 |
128
+ | Structured knowledge | ~5% | Cosmopedia |
129
+ | Typo augmentation | ~10% | Synthetic (contrastive) |
130
+
131
+ ### Post-training
132
 
133
+ Instruction tuning used `smol-smoltalk`, `ultrachat_200k`, and several `smoltalk2` splits (magpie, persona instruction-following, science, OpenHermes, system chats, summarization), with assistant-only loss masking, plus a set of custom synthetic instruction-following examples. A final personality tuning pass produced the released checkpoint.
134
 
135
  ## Limitations
136
 
137
  - Minimal world knowledge. Not suitable for factual question answering, reasoning, math, or code.
138
  - English only.
139
+ - No dedicated safety alignment was performed. Apply your own filtering before any user-facing use.
140
 
141
  ## License
142
 
143
+ Apache 2.0. The weights are trained from scratch and free to use, modify, and redistribute.
144
 
145
  ## Citation
146