User01110 commited on
Commit
fb05b7e
·
verified ·
1 Parent(s): 82fd808

Refresh model card

Browse files
Files changed (1) hide show
  1. README.md +153 -52
README.md CHANGED
@@ -15,79 +15,180 @@ datasets:
15
  - HuggingFaceTB/finemath
16
  ---
17
 
 
 
18
  # CMA 8M
19
 
20
- Benchmark-selected checkpoint from a 7.85M-parameter
21
- Channel-Mixing Attention generalist language model using the unmodified native
22
- GPT-S 4,096-token tokenizer. It has no arithmetic-specific token splitting,
23
- place embeddings, role embeddings, or inference-time equation detection. It
24
- was selected at step 40,000 for an Open SLM Leaderboard-style average of
25
- 36.21%. WikiText normalized BPB is reported separately
26
- and is not used for selection.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- ## Loading
 
 
 
 
 
 
 
29
 
30
- This is a custom Transformers architecture. `trust_remote_code=True` is
31
- required because stock Hugging Face model classes do not implement CMA or this
32
- model's exact rotary convention.
 
 
33
 
34
  ```python
35
  from transformers import AutoModelForCausalLM, AutoTokenizer
36
 
37
- repo = "User01110/cma-8M"
38
- tokenizer = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
 
 
 
 
39
  model = AutoModelForCausalLM.from_pretrained(
40
- repo, trust_remote_code=True, dtype="auto"
 
 
41
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ```
43
 
 
 
 
44
  ## Architecture
45
 
46
- - Parameters: 7,849,161, with tied input/output embeddings
47
- - Weights: safetensors only (`model.safetensors`); no PyTorch `.bin` weights
48
- - Runtime: PyTorch 2.5+ for native SDPA grouped-query attention
49
- - Tokenizer: AxiomicLabs/GPT-S-5M at revision df47402
50
- - Vocabulary: 4,096 native tokens
51
- - Parameter allocation: 1,179,648 tied embedding parameters and
52
- 6,669,513 non-embedding parameters
53
- - Context: 1,024 tokens
54
- - Width/layers: 288 / 9
55
- - Token-attention heads: 6 query, 2 KV
56
- - CMA: chunk=24, heads=3, expansion=2
57
- - Contiguous-half RoPE without scaling
58
- - No task-specific model features or tokenizer transformations
 
 
 
 
59
 
60
  ## Training mixture
61
 
62
- - FineWeb-Edu 100BT shuffled: 55.00% of trained tokens
63
- - Cosmopedia v2: 25.00% of trained tokens
64
- - FineWeb-HQ: 10.00% of trained tokens
65
- - FineMath 4+: 10.00% of trained tokens
 
 
 
 
66
 
67
  FineMath-4+ supplies high-quality mathematical explanations and reasoning as
68
- ordinary causal-language-model text, with no task-specific model features or
69
- tokenizer transformations. All four training sources are streamed natural-text
70
- corpora.
 
71
 
72
- ## Zero-shot evaluation at step 40,000
73
 
74
- The four lm-eval tasks use normalized accuracy when supplied by lm-eval
75
- 0.4.12, with float32 weights and softmax. ArithMark
76
- uses float32 weights and its official raw continuation log-likelihood-sum rule.
77
 
78
  | Benchmark | Accuracy |
79
  |---|---:|
80
- | HellaSwag | 28.19% |
81
- | ARC-Easy | 35.35% |
82
- | ARC-Challenge | 23.29% |
83
- | PIQA | 58.22% |
84
- | ArithMark-2 | 29.12% |
85
- | ARC mean | 29.32% |
86
- | Open SLM Leaderboard-style average | 36.21% |
87
-
88
- The average is `(HellaSwag + mean(ARC-Easy, ARC-Challenge) + PIQA +
89
- ArithMark-2) / 4`, matching the Open SLM Leaderboard formula.
90
-
91
- WikiText-103 validation at this step: loss 2.9903, perplexity
92
- 19.89, normalized BPB 1.3520 over 358,911
93
- scored tokens and 1,145,226 normalized UTF-8 bytes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  - HuggingFaceTB/finemath
16
  ---
17
 
18
+ <div align="center">
19
+
20
  # CMA 8M
21
 
22
+ ### Channel-Mixing Attention, distilled to 7.85 million parameters.
23
+
24
+ A compact generalist language model built to study channel mixing at small scale.
25
+
26
+ ![Parameters](https://img.shields.io/badge/parameters-7.85M-111827?style=flat-square)
27
+ ![Context](https://img.shields.io/badge/context-1%2C024-1f2937?style=flat-square)
28
+ ![Vocabulary](https://img.shields.io/badge/vocabulary-4%2C096-374151?style=flat-square)
29
+ ![Weights](https://img.shields.io/badge/weights-safetensors-f59e0b?style=flat-square)
30
+
31
+ **Benchmark-selected at step 40,000 ? Open SLM Leaderboard-style average: 36.21%**
32
+
33
+ </div>
34
+
35
+ ---
36
+
37
+ ## Overview
38
+
39
+ CMA 8M is the benchmark-selected checkpoint of a **7,849,161-parameter**
40
+ Channel-Mixing Attention generalist causal language model. It pairs a compact
41
+ nine-layer architecture with the unmodified native GPT-S 4,096-token tokenizer.
42
+
43
+ The model is deliberately free of task-specific shortcuts. It uses no
44
+ arithmetic-specific token splitting, place embeddings, role embeddings,
45
+ inference-time equation detection, or tokenizer transformations. Mathematical
46
+ text is learned as ordinary causal-language-model text.
47
 
48
+ | | |
49
+ |---|---|
50
+ | **Architecture** | Channel-Mixing Attention causal LM |
51
+ | **Parameters** | 7,849,161, with tied input/output embeddings |
52
+ | **Checkpoint** | Step 40,000 |
53
+ | **Context length** | 1,024 tokens |
54
+ | **Vocabulary** | 4,096 native tokens |
55
+ | **Weight format** | Safetensors only |
56
 
57
+ ## Quick start
58
+
59
+ This repository contains a custom Transformers architecture. Stock Hugging Face
60
+ model classes do not implement CMA or this model's exact rotary convention, so
61
+ `trust_remote_code=True` is required.
62
 
63
  ```python
64
  from transformers import AutoModelForCausalLM, AutoTokenizer
65
 
66
+ repo_id = "User01110/cma-8M"
67
+
68
+ tokenizer = AutoTokenizer.from_pretrained(
69
+ repo_id,
70
+ trust_remote_code=True,
71
+ )
72
  model = AutoModelForCausalLM.from_pretrained(
73
+ repo_id,
74
+ trust_remote_code=True,
75
+ dtype="auto",
76
  )
77
+ model.eval()
78
+ ```
79
+
80
+ Generate a continuation:
81
+
82
+ ```python
83
+ import torch
84
+
85
+ prompt = "Channel-mixing attention is"
86
+ inputs = tokenizer(prompt, return_tensors="pt")
87
+
88
+ with torch.inference_mode():
89
+ output = model.generate(
90
+ **inputs,
91
+ max_new_tokens=80,
92
+ do_sample=True,
93
+ temperature=0.8,
94
+ top_p=0.95,
95
+ )
96
+
97
+ print(tokenizer.decode(output[0], skip_special_tokens=True))
98
  ```
99
 
100
+ > `trust_remote_code=True` executes the modeling code stored in this repository.
101
+ > Review that code before loading the model in a sensitive environment.
102
+
103
  ## Architecture
104
 
105
+ | Component | Configuration |
106
+ |---|---:|
107
+ | Total parameters | **7,849,161** |
108
+ | Tied embedding parameters | 1,179,648 |
109
+ | Non-embedding parameters | 6,669,513 |
110
+ | Width / layers | 288 / 9 |
111
+ | Context length | 1,024 tokens |
112
+ | Token-attention heads | 6 query / 2 KV |
113
+ | CMA | chunk 24 / 3 heads / expansion 2 |
114
+ | Positional encoding | Contiguous-half RoPE without scaling |
115
+ | Tokenizer | `AxiomicLabs/GPT-S-5M` at revision `df47402` |
116
+ | Vocabulary | 4,096 native tokens |
117
+ | Runtime | PyTorch 2.5+ for native SDPA grouped-query attention |
118
+ | Weights | `model.safetensors` only; no PyTorch `.bin` weights |
119
+
120
+ Input and output embeddings are tied. The model contains no task-specific model
121
+ features or tokenizer transformations.
122
 
123
  ## Training mixture
124
 
125
+ All four sources are streamed natural-text corpora.
126
+
127
+ | Source | Share of trained tokens |
128
+ |---|---:|
129
+ | FineWeb-Edu 100BT shuffled | **55.00%** |
130
+ | Cosmopedia v2 | **25.00%** |
131
+ | FineWeb-HQ | **10.00%** |
132
+ | FineMath 4+ | **10.00%** |
133
 
134
  FineMath-4+ supplies high-quality mathematical explanations and reasoning as
135
+ ordinary causal-language-model text, without task-specific model features or
136
+ tokenizer transformations.
137
+
138
+ ## Evaluation
139
 
140
+ ### Zero-shot results at step 40,000
141
 
142
+ The four lm-eval tasks use normalized accuracy when supplied by `lm-eval`
143
+ 0.4.12, with float32 weights and softmax. ArithMark uses float32 weights and its
144
+ official raw continuation log-likelihood-sum rule.
145
 
146
  | Benchmark | Accuracy |
147
  |---|---:|
148
+ | HellaSwag | **28.19%** |
149
+ | ARC-Easy | **35.35%** |
150
+ | ARC-Challenge | **23.29%** |
151
+ | PIQA | **58.22%** |
152
+ | ArithMark-2 | **29.12%** |
153
+ | ARC mean | **29.32%** |
154
+ | **Open SLM Leaderboard-style average** | **36.21%** |
155
+
156
+ The selection average is:
157
+
158
+ ```text
159
+ (HellaSwag + mean(ARC-Easy, ARC-Challenge) + PIQA + ArithMark-2) / 4
160
+ ```
161
+
162
+ This matches the Open SLM Leaderboard formula. The checkpoint was selected at
163
+ step 40,000 for its **36.21%** average.
164
+
165
+ ### WikiText-103 validation
166
+
167
+ | Metric | Value |
168
+ |---|---:|
169
+ | Loss | **2.9903** |
170
+ | Perplexity | **19.89** |
171
+ | Normalized BPB | **1.3520** |
172
+ | Scored tokens | 358,911 |
173
+ | Normalized UTF-8 bytes | 1,145,226 |
174
+
175
+ WikiText normalized BPB is reported separately and was **not** used for
176
+ checkpoint selection.
177
+
178
+ ## Intended use and limitations
179
+
180
+ CMA 8M is intended for research into compact language models, Channel-Mixing
181
+ Attention, controlled evaluation, and lightweight local experiments. It is a
182
+ base causal language model, not an instruction-tuned chat assistant.
183
+
184
+ At 7.85M parameters, its knowledge and reasoning capacity are sharply limited
185
+ relative to larger models. Generated text may be incorrect, incoherent, biased,
186
+ or unsafe. Verify outputs before using them downstream.
187
+
188
+ ---
189
+
190
+ <div align="center">
191
+
192
+ **Compact scale. Native tokens. Channel mixing.**
193
+
194
+ </div>