Eclipse-Senpai commited on
Commit
53cbb58
·
verified ·
1 Parent(s): ecea47d

model card: rewritten as proper release card (no internal names, prose benchmarks, KeyLM comparison, hfviewer arch embed)

Browse files
Files changed (1) hide show
  1. README.md +119 -52
README.md CHANGED
@@ -7,26 +7,29 @@ tags:
7
  - tiny
8
  - looped
9
  - text-generation
 
10
  ---
11
 
12
  # min-spark
13
 
14
- min-spark is a ~5.76M-parameter decoder-only language model, trained on
15
- 10.01B tokens (WSD-decayed). It is the first release in the PICO series: a
16
- looped, weight-shared hybrid with a tied byte-level BPE vocabulary of 4,096.
17
 
18
- Three inference settings **effort levels** trade compute for quality:
 
 
 
19
 
20
- | Effort | Compute |
21
- |--------|---------|
22
- | min-spark-low | quickest |
23
- | min-spark-medium | balanced (default) |
24
- | min-spark-high | highest quality |
25
 
26
- ## Quick start
27
 
28
- > **Private repo:** the repository is currently private. Authenticate first:
29
- > `hf auth login` (or set `HF_TOKEN`). This becomes unnecessary at public release.
30
 
31
  ```python
32
  from transformers import AutoModelForCausalLM, AutoTokenizer
@@ -48,28 +51,42 @@ With `pipeline`:
48
 
49
  ```python
50
  from transformers import pipeline
 
51
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
52
  print(pipe(prompt, effort="high", max_new_tokens=64)[0]["generated_text"])
53
  ```
54
 
55
- > **Generation is single-sequence.** Batched generation and left padding are
56
- > not supported (right-padded batching works for scoring, e.g. lm-eval).
57
- > **No KV cache** in this release it arrives in min-spark 1.1.
 
 
 
 
 
 
58
 
59
- Without Transformers, use the bundled `generate.py`:
60
  ```bash
61
  python generate.py -p "The meaning of life is" -e high
62
  ```
63
 
64
  ## Benchmarks
65
 
66
- Chart and table generated from `results_all_k.json` (exact values):
 
 
 
67
 
68
- ![accuracy](charts/accuracy.svg)
69
- ![byte perplexity](charts/byteppl.svg)
 
 
 
 
70
 
71
- <details>
72
- <summary>Benchmark table (source of truth)</summary>
 
73
 
74
  | Effort | BLiMP | ARC-Easy | ARC-Challenge | HellaSwag | PIQA | WikiText-2 byte-ppl |
75
  |--------|-------|----------|---------------|-----------|------|---------------------|
@@ -77,49 +94,99 @@ Chart and table generated from `results_all_k.json` (exact values):
77
  | min-spark-medium | 69.19% | 37.08% | 22.78% | 27.92% | 54.30% | 2.7747 |
78
  | min-spark-high | 69.18% | 37.08% | 22.87% | 27.91% | 54.35% | 2.7747 |
79
 
80
- </details>
 
 
 
 
 
 
 
 
81
 
82
- > These are the exact values from `results_all_k.json`. If they drift from
83
- > `charts/benchmark_table.md` (the source of truth), the table here is wrong.
84
 
85
- Metrics: BLiMP acc, ARC-Easy/ARC-Challenge/HellaSwag/PIQA acc_norm,
86
- WikiText-2 byte perplexity (lower is better), evaluated with the
87
- lm-eval==0.4.12 harness (batched, masked/train-consistent; the published
88
- methodology see `run_lmeval.py`).
89
 
90
- ### lm-eval notes
91
 
92
- - Reproduce the published numbers: `python run_lmeval.py --effort medium`
93
- (add `--limit N` to bound runtime).
94
- - The stock `--model hf` path also works and is measured to differ from the
95
- published methodology as recorded in `deltas.json` (paired same-subset
96
- measurement). The published numbers are the methodology in `run_lmeval.py`.
 
 
 
 
 
 
 
 
 
97
 
98
  ## Architecture
99
 
100
- The native Hugging Face architecture viewer was investigated (see
101
- `ARCHITECTURE-VIEWER.md`); the robust fallback diagram below ships regardless.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
- ![architecture](architecture.svg)
 
104
 
105
- ## Technical note
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
- min-spark is Meiosis (PICO release 1), a tied-embedding looped decoder:
108
- embed prelude ×1 body of 3 distinct GQA blocks (6 Q / 2 KV heads, FFN 768)
109
- × K loops, with per-loop LoRA (rank 16), a transient loop embedding, and
110
- Deep-Delta (vdim 1) residuals → coda ×1 → RMSNorm → tied unembed. 11 block
111
- applications per token. Effort maps to the internal loop count K: low=2,
112
- medium=3, high=4. Trained 10.01B tokens on a filtered fineweb-edu +
113
- finemath-4plus mix with a warmup-stable-decay schedule and a 20% cooldown.
114
 
115
- ## Provenance
116
 
117
- - Source checkpoint: `meiosis-decay-p09`, step 182,875, 10.01B tokens.
118
- - `model.safetensors` sha256: `a121c6a316e54e490918d93d3d265460d45addbdad49b8448c514e5f61232c41`
119
- - `tokenizer.json` sha256: `d671f013ebdb06a55e48d047f12621c3311310fdcc344683d434d294a909ac51`
120
- - Eval: lm-eval==0.4.12, batched (batch 32), masked/train-consistent; the
121
- per-effort loop-count mapping and best-of selection are in the Technical
122
- note.
 
 
123
 
124
  ## License
125
 
 
7
  - tiny
8
  - looped
9
  - text-generation
10
+ - sub-10m
11
  ---
12
 
13
  # min-spark
14
 
15
+ min-spark is a 5.76M-parameter decoder-only language model trained on 10.01B
16
+ tokens. It is the first release in the min-spark family of sub-10M models.
 
17
 
18
+ The model runs a small weight-shared core repeatedly instead of stacking many
19
+ distinct layers. Each pass through the core is one *loop*. The number of loops
20
+ is a dial you control at inference time: fewer loops is faster, more loops is
21
+ more capable. We expose three presets, called **effort levels**.
22
 
23
+ | Effort | Compute | Use when |
24
+ |--------|---------|----------|
25
+ | min-spark-low | quickest | high-throughput, short replies |
26
+ | min-spark-medium | balanced | general use (default) |
27
+ | min-spark-high | highest quality | you want the best answer per token |
28
 
29
+ ## How to use
30
 
31
+ The model loads with standard Transformers. The repository is currently
32
+ private, so authenticate first with `hf auth login` (or set `HF_TOKEN`).
33
 
34
  ```python
35
  from transformers import AutoModelForCausalLM, AutoTokenizer
 
51
 
52
  ```python
53
  from transformers import pipeline
54
+
55
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
56
  print(pipe(prompt, effort="high", max_new_tokens=64)[0]["generated_text"])
57
  ```
58
 
59
+ Two constraints to know up front.
60
+
61
+ - **Single sequence.** Generation runs one sequence at a time. Batched
62
+ generation and left padding are not supported; right-padded batches work
63
+ for scoring, which is what lm-eval uses.
64
+ - **No KV cache yet.** It arrives in min-spark 1.1. For a 5.76M model this is
65
+ rarely a bottleneck, but long generations re-encode the prefix each step.
66
+
67
+ A transformers-free path is bundled as `generate.py`:
68
 
 
69
  ```bash
70
  python generate.py -p "The meaning of life is" -e high
71
  ```
72
 
73
  ## Benchmarks
74
 
75
+ Scores are zero-shot, evaluated with lm-eval 0.4.12, batched and
76
+ masked/train-consistent. BLiMP is accuracy; ARC-Easy, ARC-Challenge,
77
+ HellaSwag, and PIQA are length-normalized accuracy; WikiText-2 is byte
78
+ perplexity, lower is better.
79
 
80
+ Across the three effort levels, min-spark sits in the mid-60s on BLiMP,
81
+ low-to-mid 30s on ARC-Easy, and low-20s on ARC-Challenge and HellaSwag. On
82
+ PIQA it lands in the low-50s. The best WikiText-2 byte perplexity is 2.77.
83
+ Higher effort helps on BLiMP, where medium and high reach about 69; on the
84
+ other tasks the three levels stay close, which means the common-sense tasks
85
+ are less sensitive to loop count than grammar is.
86
 
87
+ ### By effort level
88
+
89
+ ![min-spark accuracy by effort](charts/effort.svg)
90
 
91
  | Effort | BLiMP | ARC-Easy | ARC-Challenge | HellaSwag | PIQA | WikiText-2 byte-ppl |
92
  |--------|-------|----------|---------------|-----------|------|---------------------|
 
94
  | min-spark-medium | 69.19% | 37.08% | 22.78% | 27.92% | 54.30% | 2.7747 |
95
  | min-spark-high | 69.18% | 37.08% | 22.87% | 27.91% | 54.35% | 2.7747 |
96
 
97
+ ### Against other small models
98
+
99
+ The chart below takes the best score min-spark reaches on each benchmark
100
+ across effort levels, and compares it to published results from comparable
101
+ sub-10M models: [GPT-S2-5M](https://huggingface.co/AxiomicLabs/GPT-S2-5M),
102
+ [SLM-10M](https://huggingface.co/LiodonAI/SLM-10M), and
103
+ [michel-nano-v2](https://huggingface.co/finnianx/michel-nano-v2). Scores are
104
+ from those models' published cards, so some cells are blank where a model does
105
+ not report that benchmark.
106
 
107
+ ![min-spark best score vs small-model peers](charts/comparison.svg)
 
108
 
109
+ min-spark matches or beats the comparison set on ARC-Easy (37.1 vs the next
110
+ best 35.9) and ARC-Challenge (23.2 vs 23.5 for SLM-10M, above the rest). On
111
+ HellaSwag and PIQA it sits in the same band as the peers. BLiMP is reported
112
+ only by michel-nano-v2 (72.5), where min-spark lands at 69.2.
113
 
114
+ ### Against KeyLM
115
 
116
+ The prior release in this line, [KeyLM-75M](https://huggingface.co/MinimaLabs/KeyLM-75M),
117
+ is a 75.25M-parameter model trained on 18B tokens, thirteen times the size of
118
+ min-spark. min-spark reaches roughly comparable common-sense numbers at a
119
+ fraction of the parameter budget. KeyLM reports ARC at 29.9 average and
120
+ HellaSwag at 29.7; min-spark reaches 37.1 on ARC-Easy, 23.2 on ARC-Challenge,
121
+ and 27.9 on HellaSwag. On PIQA, KeyLM scores 60.0 and min-spark reaches 54.4.
122
+
123
+ The gap on PIQA and the ARC average is the honest picture: the looped
124
+ architecture compresses a lot of the parameter-count advantage, but a 13x
125
+ parameter difference still shows up on the harder relational tasks. What the
126
+ comparison does show is that a 5.76M looped model is in the same general band
127
+ as a 75M standard model on a large share of these tasks, at less than a tenth
128
+ of the inference cost. KeyLM's reported numbers are zero-shot accuracy from
129
+ its own card.
130
 
131
  ## Architecture
132
 
133
+ min-spark is a tied-embedding, looped decoder. A byte-level BPE vocabulary of
134
+ 4,096 feeds an embedding, a single prelude block, then a body of three
135
+ distinct grouped-query-attention blocks that are run K times, then a coda
136
+ block and a tied unembedding. Each loop pass adds a per-loop LoRA and a
137
+ transient loop embedding; residuals use Deep-Delta projections. There are 11
138
+ block applications per token.
139
+
140
+ The model runs 11 block applications per token, which is why a 5.76M
141
+ parameter count behaves more like a somewhat larger standard model.
142
+
143
+ The interactive architecture graph is rendered by
144
+ [hfviewer](https://hfviewer.com/), a graph viewer that traces the model and
145
+ lets you zoom from the top-level shape down to individual blocks. The embed
146
+ below is a summary card; open it to reach the full graph with block-level
147
+ detail. The first render can take a few minutes while hfviewer traces the
148
+ model.
149
+
150
+ [![min-spark architecture](https://hfviewer.com/api/card.svg?source=MinimaLabs%2Fmin-spark&granularity=auto&animated=false)](https://hfviewer.com/MinimaLabs/min-spark)
151
 
152
+ The three effort levels map to the internal loop count K: min-spark-low is
153
+ K=2, min-spark-medium is K=3, min-spark-high is K=4.
154
 
155
+ ## Training
156
+
157
+ min-spark was trained on 10.01B tokens drawn from a filtered fineweb-edu and
158
+ finemath-4plus mix, with a warmup-stable-decay schedule and a 20% cooldown.
159
+ The released checkpoint is at step 182,875 of that run.
160
+
161
+ `model.safetensors` sha256:
162
+ `a121c6a316e54e490918d93d3d265460d45addbdad49b8448c514e5f61232c41`
163
+
164
+ `tokenizer.json` sha256:
165
+ `d671f013ebdb06a55e48d047f12621c3311310fdcc344683d434d294a909ac51`
166
+
167
+ ## Reproducing the benchmarks
168
+
169
+ The bundled `run_lmeval.py` reproduces the published numbers exactly. Run it
170
+ with the effort you want to check:
171
+
172
+ ```bash
173
+ python run_lmeval.py --effort medium --tasks blimp,arc_easy,arc_challenge,hellaswag,piqa,wikitext
174
+ ```
175
 
176
+ Add `--limit N` to bound runtime. The stock `--model hf` path in lm-eval also
177
+ works; the measured difference between it and the published methodology is
178
+ recorded in `deltas.json`.
 
 
 
 
179
 
180
+ ## Limitations
181
 
182
+ - A 5.76M model is small. Factual recall, multi-step reasoning, and
183
+ long-range coherence are weak.
184
+ - The base model is not instruction-tuned, aligned, or filtered for safety.
185
+ It completes text as-is, including harmful or offensive continuations.
186
+ - Context length is 512 tokens.
187
+ - Generation is single-sequence, and there is no KV cache yet.
188
+ - Scores were collected at a 512-token context; longer contexts are not
189
+ validated.
190
 
191
  ## License
192