StonefishAI commited on
Commit ·
a613dcf
1
Parent(s): d0c1103
StonefishAI v2 - 222M parameters, 2.05B tokens, zero dependencies
Browse files- .gitattributes +1 -0
- README.md +107 -0
- stonefish_en.final.state +3 -0
- tiny.bpe +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.state filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- text-generation
|
| 7 |
+
- rust
|
| 8 |
+
- from-scratch
|
| 9 |
+
- zero-dependencies
|
| 10 |
+
- cuda
|
| 11 |
+
- rmsnorm
|
| 12 |
+
- swiglu
|
| 13 |
+
- rope
|
| 14 |
+
datasets:
|
| 15 |
+
- roneneldan/TinyStories
|
| 16 |
+
- sedthh/gutenberg_english
|
| 17 |
+
library_name: stonefish_ai
|
| 18 |
+
pipeline_tag: text-generation
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# StonefishAI v2 — 222M
|
| 22 |
+
|
| 23 |
+
A 222,331,904-parameter English language model trained from scratch on a corpus of
|
| 24 |
+
TinyStories and Project Gutenberg, by an engine with **zero dependencies**:
|
| 25 |
+
autograd, byte-level BPE, the transformer and the CUDA kernels are all in the
|
| 26 |
+
[repository](https://github.com/Edipcm-hash/stonefish), written by hand.
|
| 27 |
+
|
| 28 |
+
This repository contains the weights only. You need the inference code from the
|
| 29 |
+
main repository to run them — see *How to use* below.
|
| 30 |
+
|
| 31 |
+
## Model
|
| 32 |
+
|
| 33 |
+
| | |
|
| 34 |
+
|---|---|
|
| 35 |
+
| Architecture | decoder-only transformer, pre-norm |
|
| 36 |
+
| Parameters | 222,331,904 |
|
| 37 |
+
| Layers / width / heads | 16 / 1024 / 8 (d_head 128) |
|
| 38 |
+
| Context | 512 tokens |
|
| 39 |
+
| Vocabulary | 16,384 (byte-level BPE) |
|
| 40 |
+
| Normalisation | RMSNorm, no bias, eps 1e-6 |
|
| 41 |
+
| Activation | SwiGLU, hidden 2816 |
|
| 42 |
+
| Position | RoPE, theta 10,000 |
|
| 43 |
+
| Tying | output head reuses the token embedding |
|
| 44 |
+
| Precision | fp32 |
|
| 45 |
+
| Checkpoint | `stonefish_en.final.state` (`SFEN001` format, 848 MB) |
|
| 46 |
+
|
| 47 |
+
## Training
|
| 48 |
+
|
| 49 |
+
| | |
|
| 50 |
+
|---|---|
|
| 51 |
+
| Data | TinyStories v2 + Project Gutenberg (English) |
|
| 52 |
+
| Tokens | 2,047,457,313 (exactly one epoch) |
|
| 53 |
+
| Steps | 62,483 |
|
| 54 |
+
| Batch | 4 sequences x gradient accumulation 16 = 32,768 tokens/step |
|
| 55 |
+
| Optimiser | Adam (0.9 / 0.999, eps 1e-6) |
|
| 56 |
+
| Schedule | 4e-4 peak, 1,000-step warmup, cosine decay, clip 1.0 |
|
| 57 |
+
| Dropout | 0.1 |
|
| 58 |
+
| Hardware | one RTX 5070 (12 GB), 250 W, ~56 hours |
|
| 59 |
+
| Throughput | ~10,700 tokens/s |
|
| 60 |
+
|
| 61 |
+
That is 9.2 tokens per parameter, less than half of what scaling studies
|
| 62 |
+
recommend — this model is deliberately *compute-limited*, not data-limited.
|
| 63 |
+
|
| 64 |
+
## How to use
|
| 65 |
+
|
| 66 |
+
The weights are useless without the tokenizer: `tiny.bpe` (126 KB) must sit next
|
| 67 |
+
to the checkpoint.
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
git clone https://github.com/Edipcm-hash/stonefish
|
| 71 |
+
cd stonefish
|
| 72 |
+
cargo build --release # no CUDA? add --no-default-features
|
| 73 |
+
|
| 74 |
+
# put stonefish_en.final.state and data/en/tiny.bpe in place, then:
|
| 75 |
+
cargo run --release -- en-gen "Once upon a time" 150 0.8
|
| 76 |
+
cargo run --release -- en-eval 8 data/en/tiny stonefish_en.final.state
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
With CUDA the generation path uses the KV-cache on the GPU (~100+ tokens/s).
|
| 80 |
+
Without it, the CPU path loads the same checkpoint into the CPU model and runs
|
| 81 |
+
through the autograd engine at roughly 3 tokens/s.
|
| 82 |
+
|
| 83 |
+
## Intended use and limits
|
| 84 |
+
|
| 85 |
+
**Use it for:** text continuation in English, and as a reference implementation
|
| 86 |
+
of a language model with no framework underneath.
|
| 87 |
+
|
| 88 |
+
**Do not use it for:** questions and answers, chat, facts, code generation,
|
| 89 |
+
translation, or anything with consequences. It was never fine-tuned for
|
| 90 |
+
instruction following, and it states invented facts fluently.
|
| 91 |
+
|
| 92 |
+
It is also **not** safety-tuned: a hostile prompt can elicit biased or unpleasant
|
| 93 |
+
continuations, and the training data (children's stories plus a mostly
|
| 94 |
+
19th-century Western canon) carries the blind spots of its sources.
|
| 95 |
+
|
| 96 |
+
## Evaluation
|
| 97 |
+
|
| 98 |
+
See the main repository's README, section 7, for the measured validation loss,
|
| 99 |
+
perplexity, bits-per-character and generation samples — with the exact command
|
| 100 |
+
that produced each number. The numbers are not duplicated here on purpose: two
|
| 101 |
+
copies drift.
|
| 102 |
+
|
| 103 |
+
## Licence
|
| 104 |
+
|
| 105 |
+
MIT for the code and these weights. The training corpora keep their own licences
|
| 106 |
+
(TinyStories: CDLA-Sharing-1.0; Gutenberg: public domain in the US), which is why
|
| 107 |
+
no data is redistributed.
|
stonefish_en.final.state
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b545e716644351801c8bb9601243a12de55e7594fb151e09dd066a477de46d8
|
| 3 |
+
size 889328828
|
tiny.bpe
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:67dfbdd324a2106f6e919e794400a854694a4dc6866779076fd601a279db5165
|
| 3 |
+
size 129040
|